Skip to content

Commit

Permalink
NOT NEEDED, JUST FOR TESTING: Add test that verifies ADCs on airport.csv
Browse files Browse the repository at this point in the history
  • Loading branch information
ol-imorozko committed Oct 5, 2024
1 parent 48923d1 commit 6395e4a
Show file tree
Hide file tree
Showing 2 changed files with 244 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/tests/test_dc_structures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,4 +556,43 @@ TEST_F(FastADC, DenialConstraints) {
}
}

TEST(FastADCAirport, RealDenialConstraints) {
CSVParser parser{kAirport};
auto table = model::ColumnLayoutTypedRelationData::CreateFrom(parser, true, true);
auto col_data = std::move(table->GetColumnData());

PredicateIndexProvider pred_index_provider;
PredicateProvider pred_provider;
IntIndexProvider int_prov;
DoubleIndexProvider double_prov;
StringIndexProvider string_prov;

PredicateBuilder predicate_builder(&pred_provider, &pred_index_provider, true);
predicate_builder.BuildPredicateSpace(col_data);

PliShardBuilder plibuilder(&int_prov, &double_prov, &string_prov);
plibuilder.BuildPliShards(col_data);

EvidenceAuxStructuresBuilder aux_builder(predicate_builder);
aux_builder.BuildAll();

EvidenceSetBuilder evidence_set_builder(plibuilder.pli_shards, aux_builder.GetPredicatePacks());
evidence_set_builder.BuildEvidenceSet(aux_builder.GetCorrectionMap(),
aux_builder.GetCardinalityMask());

ApproxEvidenceInverter dcbuilder(predicate_builder, 0.01,
std::move(evidence_set_builder.evidence_set));
auto dcs = dcbuilder.BuildDenialConstraints();

std::vector<DenialConstraint> result = std::move(dcs.GetResult());
std::set<DenialConstraint, ToStringComparator> ordered_result(
std::make_move_iterator(result.begin()), std::make_move_iterator(result.end()));

for (size_t i = 0; i < expected_real_denial_constraints.size(); i++) {
std::string dc = std::next(ordered_result.begin(), i)->ToString();
EXPECT_EQ(dc, expected_real_denial_constraints[i])
<< "Unexpected denial constraint: " << dc;
}
}

} // namespace tests
205 changes: 205 additions & 0 deletions src/tests/test_dc_structures_correct_results.h
Original file line number Diff line number Diff line change
Expand Up @@ -550,3 +550,208 @@ std::vector<std::string> expected_denial_constraints = {
"¬{ t.D == s.D ∧ t.F == s.F }",
"¬{ t.D == s.D ∧ t.G == s.G }",
"¬{ t.E == s.E }"};

std::vector<std::string> expected_real_denial_constraints = {
"¬{ t.continent != s.continent ∧ t.iso_country == s.iso_country }",
"¬{ t.continent != s.continent ∧ t.municipality == s.municipality }",
"¬{ t.continent == s.continent ∧ t.gps_code != s.gps_code ∧ t.gps_code == s.local_code ∧ "
"t.local_code == s.local_code }",
"¬{ t.continent == s.continent ∧ t.gps_code == s.gps_code ∧ t.gps_code != s.local_code }",
"¬{ t.continent == s.continent ∧ t.gps_code == s.gps_code ∧ t.local_code != s.local_code }",
"¬{ t.continent == s.continent ∧ t.gps_code == s.gps_code ∧ t.local_code == s.local_code }",
"¬{ t.continent == s.continent ∧ t.gps_code == s.local_code ∧ t.local_code != s.local_code "
"}",
"¬{ t.continent == s.continent ∧ t.iso_country != s.iso_country ∧ t.gps_code == s.gps_code "
"∧ t.gps_code == s.local_code }",
"¬{ t.continent == s.continent ∧ t.iso_region != s.iso_region ∧ t.municipality != "
"s.municipality ∧ t.gps_code == s.gps_code ∧ t.gps_code == s.local_code }",
"¬{ t.continent == s.continent ∧ t.municipality == s.municipality }",
"¬{ t.coordinates == s.coordinates }",
"¬{ t.elevation_ft != s.elevation_ft ∧ t.continent != s.continent ∧ t.gps_code == "
"s.gps_code ∧ t.gps_code == s.local_code ∧ t.local_code != s.local_code }",
"¬{ t.elevation_ft != s.elevation_ft ∧ t.continent == s.continent ∧ t.gps_code == "
"s.gps_code ∧ t.gps_code == s.local_code }",
"¬{ t.elevation_ft != s.elevation_ft ∧ t.continent == s.continent ∧ t.iso_country != "
"s.iso_country ∧ t.gps_code == s.gps_code }",
"¬{ t.elevation_ft != s.elevation_ft ∧ t.municipality == s.municipality }",
"¬{ t.elevation_ft < s.elevation_ft ∧ t.continent == s.continent ∧ t.gps_code == "
"s.local_code ∧ t.local_code == s.local_code }",
"¬{ t.elevation_ft < s.elevation_ft ∧ t.continent == s.continent ∧ t.iso_country != "
"s.iso_country ∧ t.municipality != s.municipality ∧ t.gps_code == s.local_code }",
"¬{ t.elevation_ft <= s.elevation_ft ∧ t.continent != s.continent ∧ t.gps_code == "
"s.gps_code ∧ t.gps_code != s.local_code }",
"¬{ t.elevation_ft <= s.elevation_ft ∧ t.continent == s.continent ∧ t.gps_code != "
"s.gps_code ∧ t.gps_code == s.local_code }",
"¬{ t.elevation_ft <= s.elevation_ft ∧ t.continent == s.continent ∧ t.gps_code == "
"s.gps_code }",
"¬{ t.elevation_ft <= s.elevation_ft ∧ t.continent == s.continent ∧ t.iso_country != "
"s.iso_country ∧ t.gps_code != s.local_code ∧ t.local_code == s.local_code }",
"¬{ t.elevation_ft <= s.elevation_ft ∧ t.continent == s.continent ∧ t.iso_country != "
"s.iso_country ∧ t.gps_code == s.local_code ∧ t.local_code == s.local_code }",
"¬{ t.elevation_ft <= s.elevation_ft ∧ t.gps_code != s.gps_code ∧ t.gps_code == "
"s.local_code ∧ t.local_code != s.local_code }",
"¬{ t.elevation_ft <= s.elevation_ft ∧ t.municipality == s.municipality }",
"¬{ t.elevation_ft == s.elevation_ft ∧ t.continent != s.continent ∧ t.gps_code == "
"s.local_code }",
"¬{ t.elevation_ft == s.elevation_ft ∧ t.continent != s.continent ∧ t.municipality != "
"s.municipality ∧ t.local_code == s.local_code }",
"¬{ t.elevation_ft == s.elevation_ft ∧ t.continent == s.continent }",
"¬{ t.elevation_ft == s.elevation_ft ∧ t.gps_code != s.gps_code }",
"¬{ t.elevation_ft == s.elevation_ft ∧ t.gps_code != s.local_code }",
"¬{ t.elevation_ft == s.elevation_ft ∧ t.gps_code == s.gps_code }",
"¬{ t.elevation_ft == s.elevation_ft ∧ t.iso_country != s.iso_country ∧ t.gps_code == "
"s.local_code ∧ t.local_code == s.local_code }",
"¬{ t.elevation_ft == s.elevation_ft ∧ t.iso_country == s.iso_country }",
"¬{ t.elevation_ft == s.elevation_ft ∧ t.local_code != s.local_code }",
"¬{ t.elevation_ft == s.elevation_ft ∧ t.municipality != s.municipality ∧ t.gps_code == "
"s.local_code }",
"¬{ t.elevation_ft > s.elevation_ft ∧ t.continent == s.continent ∧ t.gps_code == "
"s.local_code }",
"¬{ t.elevation_ft > s.elevation_ft ∧ t.iso_country != s.iso_country ∧ t.gps_code != "
"s.gps_code ∧ t.gps_code == s.local_code ∧ t.local_code != s.local_code }",
"¬{ t.elevation_ft > s.elevation_ft ∧ t.iso_region != s.iso_region ∧ t.gps_code != "
"s.gps_code ∧ t.gps_code == s.local_code ∧ t.local_code != s.local_code }",
"¬{ t.elevation_ft > s.elevation_ft ∧ t.municipality != s.municipality ∧ t.gps_code != "
"s.gps_code ∧ t.gps_code == s.local_code ∧ t.local_code != s.local_code }",
"¬{ t.elevation_ft >= s.elevation_ft ∧ t.continent != s.continent ∧ t.gps_code != "
"s.gps_code ∧ t.gps_code == s.local_code ∧ t.local_code != s.local_code }",
"¬{ t.elevation_ft >= s.elevation_ft ∧ t.continent == s.continent ∧ t.gps_code != "
"s.gps_code ∧ t.gps_code == s.local_code }",
"¬{ t.elevation_ft >= s.elevation_ft ∧ t.continent == s.continent ∧ t.gps_code == "
"s.local_code ∧ t.local_code == s.local_code }",
"¬{ t.elevation_ft >= s.elevation_ft ∧ t.continent == s.continent ∧ t.iso_country != "
"s.iso_country ∧ t.gps_code == s.local_code }",
"¬{ t.elevation_ft >= s.elevation_ft ∧ t.gps_code == s.gps_code ∧ t.gps_code != "
"s.local_code }",
"¬{ t.elevation_ft >= s.elevation_ft ∧ t.gps_code == s.gps_code ∧ t.gps_code == "
"s.local_code ∧ t.local_code != s.local_code }",
"¬{ t.gps_code == s.gps_code ∧ t.gps_code != s.local_code ∧ t.local_code == s.local_code }",
"¬{ t.ident == s.gps_code }",
"¬{ t.ident == s.ident }",
"¬{ t.ident == s.local_code }",
"¬{ t.iso_country != s.iso_country ∧ t.municipality == s.municipality }",
"¬{ t.iso_country == s.iso_country ∧ t.gps_code == s.gps_code }",
"¬{ t.iso_country == s.iso_country ∧ t.gps_code == s.local_code }",
"¬{ t.iso_country == s.iso_country ∧ t.local_code == s.local_code }",
"¬{ t.iso_country == s.iso_country ∧ t.municipality == s.municipality }",
"¬{ t.iso_region == s.iso_region }",
"¬{ t.municipality == s.municipality ∧ t.gps_code != s.gps_code }",
"¬{ t.municipality == s.municipality ∧ t.gps_code != s.local_code }",
"¬{ t.municipality == s.municipality ∧ t.gps_code == s.gps_code }",
"¬{ t.municipality == s.municipality ∧ t.gps_code == s.local_code }",
"¬{ t.municipality == s.municipality ∧ t.local_code != s.local_code }",
"¬{ t.municipality == s.municipality ∧ t.local_code == s.local_code }",
"¬{ t.name == s.name }",
"¬{ t.type != s.type ∧ t.continent == s.continent ∧ t.gps_code != s.gps_code ∧ t.gps_code "
"== s.local_code }",
"¬{ t.type != s.type ∧ t.continent == s.continent ∧ t.gps_code == s.gps_code }",
"¬{ t.type != s.type ∧ t.continent == s.continent ∧ t.gps_code == s.local_code ∧ "
"t.local_code == s.local_code }",
"¬{ t.type != s.type ∧ t.elevation_ft < s.elevation_ft ∧ t.continent != s.continent ∧ "
"t.gps_code == s.gps_code ∧ t.gps_code == s.local_code }",
"¬{ t.type != s.type ∧ t.elevation_ft < s.elevation_ft ∧ t.continent == s.continent ∧ "
"t.iso_country != s.iso_country ∧ t.local_code == s.local_code }",
"¬{ t.type != s.type ∧ t.elevation_ft < s.elevation_ft ∧ t.gps_code == s.gps_code ∧ "
"t.local_code == s.local_code }",
"¬{ t.type != s.type ∧ t.elevation_ft <= s.elevation_ft ∧ t.continent == s.continent ∧ "
"t.gps_code != s.gps_code ∧ t.local_code == s.local_code }",
"¬{ t.type != s.type ∧ t.elevation_ft <= s.elevation_ft ∧ t.continent == s.continent ∧ "
"t.gps_code != s.local_code ∧ t.local_code == s.local_code }",
"¬{ t.type != s.type ∧ t.elevation_ft <= s.elevation_ft ∧ t.continent == s.continent ∧ "
"t.gps_code == s.local_code }",
"¬{ t.type != s.type ∧ t.elevation_ft <= s.elevation_ft ∧ t.gps_code == s.gps_code ∧ "
"t.local_code != s.local_code }",
"¬{ t.type != s.type ∧ t.elevation_ft <= s.elevation_ft ∧ t.gps_code == s.local_code ∧ "
"t.local_code != s.local_code }",
"¬{ t.type != s.type ∧ t.elevation_ft == s.elevation_ft ∧ t.continent != s.continent }",
"¬{ t.type != s.type ∧ t.elevation_ft == s.elevation_ft ∧ t.gps_code == s.local_code }",
"¬{ t.type != s.type ∧ t.elevation_ft == s.elevation_ft ∧ t.iso_country != s.iso_country }",
"¬{ t.type != s.type ∧ t.elevation_ft == s.elevation_ft ∧ t.local_code == s.local_code }",
"¬{ t.type != s.type ∧ t.elevation_ft == s.elevation_ft ∧ t.municipality != s.municipality "
"}",
"¬{ t.type != s.type ∧ t.elevation_ft > s.elevation_ft ∧ t.continent != s.continent ∧ "
"t.gps_code != s.gps_code ∧ t.gps_code == s.local_code ∧ t.local_code == s.local_code }",
"¬{ t.type != s.type ∧ t.elevation_ft > s.elevation_ft ∧ t.iso_country != s.iso_country ∧ "
"t.gps_code == s.local_code ∧ t.local_code != s.local_code }",
"¬{ t.type != s.type ∧ t.elevation_ft >= s.elevation_ft ∧ t.continent != s.continent ∧ "
"t.gps_code == s.local_code ∧ t.local_code != s.local_code }",
"¬{ t.type != s.type ∧ t.elevation_ft >= s.elevation_ft ∧ t.continent != s.continent ∧ "
"t.municipality != s.municipality ∧ t.gps_code != s.gps_code ∧ t.gps_code == s.local_code "
"∧ t.local_code == s.local_code }",
"¬{ t.type != s.type ∧ t.elevation_ft >= s.elevation_ft ∧ t.continent == s.continent ∧ "
"t.gps_code != s.local_code ∧ t.local_code == s.local_code }",
"¬{ t.type != s.type ∧ t.elevation_ft >= s.elevation_ft ∧ t.continent == s.continent ∧ "
"t.gps_code == s.local_code }",
"¬{ t.type != s.type ∧ t.gps_code != s.gps_code ∧ t.gps_code == s.local_code ∧ "
"t.local_code != s.local_code }",
"¬{ t.type != s.type ∧ t.gps_code == s.gps_code ∧ t.gps_code != s.local_code }",
"¬{ t.type != s.type ∧ t.municipality == s.municipality }",
"¬{ t.type == s.type ∧ t.continent != s.continent ∧ t.gps_code == s.gps_code ∧ "
"t.local_code == s.local_code }",
"¬{ t.type == s.type ∧ t.continent == s.continent ∧ t.gps_code != s.gps_code ∧ t.gps_code "
"== s.local_code }",
"¬{ t.type == s.type ∧ t.continent == s.continent ∧ t.gps_code == s.gps_code }",
"¬{ t.type == s.type ∧ t.continent == s.continent ∧ t.gps_code == s.local_code ∧ "
"t.local_code == s.local_code }",
"¬{ t.type == s.type ∧ t.continent == s.continent ∧ t.iso_country != s.iso_country ∧ "
"t.gps_code != s.local_code ∧ t.local_code == s.local_code }",
"¬{ t.type == s.type ∧ t.continent == s.continent ∧ t.iso_country != s.iso_country ∧ "
"t.gps_code == s.local_code }",
"¬{ t.type == s.type ∧ t.continent == s.continent ∧ t.iso_region != s.iso_region ∧ "
"t.gps_code == s.local_code }",
"¬{ t.type == s.type ∧ t.continent == s.continent ∧ t.municipality != s.municipality ∧ "
"t.gps_code == s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft != s.elevation_ft ∧ t.continent == s.continent ∧ "
"t.gps_code == s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft != s.elevation_ft ∧ t.iso_country != s.iso_country ∧ "
"t.gps_code == s.gps_code ∧ t.local_code == s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft != s.elevation_ft ∧ t.municipality != s.municipality "
"∧ t.gps_code == s.gps_code ∧ t.local_code == s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft < s.elevation_ft ∧ t.continent != s.continent ∧ "
"t.gps_code != s.gps_code ∧ t.gps_code == s.local_code ∧ t.local_code == s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft < s.elevation_ft ∧ t.continent != s.continent ∧ "
"t.gps_code == s.gps_code }",
"¬{ t.type == s.type ∧ t.elevation_ft < s.elevation_ft ∧ t.continent == s.continent ∧ "
"t.local_code == s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft <= s.elevation_ft ∧ t.continent == s.continent ∧ "
"t.gps_code != s.gps_code ∧ t.local_code == s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft <= s.elevation_ft ∧ t.continent == s.continent ∧ "
"t.gps_code != s.local_code ∧ t.local_code == s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft <= s.elevation_ft ∧ t.continent == s.continent ∧ "
"t.gps_code == s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft <= s.elevation_ft ∧ t.continent == s.continent ∧ "
"t.iso_country != s.iso_country ∧ t.local_code == s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft <= s.elevation_ft ∧ t.continent == s.continent ∧ "
"t.municipality != s.municipality ∧ t.local_code == s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft <= s.elevation_ft ∧ t.gps_code == s.gps_code ∧ "
"t.gps_code == s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft <= s.elevation_ft ∧ t.gps_code == s.gps_code ∧ "
"t.local_code != s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft <= s.elevation_ft ∧ t.gps_code == s.gps_code ∧ "
"t.local_code == s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft <= s.elevation_ft ∧ t.gps_code == s.local_code ∧ "
"t.local_code != s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft == s.elevation_ft }",
"¬{ t.type == s.type ∧ t.elevation_ft > s.elevation_ft ∧ t.continent != s.continent ∧ "
"t.gps_code != s.gps_code ∧ t.gps_code == s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft > s.elevation_ft ∧ t.continent != s.continent ∧ "
"t.gps_code == s.local_code ∧ t.local_code == s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft > s.elevation_ft ∧ t.gps_code == s.gps_code ∧ "
"t.gps_code == s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft >= s.elevation_ft ∧ t.continent != s.continent ∧ "
"t.gps_code == s.gps_code ∧ t.gps_code == s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft >= s.elevation_ft ∧ t.continent != s.continent ∧ "
"t.municipality != s.municipality ∧ t.gps_code != s.gps_code ∧ t.gps_code == s.local_code "
"}",
"¬{ t.type == s.type ∧ t.elevation_ft >= s.elevation_ft ∧ t.continent == s.continent ∧ "
"t.gps_code != s.local_code ∧ t.local_code == s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft >= s.elevation_ft ∧ t.continent == s.continent ∧ "
"t.gps_code == s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft >= s.elevation_ft ∧ t.gps_code != s.gps_code ∧ "
"t.gps_code == s.local_code ∧ t.local_code == s.local_code }",
"¬{ t.type == s.type ∧ t.elevation_ft >= s.elevation_ft ∧ t.gps_code == s.local_code ∧ "
"t.local_code != s.local_code }",
"¬{ t.type == s.type ∧ t.gps_code != s.gps_code ∧ t.gps_code == s.local_code ∧ "
"t.local_code != s.local_code }",
"¬{ t.type == s.type ∧ t.gps_code == s.gps_code ∧ t.gps_code != s.local_code }",
"¬{ t.type == s.type ∧ t.municipality == s.municipality }"};

0 comments on commit 6395e4a

Please sign in to comment.