|
38 | 38 |
|
39 | 39 | void check_dump( |
40 | 40 | tiledb_ctx_t* ctx, tiledb_attribute_t* a, const std::string& gold_out) { |
41 | | - FILE* gold_fout = fopen("gold_fout.txt", "w"); |
42 | | - fwrite(gold_out.c_str(), sizeof(char), gold_out.size(), gold_fout); |
43 | | - fclose(gold_fout); |
44 | | - FILE* fout = fopen("fout.txt", "w"); |
45 | | - tiledb_attribute_dump(ctx, a, fout); |
46 | | - fclose(fout); |
47 | | -#ifdef _WIN32 |
48 | | - CHECK(!system("FC gold_fout.txt fout.txt > nul")); |
49 | | -#else |
50 | | - CHECK(!system("diff gold_fout.txt fout.txt")); |
51 | | -#endif |
| 41 | + tiledb_string_t* tdb_string; |
| 42 | + auto rc = tiledb_attribute_dump_str(ctx, a, &tdb_string); |
| 43 | + REQUIRE(rc == TILEDB_OK); |
52 | 44 |
|
53 | | - // Clean up |
54 | | - tiledb_vfs_t* vfs; |
55 | | - tiledb_vfs_alloc(ctx, nullptr, &vfs); |
56 | | - CHECK(tiledb_vfs_remove_file(ctx, vfs, "gold_fout.txt") == TILEDB_OK); |
57 | | - CHECK(tiledb_vfs_remove_file(ctx, vfs, "fout.txt") == TILEDB_OK); |
58 | | - tiledb_vfs_free(&vfs); |
| 45 | + const char* out_ptr; |
| 46 | + size_t out_length; |
| 47 | + rc = tiledb_string_view(tdb_string, &out_ptr, &out_length); |
| 48 | + REQUIRE(rc == TILEDB_OK); |
| 49 | + std::string out_str(out_ptr, out_length); |
| 50 | + |
| 51 | + CHECK(out_str == gold_out); |
59 | 52 | } |
60 | 53 |
|
61 | 54 | TEST_CASE( |
|
0 commit comments