| 854 | } |
| 855 | |
| 856 | uint32_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 | |
| 901 | std::vector<ResultEnmrQCCell> CPPQueryConditionEnumerationFx::read_array( |
| 902 | EnmrQCCreator creator) { |
nothing calls this directly
no test coverage detected