16#define KTEST_VERSION 3
17#define KTEST_MAGIC_SIZE 5
18#define KTEST_MAGIC "KTEST"
21#define BOUT_MAGIC "BOUT\n"
26 unsigned char data[4];
27 if (fread(data, 4, 1, f)!=1)
29 *value_out = (((((data[0]<<8) + data[1])<<8) + data[2])<<8) + data[3];
34 unsigned char data[4];
39 return fwrite(data, 1, 4, f)==4;
46 *value_out = (
char*) malloc(len+1);
49 if (fread(*value_out, len, 1, f)!=1)
51 (*value_out)[len] = 0;
56 unsigned len = strlen(value);
59 if (fwrite(value, len, 1, f)!=1)
83 FILE *f = fopen(path,
"rb");
95 FILE *f = fopen(path,
"rb");
104 res = (
KTest*) calloc(1,
sizeof(*res));
179 FILE *f = fopen(path,
"wb");
191 for (i=0; i<bo->
numArgs; i++) {
void kTest_free(KTest *bo)
int kTest_toFile(KTest *bo, const char *path)
static int write_uint32(FILE *f, unsigned value)
KTest * kTest_fromFile(const char *path)
static int write_string(FILE *f, const char *value)
static int kTest_checkHeader(FILE *f)
static int read_uint32(FILE *f, unsigned *value_out)
static int read_string(FILE *f, char **value_out)
int kTest_isKTestFile(const char *path)
unsigned kTest_numBytes(KTest *bo)
unsigned kTest_getCurrentVersion()