Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions test/correctness/debug_to_file_multiple_outputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,17 @@ int main(int argc, char **argv) {
assert(f && g && h);

int header[5];
assert(fread((void *)(&header[0]), 4, 5, f) == 5);
size_t header_bytes = fread((void *)(&header[0]), 4, 5, f);
assert(header_bytes == 5);
assert(header[0] == size_x + 1);
assert(header[1] == size_y);
assert(header[2] == 1);
assert(header[3] == 1);
assert(header[4] == 7);

std::vector<int32_t> f_data((size_x + 1) * size_y);
assert(fread((void *)(&f_data[0]), 4, (size_x + 1) * size_y, f) == (size_x + 1) * size_y);
size_t f_data_bytes = fread((void *)(&f_data[0]), 4, (size_x + 1) * size_y, f);
assert(f_data_bytes == (size_x + 1) * size_y);
for (int y = 0; y < size_y; y++) {
for (int x = 0; x < size_x + 1; x++) {
int32_t val = f_data[y * (size_x + 1) + x];
Expand All @@ -71,15 +73,17 @@ int main(int argc, char **argv) {
}
fclose(f);

assert(fread((void *)(&header[0]), 4, 5, g) == 5);
header_bytes = fread((void *)(&header[0]), 4, 5, g);
assert(header_bytes == 5);
assert(header[0] == size_x);
assert(header[1] == size_y);
assert(header[2] == 1);
assert(header[3] == 1);
assert(header[4] == 0);

std::vector<float> g_data(size_x * size_y);
assert(fread((void *)(&g_data[0]), 4, size_x * size_y, g) == size_x * size_y);
size_t g_data_bytes = fread((void *)(&g_data[0]), 4, size_x * size_y, g);
assert(g_data_bytes == size_x * size_y);
for (int y = 0; y < size_y; y++) {
for (int x = 0; x < size_x; x++) {
float val = g_data[y * size_x + x];
Expand All @@ -92,15 +96,17 @@ int main(int argc, char **argv) {
}
fclose(g);

assert(fread((void *)(&header[0]), 4, 5, h) == 5);
header_bytes = fread((void *)(&header[0]), 4, 5, h);
assert(header_bytes == 5);
assert(header[0] == size_x);
assert(header[1] == size_y);
assert(header[2] == 1);
assert(header[3] == 1);
assert(header[4] == 0);

std::vector<float> h_data(size_x * size_y);
assert(fread((void *)(&h_data[0]), 4, size_x * size_y, h) == size_x * size_y);
size_t h_data_bytes = fread((void *)(&h_data[0]), 4, size_x * size_y, h);
assert(h_data_bytes == size_x * size_y);
for (int y = 0; y < size_y; y++) {
for (int x = 0; x < size_x; x++) {
float val = h_data[y * size_x + x];
Expand Down
18 changes: 12 additions & 6 deletions test/correctness/debug_to_file_reorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,17 @@ int main(int argc, char **argv) {
assert(f && g && h);

int header[5];
assert(fread((void *)(&header[0]), 4, 5, f) == 5);
size_t header_bytes = fread((void *)(&header[0]), 4, 5, f);
assert(header_bytes == 5);
assert(header[0] == size_x + 1);
assert(header[1] == size_y);
assert(header[2] == 1);
assert(header[3] == 1);
assert(header[4] == 7);

std::vector<int32_t> f_data((size_x + 1) * size_y);
assert(fread((void *)(&f_data[0]), 4, (size_x + 1) * size_y, f) == (size_x + 1) * size_y);
size_t f_data_bytes = fread((void *)(&f_data[0]), 4, (size_x + 1) * size_y, f);
assert(f_data_bytes == (size_x + 1) * size_y);
for (int y = 0; y < size_y; y++) {
for (int x = 0; x < size_x + 1; x++) {
int32_t val = f_data[y * (size_x + 1) + x];
Expand All @@ -74,15 +76,17 @@ int main(int argc, char **argv) {
}
fclose(f);

assert(fread((void *)(&header[0]), 4, 5, g) == 5);
header_bytes = fread((void *)(&header[0]), 4, 5, g);
assert(header_bytes == 5);
assert(header[0] == size_x);
assert(header[1] == size_y);
assert(header[2] == 1);
assert(header[3] == 1);
assert(header[4] == 0);

std::vector<float> g_data(size_x * size_y);
assert(fread((void *)(&g_data[0]), 4, size_x * size_y, g) == size_x * size_y);
size_t g_data_bytes = fread((void *)(&g_data[0]), 4, size_x * size_y, g);
assert(g_data_bytes == size_x * size_y);
for (int y = 0; y < size_y; y++) {
for (int x = 0; x < size_x; x++) {
float val = g_data[y * size_x + x];
Expand All @@ -95,15 +99,17 @@ int main(int argc, char **argv) {
}
fclose(g);

assert(fread((void *)(&header[0]), 4, 5, h) == 5);
header_bytes = fread((void *)(&header[0]), 4, 5, h);
assert(header_bytes == 5);
assert(header[0] == size_x);
assert(header[1] == size_y);
assert(header[2] == 1);
assert(header[3] == 1);
assert(header[4] == 0);

std::vector<float> h_data(size_x * size_y);
assert(fread((void *)(&h_data[0]), 4, size_x * size_y, h) == size_x * size_y);
size_t h_data_bytes = fread((void *)(&h_data[0]), 4, size_x * size_y, h);
assert(h_data_bytes == size_x * size_y);
for (int y = 0; y < size_y; y++) {
for (int x = 0; x < size_x; x++) {
float val = h_data[y * size_x + x];
Expand Down