Skip to content

Commit

Permalink
test: add test that checks that no round-trip VARCHAR casting is perf…
Browse files Browse the repository at this point in the history
…ormed
  • Loading branch information
Taepper committed Oct 24, 2024
1 parent 916f381 commit daab97d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/silo/preprocessing/preprocessor.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,24 @@ const Scenario DIVERSE_SEQUENCE_NAMES_NDJSON = {
[{"count":2}])")
};

const Scenario PREVENT_LATE_AUTO_CASTING = {
.input_directory = "testBaseData/autoCasting/",
.expected_sequence_count = 3,
.query = R"(
{
"action": {
"type": "Details",
"orderByFields": ["accessionVersion"]
},
"filterExpression": {
"type": "True"
}
}
)",
.expected_query_result = nlohmann::json::parse(R"(
[{"accessionVersion":"0"},{"accessionVersion":"0.12"},{"accessionVersion":"text_without_quotes"}])")
};

class PreprocessorTestFixture : public ::testing::TestWithParam<Scenario> {};

INSTANTIATE_TEST_SUITE_P(
Expand All @@ -345,7 +363,8 @@ INSTANTIATE_TEST_SUITE_P(
EMPTY_INPUT_NDJSON_UNPARTITIONED,
NO_GENES,
NO_NUCLEOTIDE_SEQUENCES,
NO_SEQUENCES
NO_SEQUENCES,
PREVENT_LATE_AUTO_CASTING
),
printTestName
);
Expand Down
6 changes: 6 additions & 0 deletions testBaseData/autoCasting/database_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
schema:
instanceName: Test
metadata:
- name: accessionVersion
type: string
primaryKey: accessionVersion
3 changes: 3 additions & 0 deletions testBaseData/autoCasting/input.ndjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{"metadata": { "accessionVersion": 0 }, "unalignedNucleotideSequences": {}, "alignedNucleotideSequences": {}, "nucleotideInsertions": {}, "alignedAminoAcidSequences": {}, "aminoAcidInsertions": {}}
{"metadata": { "accessionVersion": 0.12 }, "unalignedNucleotideSequences": {}, "alignedNucleotideSequences": {}, "nucleotideInsertions": {}, "alignedAminoAcidSequences": {}, "aminoAcidInsertions": {}}
{"metadata": { "accessionVersion": "text_without_quotes" }, "unalignedNucleotideSequences": {}, "alignedNucleotideSequences": {}, "nucleotideInsertions": {}, "alignedAminoAcidSequences": {}, "aminoAcidInsertions": {}}
2 changes: 2 additions & 0 deletions testBaseData/autoCasting/preprocessing_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ndjsonInputFilename: "input.ndjson"
referenceGenomeFilename: "reference_genomes.json"
1 change: 1 addition & 0 deletions testBaseData/autoCasting/reference_genomes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"genes":[],"nucleotideSequences":[]}

0 comments on commit daab97d

Please sign in to comment.