Skip to content

Commit 6017582

Browse files
committed
Fill in other global order unit test examples
1 parent c10ef48 commit 6017582

File tree

1 file changed

+64
-11
lines changed

1 file changed

+64
-11
lines changed

test/src/unit-query-add-predicate.cc

Lines changed: 64 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ TEST_CASE_METHOD(
290290
"C API: Test query add predicate errors",
291291
"[capi][query][add_predicate]") {
292292
const std::string array_name =
293-
vfs_test_setup_.array_uri("test_qeury_add_predicate_errors");
293+
vfs_test_setup_.array_uri("test_query_add_predicate_errors");
294294

295295
create_array(array_name, TILEDB_SPARSE);
296296
write_array(array_name, TILEDB_SPARSE);
@@ -458,24 +458,77 @@ TEST_CASE_METHOD(
458458
6,
459459
7,
460460
std::nullopt});
461+
461462
const auto result =
462463
query_array(array_name, TILEDB_GLOBAL_ORDER, "a IS NOT NULL");
463-
CHECK(result.d1_ == expect.d1_);
464-
CHECK(result.d2_ == expect.d2_);
465-
CHECK(std::get<0>(result.atts_) == std::get<0>(expect.atts_));
466-
CHECK(std::get<1>(result.atts_) == std::get<1>(expect.atts_));
467-
CHECK(std::get<2>(result.atts_) == std::get<2>(expect.atts_));
464+
CHECK(result == expect);
468465
}
469466

470-
SECTION("WHERE b < 'fourteen'") {
471-
// TODO
467+
SECTION("WHERE v < 'fourteen'") {
468+
const Cells expect = make_cells(
469+
{1, 2, 2, 3, 4},
470+
{4, 1, 4, 3, 3},
471+
{12, std::nullopt, std::nullopt, 5, 1},
472+
{"four", "five", "eight", "eleven", "fifteen"},
473+
{std::nullopt, 7, 0, 3, 7});
474+
475+
const auto result =
476+
query_array(array_name, TILEDB_GLOBAL_ORDER, "v < 'fourteen'");
477+
CHECK(result == expect);
472478
}
473479

474480
SECTION("WHERE row + col <= 4") {
475-
// TODO
481+
const Cells expect = make_cells(
482+
{1, 1, 1, 2, 2, 3},
483+
{1, 2, 3, 1, 2, 1},
484+
{15, std::nullopt, std::nullopt, std::nullopt, 10, 7},
485+
{"one", "two", "three", "five", "six", "nine"},
486+
{4, 4, 7, 7, 7, 1});
487+
488+
const auto result =
489+
query_array(array_name, TILEDB_GLOBAL_ORDER, "row + col <= 4");
490+
CHECK(result == expect);
476491
}
477492

478-
SECTION("WHERE coalesce(a, row) > a") {
479-
// TODO
493+
SECTION("WHERE a IS NULL AND row > col") {
494+
const Cells expect = make_cells(
495+
{2, 4},
496+
{1, 1},
497+
{std::nullopt, std::nullopt},
498+
{"five", "thirteen"},
499+
{7, std::nullopt});
500+
501+
const auto result = query_array(
502+
array_name, TILEDB_GLOBAL_ORDER, {"a IS NULL", "row > col"});
503+
CHECK(result == expect);
504+
}
505+
506+
SECTION("WHERE coalesce(a, row) > col") {
507+
const Cells expect = make_cells(
508+
{1, 1, 2, 2, 2, 3, 3, 3, 4},
509+
{1, 4, 1, 2, 3, 1, 2, 3, 1},
510+
{15, 12, std::nullopt, 10, 9, 7, 6, 5, std::nullopt},
511+
{"one",
512+
"four",
513+
"five",
514+
"six",
515+
"seven",
516+
"nine",
517+
"ten",
518+
"eleven",
519+
"thirteen"},
520+
{4,
521+
std::nullopt,
522+
7,
523+
7,
524+
std::nullopt,
525+
1,
526+
std::nullopt,
527+
3,
528+
std::nullopt});
529+
530+
const auto result = query_array(
531+
array_name, TILEDB_GLOBAL_ORDER, {"coalesce(a, row) > col"});
532+
CHECK(result == expect);
480533
}
481534
}

0 commit comments

Comments
 (0)