1 #ifndef SAMREADGROUPDICTIONARY_TEST_H
2 #define SAMREADGROUPDICTIONARY_TEST_H
4 #include "api/SamReadGroupDictionary.h"
5 #include <gtest/gtest.h>
8 TEST(SamReadGroupDictionaryTest, Empty) {
9 BamTools::SamReadGroupDictionary readGroups;
10 EXPECT_TRUE(readGroups.IsEmpty());
11 EXPECT_EQ(0, readGroups.Size());
14 TEST(SamReadGroupDictionaryTest, AddOne) {
16 BamTools::SamReadGroupDictionary readGroups;
17 readGroups.Add(BamTools::SamReadGroup());
18 EXPECT_FALSE(readGroups.IsEmpty());
19 EXPECT_EQ(1, readGroups.Size());
22 TEST(SamReadGroupDictionaryTest, AddMulti) {
24 std::vector<BamTools::SamReadGroup> groups;
25 groups.push_back(BamTools::SamReadGroup("1"));
26 groups.push_back(BamTools::SamReadGroup("2"));
28 BamTools::SamReadGroupDictionary readGroups;
29 readGroups.Add(groups);
30 EXPECT_FALSE(readGroups.IsEmpty());
31 EXPECT_EQ(2, readGroups.Size());
34 TEST(SamReadGroupDictionaryTest, AddDuplicate) {
36 std::vector<BamTools::SamReadGroup> groups;
37 groups.push_back(BamTools::SamReadGroup("1"));
38 groups.push_back(BamTools::SamReadGroup("1"));
40 // add duplicates through Add()
41 BamTools::SamReadGroupDictionary readGroups;
42 readGroups.Add(groups);
43 EXPECT_FALSE(readGroups.IsEmpty());
44 EXPECT_EQ(1, readGroups.Size()); // duplicate should not get added
46 // add duplicates through operator[]
48 readGroups["1"] = groups.at(0);
49 readGroups["1"] = groups.at(0);
50 EXPECT_FALSE(readGroups.IsEmpty());
51 EXPECT_EQ(1, readGroups.Size()); // duplicate should not get added
54 TEST(SamReadGroupDictionaryTest, Clear) {
57 BamTools::SamReadGroupDictionary readGroups;
58 readGroups.Add(BamTools::SamReadGroup());
59 EXPECT_FALSE(readGroups.IsEmpty());
60 EXPECT_EQ(1, readGroups.Size());;
64 EXPECT_TRUE(readGroups.IsEmpty());
65 EXPECT_EQ(0, readGroups.Size());
68 #endif // SAMREADGROUPDICTIONARY_TEST_H