From 53612c023787fbaa3721a28b768ce925d952e905 Mon Sep 17 00:00:00 2001 From: Yang-Yang Feng Date: Tue, 26 Mar 2019 14:04:46 -0500 Subject: [PATCH] add tests --- tests/integration-test/test_junctions_extract.py | 12 ++++++++++++ .../test_cis_splice_effects_identifier.cc | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/tests/integration-test/test_junctions_extract.py b/tests/integration-test/test_junctions_extract.py index d01f3b9..645a082 100755 --- a/tests/integration-test/test_junctions_extract.py +++ b/tests/integration-test/test_junctions_extract.py @@ -90,6 +90,18 @@ def test_no_bam(self): rv, err = self.execute(params) self.assertEqual(rv, 1) + def test_missing_bam(self): + output_file = self.tempFile("extract.out") + params = ["junctions", "extract", "-s 0", "-o", output_file, "does_not_exist.bam"] + rv, err = self.execute(params) + self.assertEqual(rv, 1) + + def test_no_strandness(self): + output_file = self.tempFile("extract.out") + params = ["junctions", "extract", "-o", output_file] + rv, err = self.execute(params) + self.assertEqual(rv, 1) + def test_help(self): output_file = self.tempFile("extract.out") params = ["junctions", "extract", "-h"] diff --git a/tests/lib/cis-splice-effects/test_cis_splice_effects_identifier.cc b/tests/lib/cis-splice-effects/test_cis_splice_effects_identifier.cc index 49c4341..29a454c 100644 --- a/tests/lib/cis-splice-effects/test_cis_splice_effects_identifier.cc +++ b/tests/lib/cis-splice-effects/test_cis_splice_effects_identifier.cc @@ -62,6 +62,17 @@ TEST_F(CisSpliceEffectsIdentifierTest, ParseInput3) { EXPECT_THROW(csei1.parse_options(argc, argv), common::cmdline_help_exception); } +//Check for missing files +TEST_F(CisSpliceEffectsIdentifierTest, ParseInput5) { + int argc = 5; + char * argv[] = {"identify", + "test_does_not_exist.vcf", + "test.fa", + "test.gtf", + "test.bam"}; + EXPECT_THROW(csei1.parse_options(argc, argv), std::runtime_error); +} + //Test if constructor works as expected. TEST_F(CisSpliceEffectsIdentifierTest, ConstructorTest) { EXPECT_EQ(csei1.vcf(), "NA");