PandA-2024.02
Macros | Functions | Variables
test_support.c File Reference
#include "support.h"
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <unistd.h>
#include <fcntl.h>
#include <assert.h>
Include dependency graph for test_support.c:

Go to the source code of this file.

Macros

#define generate_test_TYPE_array(TYPE)
 
#define STRLEN   11
 
#define TESTSTR   "hello world"
 

Functions

void run_benchmark (void *vargs)
 
void input_to_data (int fd, void *vdata)
 
void output_to_data (int fd, void *vdata)
 
void data_to_output (int fd, void *vdata)
 
int check_data (void *vdata, void *vref)
 
 generate_test_TYPE_array (uint8_t)
 
void test_strings ()
 
void test_prng ()
 
int main (int argc, char **argv)
 

Variables

int INPUT_SIZE
 

Macro Definition Documentation

◆ generate_test_TYPE_array

#define generate_test_TYPE_array (   TYPE)
Value:
void test_##TYPE##_array() { \
char *p; \
TYPE a[10]; \
int i, fd; \
\
/* Write output */ \
fd = open("testfile", O_WRONLY|O_CREAT|O_TRUNC, 0666); \
assert(fd>1 && "Couldn't open file to write test output"); \
for(i=0; i<10; i++) { \
a[i] = (TYPE)i; \
} \
write_##TYPE##_array(fd, a, 10); \
close(fd); \
fd = open("testfile", O_RDONLY); \
assert(fd>1 && "Couldn't open file to read test input"); \
p = readfile(fd); \
close(fd); \
assert( parse_##TYPE##_array(p, a, 10)==0 ); \
for(i=0; i<10; i++) { \
assert(a[i]==((TYPE)i)); \
} \
}
#define TYPE
Definition: backprop.h:21
char * readfile(int fd)
Definition: support.c:34

Definition at line 19 of file test_support.c.

◆ STRLEN

#define STRLEN   11

Definition at line 64 of file test_support.c.

Referenced by test_strings().

◆ TESTSTR

#define TESTSTR   "hello world"

Definition at line 65 of file test_support.c.

Referenced by test_strings().

Function Documentation

◆ check_data()

int check_data ( void *  vdata,
void *  vref 
)

Definition at line 15 of file test_support.c.

◆ data_to_output()

void data_to_output ( int  fd,
void *  vdata 
)

Definition at line 14 of file test_support.c.

◆ generate_test_TYPE_array()

generate_test_TYPE_array ( uint8_t  )

Definition at line 42 of file test_support.c.

References find_section_start(), and readfile().

Here is the call graph for this function:

◆ input_to_data()

void input_to_data ( int  fd,
void *  vdata 
)

Definition at line 12 of file test_support.c.

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 120 of file test_support.c.

References test_prng(), and test_strings().

Here is the call graph for this function:

◆ output_to_data()

void output_to_data ( int  fd,
void *  vdata 
)

Definition at line 13 of file test_support.c.

◆ run_benchmark()

void run_benchmark ( void *  vargs)

Definition at line 11 of file test_support.c.

◆ test_prng()

void test_prng ( )

Definition at line 101 of file test_support.c.

References prng_rand(), and prng_srand().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_strings()

void test_strings ( )

Definition at line 66 of file test_support.c.

References parse_string(), readfile(), SECTION_TERMINATED, STRLEN, test(), TESTSTR, write_section_header(), and write_string().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ INPUT_SIZE

int INPUT_SIZE

Definition at line 16 of file test_support.c.


Generated on Mon Feb 12 2024 13:03:10 for PandA-2024.02 by doxygen 1.8.13