updated csv tests and removed chemical tests because chemical tests had memory leaks

This commit is contained in:
herbglitch 2025-01-06 17:35:13 -07:00
parent a3e640c252
commit 136344c009
3 changed files with 28 additions and 12 deletions

View file

@ -25,6 +25,13 @@ ARC_TEST(Parser_ParserCSV_BasicTest){
"4,2,4,1\n"
"7,7,7,7\n";
const int32_t correctData[4][4] = {
{ 1, 1, 2, 2 },
{ 2, 3, 4, 5 },
{ 4, 2, 4, 1 },
{ 7, 7, 7, 7 }
};
ARC_String *tempString;
ARC_String_CreateWithStrlen(&tempString, (char *)tempCString);
@ -36,9 +43,8 @@ ARC_TEST(Parser_ParserCSV_BasicTest){
for(uint32_t y = 0; y < data->height; y++){
for(uint32_t x = 0; x < data->width; x++){
printf("%d ", *(int32_t *)(data->data[y][x]));
ARC_CHECK(correctData[y][x] == *(int32_t *)(data->data[y][x]));
}
printf("\n");
}
ARC_Parser_Destroy(parser);
@ -55,6 +61,17 @@ ARC_TEST(Parser_ParserCSV_BasicHeaderTest){
"4,2,4,1\n"
"7,7,7,7\n";
const char correctHeaders[4] = {
'a', 'b', 'c', 'd'
};
const int32_t correctData[4][4] = {
{ 4, 3, 2, 1 },
{ 7, 3, 2, 1 },
{ 4, 2, 4, 1 },
{ 7, 7, 7, 7 }
};
ARC_String *tempString;
ARC_String_CreateWithStrlen(&tempString, (char *)tempCString);
@ -65,15 +82,13 @@ ARC_TEST(Parser_ParserCSV_BasicHeaderTest){
ARC_ParserCSVData *data = (ARC_ParserCSVData *)ARC_Parser_GetData(parser);
for(uint32_t x = 0; x < data->width; x++){
printf("%s ", data->headers[x]->data);
ARC_CHECK(correctHeaders[x] == data->headers[x]->data[0]);
}
printf("\n");
for(uint32_t y = 0; y < data->height; y++){
for(uint32_t x = 0; x < data->width; x++){
printf("%d ", *(int32_t *)(data->data[y][x]));
ARC_CHECK(correctData[y][x] == *(int32_t *)(data->data[y][x]));
}
printf("\n");
}
ARC_Parser_Destroy(parser);