added unit tests for assembly_checker
* limitations under the License.
*/
-#include <boost/filesystem.hpp>
-#include <fstream>
-
-#include "catch/catch.hpp"
+#include <set>
+#include <string>
#include "vcf/assembly_checker.hpp"
-#include "vcf/string_constants.hpp"
+#include "vcf/error.hpp"
+#include "vcf/vcf_fasta_variant.hpp"
+
+#include "catch/catch.hpp"
namespace ebi
{
- TEST_CASE("", "[assembly_checker]")
+ TEST_CASE("Function checks", "[assembly_checker]")
{
+ SECTION("Missing chromosome")
+ {
+ std::set<std::string> chromosomes;
+ chromosomes.insert("1");
+ CHECK_THROWS_AS(ebi::vcf::assembly_checker::check_missing_chromosomes(chromosomes), std::invalid_argument);
+ }
+ SECTION("Check sequence matches")
+ {
+ std::string line{"1\t10177\trs367896724\tA\tAC"};
+ vcf::VcfVariant vcf_variant{line};
+ CHECK(ebi::vcf::assembly_checker::is_matching_sequence(vcf_variant.reference_allele, "A"));
+ CHECK_FALSE(ebi::vcf::assembly_checker::is_matching_sequence(vcf_variant.reference_allele, "G"));
}
+
+ SECTION("All matches")
+ {
+ ebi::vcf::MatchStats match_stats;
+ match_stats.add_match_result(true);
+ match_stats.add_match_result(true);
+ CHECK(match_stats.is_valid_combination());
}
+ SECTION("Mismatches")
+ {
+ ebi::vcf::MatchStats match_stats;
+ match_stats.add_match_result(true);
+ match_stats.add_match_result(false);
+ CHECK_FALSE(match_stats.is_valid_combination());
+ }
+ }
+}
