File: HDFScanDataReader_gtest.cpp

package info (click to toggle)
pbseqlib 5.3.5%2Bdfsg-10
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 7,148 kB
  • sloc: cpp: 77,259; python: 331; sh: 103; makefile: 41
file content (56 lines) | stat: -rw-r--r-- 1,484 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <gtest/gtest.h>

#include <pbdata/testdata.h>
#include <hdf/HDFScanDataReader.hpp>

using namespace H5;

class HDFScanDataReaderTEST : public ::testing::Test
{
public:
    virtual void SetUp()
    {
        fileName = scanDataFile1;
        try {
            hdfFile.openFile(fileName.c_str(), H5F_ACC_RDONLY);
            ASSERT_EQ(rootGroup.Initialize(hdfFile, "/"), 1);
            ASSERT_EQ(reader.Initialize(dynamic_cast<HDFGroup*>(&rootGroup)), 1);
        } catch (H5::Exception& e) {
            std::cerr << "Failed to open " << fileName << std::endl;
            ASSERT_FALSE(true);
        }
    }

    virtual void TearDown()
    {
        reader.Close();
        hdfFile.close();
    }

    std::string fileName;
    H5::H5File hdfFile;
    HDFGroup rootGroup;
    HDFScanDataReader reader;
};

TEST_F(HDFScanDataReaderTEST, ReadBindingKit)
{
    std::string bindingKit;
    EXPECT_EQ(reader.ReadBindingKit(bindingKit), 1);
    EXPECT_EQ(bindingKit, "100356300");

    // Test if bindkingKit can be read multiple times.
    EXPECT_EQ(reader.ReadBindingKit(bindingKit), 1);
    EXPECT_EQ(bindingKit, "100356300");
}

TEST_F(HDFScanDataReaderTEST, ReadSequencingKit)
{
    std::string sequencingKit;
    EXPECT_EQ(reader.ReadSequencingKit(sequencingKit), 1);
    EXPECT_EQ(sequencingKit, "100356200");

    // Test if sequencingKit can be read multiple times.
    EXPECT_EQ(reader.ReadSequencingKit(sequencingKit), 1);
    EXPECT_EQ(sequencingKit, "100356200");
}