MCPcopy Create free account
hub / github.com/TileDB-Inc/TileDB / check_read

Method check_read

test/src/unit-cppapi-query-condition-enumerations.cc:856–899  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

854}
855
856uint32_t CPPQueryConditionEnumerationFx::check_read(
857 EnmrQCMatcher matcher, EnmrQCCreator creator) {
858 validate_query_condition(creator);
859
860 // Calculate the number of matches to expect.
861 uint32_t should_match = 0;
862 for (auto& cell : data_) {
863 if (matcher(cell)) {
864 should_match += 1;
865 }
866 }
867
868 auto results = read_array(creator);
869
870 uint32_t num_matched = 0;
871
872 for (size_t i = 0; i < num_rows_; i++) {
873 if (type_ == TILEDB_DENSE) {
874 // Dense reads always return a value where non-matching cells are just
875 // the fill values for all attributes.
876 if (matcher(data_[i])) {
877 REQUIRE(results[i] == data_[i]);
878 num_matched += 1;
879 } else {
880 REQUIRE(results[i] == *fill_.get());
881 }
882 // Just an internal test assertion that all dense values are valid.
883 REQUIRE(results[i].valid);
884 } else {
885 // Sparse queries only return cells that match. We mark this with whether
886 // the ResultEnmrQCCell has its valid flag set or not.
887 if (matcher(data_[i])) {
888 REQUIRE(results[i] == data_[i]);
889 num_matched += 1;
890 } else {
891 REQUIRE(results[i].valid == false);
892 }
893 }
894 }
895
896 REQUIRE(num_matched == should_match);
897
898 return num_matched;
899}
900
901std::vector<ResultEnmrQCCell> CPPQueryConditionEnumerationFx::read_array(
902 EnmrQCCreator creator) {

Callers

nothing calls this directly

Calls 2

read_arrayFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected