From d9d6ba5e5bb782f982f3548157c25a625ff4435b Mon Sep 17 00:00:00 2001 From: Dave Larson Date: Sat, 19 Dec 2015 23:40:05 -0600 Subject: [PATCH] add in tests for IndelQueueEntry --- test/lib/bamrc/CMakeLists.txt | 1 + test/lib/bamrc/TestIndelQueue.cpp | 2 -- test/lib/bamrc/TestIndelQueueEntry.cpp | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 test/lib/bamrc/TestIndelQueueEntry.cpp diff --git a/test/lib/bamrc/CMakeLists.txt b/test/lib/bamrc/CMakeLists.txt index 5acbc40..006b69e 100644 --- a/test/lib/bamrc/CMakeLists.txt +++ b/test/lib/bamrc/CMakeLists.txt @@ -9,4 +9,5 @@ add_unit_tests(TestBamrcLib TestAuxFields.cpp TestReadWarnings.cpp TestIndelQueue.cpp + TestIndelQueueEntry.cpp ) diff --git a/test/lib/bamrc/TestIndelQueue.cpp b/test/lib/bamrc/TestIndelQueue.cpp index f4794ee..d359f0a 100644 --- a/test/lib/bamrc/TestIndelQueue.cpp +++ b/test/lib/bamrc/TestIndelQueue.cpp @@ -7,8 +7,6 @@ #include #include -std::auto_ptr WARN; - using namespace std; TEST(IndelQueue, push) { diff --git a/test/lib/bamrc/TestIndelQueueEntry.cpp b/test/lib/bamrc/TestIndelQueueEntry.cpp new file mode 100644 index 0000000..d95f0f1 --- /dev/null +++ b/test/lib/bamrc/TestIndelQueueEntry.cpp @@ -0,0 +1,34 @@ +#include "bamrc/IndelQueueEntry.hpp" +#include "bamrc/ReadWarnings.hpp" +#include "bamrc/BasicStat.hpp" + +#include + +#include +#include + +//FIXME This is required for all things in the test library +//using the ReadWarnings class. +std::auto_ptr WARN; + +using namespace std; + +TEST(IndelQueueEntry, parameterized_constructor) { + BasicStat indel_stat(true); + IndelQueueEntry new_entry(1, 20, indel_stat, "-AA"); + ASSERT_EQ(1, new_entry.tid); + ASSERT_EQ(20, new_entry.pos); + ASSERT_EQ("-AA", new_entry.allele); +} + +TEST(IndelQueueEntry, stream_output) { + stringstream stat_stream; + stat_stream << "-AA:"; + BasicStat indel_stat(true); + stat_stream << indel_stat; + + stringstream entry_stream; + IndelQueueEntry new_entry(1, 20, indel_stat, "-AA"); + entry_stream << new_entry; + ASSERT_EQ(stat_stream.str(), entry_stream.str()); +}