Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEST] Adding cli tests for detect_breakends. #19

Merged
merged 1 commit into from
Oct 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions test/cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ add_cli_test(find_deletions_cli_test.cpp)
add_dependencies (find_deletions_cli_test "find_deletions")
target_use_datasources (find_deletions_cli_test FILES detect_breakends_shorted.vcf)

add_cli_test(detect_breakends_cli_test.cpp)
add_dependencies (detect_breakends_cli_test "detect_breakends")
target_use_datasources (detect_breakends_cli_test FILES converted_bam_shorted.sam)

# add_cli_test (iGenVar_options_test.cpp)
# target_use_datasources (iGenVar_options_test FILES in.fastq)
70 changes: 70 additions & 0 deletions test/cli/detect_breakends_cli_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#include <seqan3/alphabet/nucleotide/dna5.hpp>
#include <seqan3/io/sequence_file/input.hpp>

#include "cli_test.hpp"
#include <fstream>
#include <sstream>
TEST_F(cli_test, no_options)
{
cli_test_result result = execute_app("detect_breakends");
std::string expected
{
"detectJunctions - Detect junctions in a read alignment file\n"
"===========================================================\n"
" Try -h or --help for more information.\n"
};
EXPECT_EQ(result.exit_code, 0);
EXPECT_EQ(result.out, expected);
EXPECT_EQ(result.err, std::string{});
}

TEST_F(cli_test, fail_no_argument)
{
cli_test_result result = execute_app("detect_breakends", "-v");
std::string expected
{
"[Error] Unknown option -v. In case this is meant to be a non-option/argument/parameter, please specify "
"the start of non-options with '--'. See -h/--help for program information.\n"
};
EXPECT_NE(result.exit_code, 0);
EXPECT_EQ(result.out, std::string{});
EXPECT_EQ(result.err, expected);
}


TEST_F(cli_test, with_arguments)
{
cli_test_result result = execute_app("detect_breakends",
data("converted_bam_shorted.sam"),
"detect_breakends_insertion_file_out.fasta");
std::string expected
{
"Reference\tchr9\t70103073\tForward\tReference\tchr9\t70103147\tForward\tm13802/6999/CCS\n"
};
std::string expected_err
{
"DEL: Reference\tchr9\t70103073\tForward\tReference\tchr9\t70103147\tForward\tm13802/6999/CCS\nDone. Found 1 junctions.\n"
};
EXPECT_EQ(result.exit_code, 0);
EXPECT_EQ(result.out, expected);
EXPECT_EQ(result.err, expected_err);
Comment on lines +44 to +50
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without these lined the cli tests won't work.

}

TEST_F(cli_test, test_outfile)
{
cli_test_result result = execute_app("detect_breakends",
data("converted_bam_shorted.sam"),
"detect_breakends_insertion_file_out.fasta");
std::ifstream f;
f.open("detect_breakends_insertion_file_out.fasta");
std::stringstream buffer;
buffer << f.rdbuf();
//expected string currently empty:
std::string expected
{
""
};
//this does not specifically check if file exists, rather if its readable.
EXPECT_TRUE(f.is_open());
EXPECT_EQ(buffer.str(), expected);
}