Skip to content

Commit

Permalink
Merge pull request #119 from srbcheema1/test_cases
Browse files Browse the repository at this point in the history
Added test cases for SVLEN
  • Loading branch information
Cristina Yenyxe Gonzalez Garcia committed Apr 6, 2018
2 parents 15dd67b + 4a5c3b0 commit e38e5d3
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/vcf/validate_optional_policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ namespace ebi
util::string_split(it->second, ",", values);
if (values.size() != record.alternate_alleles.size()) {
throw new InfoBodyError{state.n_lines,
"INFO SVLEN should have same number of values as ALT ", "Expected " + std::to_string(record.alternate_alleles.size())
"INFO SVLEN should have same number of values as ALT", "Expected " + std::to_string(record.alternate_alleles.size())
+ ", found " + std::to_string(values.size())};
}
}
Expand Down
45 changes: 45 additions & 0 deletions test/vcf/optional_policy_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,51 @@ namespace ebi
vcf::InfoBodyError*);
}
}

SECTION("SVLEN test")
{
source->meta_entries.emplace(vcf::INFO,
vcf::MetaEntry{
1,
vcf::INFO,
{
{ vcf::ID, vcf::SVLEN },
{ vcf::NUMBER, "2" },
{ vcf::TYPE, vcf::INTEGER },
{ vcf::DESCRIPTION, "Difference in length between REF and ALT alleles" }
},
source
});

CHECK_NOTHROW( (optional_policy.optional_check_body_entry(parsing_state, vcf::Record{
1,
"chr1",
123456,
{ "id123" },
"A",
{ "AC", "ACT" },
1.0,
{ vcf::PASS },
{ { vcf::SVLEN, "1,2" } },
{ vcf::GT },
{ "1|0" },
source})) );

CHECK_THROWS_AS( (optional_policy.optional_check_body_entry(parsing_state, vcf::Record{
1,
"chr1",
123456,
{ "id123" },
"A",
{ "AC" },
1.0,
{ vcf::PASS },
{ { vcf::SVLEN, "1,2" } },
{ vcf::GT },
{ "0|1" },
source})),
vcf::InfoBodyError*);
}
}

TEST_CASE("Alternate allele warnings", "[body alt warnings]")
Expand Down

0 comments on commit e38e5d3

Please sign in to comment.