void TestReadWrite(void) { Vectors t = (Vectors){LFK_NewTable(4)}; LFK_AddColumn(t.table, sizeof(float)); LFK_AddColumn(t.table, sizeof(float)); InsertVector(t, 10, 20); InsertVector(t, 11, 21); const char* file = "testfiles/test.bin"; FILE *f = fopen(file, "w"); LFK_Write(t.table, f); fclose(f); LFK_FreeTable(t.table); f = fopen(file, "r"); Vectors t2 = (Vectors){LFK_Read(f)}; fclose(f); assert(t2.table->column_len == 2); assert(t2.table != NULL); assert(FloatValue(t2.table, 0, 0) == 10); assert(FloatValue(t2.table, 1, 0) == 20); assert(FloatValue(t2.table, 0, 1) == 11); assert(FloatValue(t2.table, 1, 1) == 21); LFK_FreeTable(t2.table); }
void InsertVector(RCP< MultiVector>& partial, size_t block, RCP<MultiVector>& full) const { InsertVector(*partial, block, *full); }