iPXE
Defines | Functions | Variables
memset_test.c File Reference

memset() self-tests More...

#include <string.h>
#include <ipxe/test.h>

Go to the source code of this file.

Defines

#define MEMSET_TEST_CONSTANT(len)
 Perform a constant-length memset() test.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
void memset_zero_0 (void *dest)
void memset_zero_1 (void *dest)
void memset_zero_2 (void *dest)
void memset_zero_3 (void *dest)
void memset_zero_4 (void *dest)
void memset_zero_5 (void *dest)
void memset_zero_6 (void *dest)
void memset_zero_7 (void *dest)
void memset_zero_8 (void *dest)
void memset_zero_9 (void *dest)
void memset_zero_10 (void *dest)
void memset_zero_11 (void *dest)
void memset_zero_12 (void *dest)
void memset_zero_13 (void *dest)
void memset_zero_14 (void *dest)
void memset_zero_15 (void *dest)
void memset_zero_16 (void *dest)
void memset_zero_17 (void *dest)
void memset_zero_18 (void *dest)
void memset_zero_19 (void *dest)
void memset_zero_20 (void *dest)
void memset_zero_21 (void *dest)
void memset_zero_22 (void *dest)
void memset_zero_23 (void *dest)
void memset_zero_24 (void *dest)
void memset_zero_25 (void *dest)
void memset_zero_26 (void *dest)
void memset_zero_27 (void *dest)
void memset_zero_28 (void *dest)
void memset_zero_29 (void *dest)
void memset_zero_30 (void *dest)
void memset_zero_31 (void *dest)
void * memset_var (void *dest, unsigned int fill, size_t len)
 Force a call to the variable-length implementation of memset()
static void memset_test_exec (void)
 Perform memset() self-tests.

Variables

struct self_test memset_test __self_test
 memset() self-test

Detailed Description

memset() self-tests

Definition in file memset_test.c.


Define Documentation

#define MEMSET_TEST_CONSTANT (   len)
Value:
do {                            \
                uint8_t dest_const[ 1 + len + 1 ];                      \
                uint8_t dest_var[ 1 + len + 1 ];                        \
                static uint8_t zero[len];                               \
                unsigned int i;                                         \
                                                                        \
                for ( i = 0 ; i < sizeof ( dest_const ) ; i++ )         \
                        dest_const[i] = 0xaa;                           \
                memset ( ( dest_const + 1 ), 0, len );                  \
                ok ( dest_const[0] == 0xaa );                           \
                ok ( dest_const[ sizeof ( dest_const ) - 1 ] == 0xaa ); \
                ok ( memcmp ( ( dest_const + 1 ), zero, len ) == 0 );   \
                                                                        \
                for ( i = 0 ; i < sizeof ( dest_var ) ; i++ )           \
                        dest_var[i] = 0xbb;                             \
                memset_var ( ( dest_var + 1 ), 0, len );                \
                ok ( dest_var[0] == 0xbb );                             \
                ok ( dest_var[ sizeof ( dest_var ) - 1 ] == 0xbb );     \
                ok ( memcmp ( ( dest_var + 1 ), zero, len ) == 0 );     \
        } while ( 0 )

Perform a constant-length memset() test.

Parameters:
lenLength of data

Definition at line 91 of file memset_test.c.

Referenced by memset_test_exec().


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
void memset_zero_0 ( void *  dest)

Definition at line 40 of file memset_test.c.

References memset().

{ memset ( dest, 0, 0 ); }
void memset_zero_1 ( void *  dest)

Definition at line 41 of file memset_test.c.

References memset().

{ memset ( dest, 0, 1 ); }
void memset_zero_2 ( void *  dest)

Definition at line 42 of file memset_test.c.

References memset().

{ memset ( dest, 0, 2 ); }
void memset_zero_3 ( void *  dest)

Definition at line 43 of file memset_test.c.

References memset().

{ memset ( dest, 0, 3 ); }
void memset_zero_4 ( void *  dest)

Definition at line 44 of file memset_test.c.

References memset().

{ memset ( dest, 0, 4 ); }
void memset_zero_5 ( void *  dest)

Definition at line 45 of file memset_test.c.

References memset().

{ memset ( dest, 0, 5 ); }
void memset_zero_6 ( void *  dest)

Definition at line 46 of file memset_test.c.

References memset().

{ memset ( dest, 0, 6 ); }
void memset_zero_7 ( void *  dest)

Definition at line 47 of file memset_test.c.

References memset().

{ memset ( dest, 0, 7 ); }
void memset_zero_8 ( void *  dest)

Definition at line 48 of file memset_test.c.

References memset().

{ memset ( dest, 0, 8 ); }
void memset_zero_9 ( void *  dest)

Definition at line 49 of file memset_test.c.

References memset().

{ memset ( dest, 0, 9 ); }
void memset_zero_10 ( void *  dest)

Definition at line 50 of file memset_test.c.

References memset().

{ memset ( dest, 0, 10 ); }
void memset_zero_11 ( void *  dest)

Definition at line 51 of file memset_test.c.

References memset().

{ memset ( dest, 0, 11 ); }
void memset_zero_12 ( void *  dest)

Definition at line 52 of file memset_test.c.

References memset().

{ memset ( dest, 0, 12 ); }
void memset_zero_13 ( void *  dest)

Definition at line 53 of file memset_test.c.

References memset().

{ memset ( dest, 0, 13 ); }
void memset_zero_14 ( void *  dest)

Definition at line 54 of file memset_test.c.

References memset().

{ memset ( dest, 0, 14 ); }
void memset_zero_15 ( void *  dest)

Definition at line 55 of file memset_test.c.

References memset().

{ memset ( dest, 0, 15 ); }
void memset_zero_16 ( void *  dest)

Definition at line 56 of file memset_test.c.

References memset().

{ memset ( dest, 0, 16 ); }
void memset_zero_17 ( void *  dest)

Definition at line 57 of file memset_test.c.

References memset().

{ memset ( dest, 0, 17 ); }
void memset_zero_18 ( void *  dest)

Definition at line 58 of file memset_test.c.

References memset().

{ memset ( dest, 0, 18 ); }
void memset_zero_19 ( void *  dest)

Definition at line 59 of file memset_test.c.

References memset().

{ memset ( dest, 0, 19 ); }
void memset_zero_20 ( void *  dest)

Definition at line 60 of file memset_test.c.

References memset().

{ memset ( dest, 0, 20 ); }
void memset_zero_21 ( void *  dest)

Definition at line 61 of file memset_test.c.

References memset().

{ memset ( dest, 0, 21 ); }
void memset_zero_22 ( void *  dest)

Definition at line 62 of file memset_test.c.

References memset().

{ memset ( dest, 0, 22 ); }
void memset_zero_23 ( void *  dest)

Definition at line 63 of file memset_test.c.

References memset().

{ memset ( dest, 0, 23 ); }
void memset_zero_24 ( void *  dest)

Definition at line 64 of file memset_test.c.

References memset().

{ memset ( dest, 0, 24 ); }
void memset_zero_25 ( void *  dest)

Definition at line 65 of file memset_test.c.

References memset().

{ memset ( dest, 0, 25 ); }
void memset_zero_26 ( void *  dest)

Definition at line 66 of file memset_test.c.

References memset().

{ memset ( dest, 0, 26 ); }
void memset_zero_27 ( void *  dest)

Definition at line 67 of file memset_test.c.

References memset().

{ memset ( dest, 0, 27 ); }
void memset_zero_28 ( void *  dest)

Definition at line 68 of file memset_test.c.

References memset().

{ memset ( dest, 0, 28 ); }
void memset_zero_29 ( void *  dest)

Definition at line 69 of file memset_test.c.

References memset().

{ memset ( dest, 0, 29 ); }
void memset_zero_30 ( void *  dest)

Definition at line 70 of file memset_test.c.

References memset().

{ memset ( dest, 0, 30 ); }
void memset_zero_31 ( void *  dest)

Definition at line 71 of file memset_test.c.

References memset().

{ memset ( dest, 0, 31 ); }
void* memset_var ( void *  dest,
unsigned int  fill,
size_t  len 
)

Force a call to the variable-length implementation of memset()

Parameters:
destDestination address
fillFill pattern
lenLength of data
Return values:
destDestination address

Definition at line 81 of file memset_test.c.

References memset().

                                                              {
        return memset ( dest, fill, len );
}
static void memset_test_exec ( void  ) [static]

Variable Documentation

struct self_test memset_test __self_test
Initial value:
 {
        .name = "memset",
        .exec = memset_test_exec,
}

memset() self-test

Definition at line 154 of file memset_test.c.