File: RefInfo_gtest.cpp

package info (click to toggle)
pbseqlib 5.3.5%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,020 kB
  • sloc: cpp: 77,250; python: 331; sh: 103; makefile: 41
file content (43 lines) | stat: -rw-r--r-- 1,099 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
/*
 * =====================================================================================
 *
 *       Filename:  RefInfo_gtest.cpp
 *
 *    Description:  Test pbdata/saf/RefInfo.hpp
 *
 *        Version:  1.0
 *        Created:  11/29/2012 04:02:00 PM
 *       Revision:  08/20/2014
 *       Compiler:  gcc
 *
 *         Author:  Yuan Li (yli), yli@pacificbiosciences.com
 *        Company:  Pacific Biosciences
 *
 * =====================================================================================
 */

#include <gtest/gtest.h>

#include <pbdata/saf/RefInfo.hpp>

TEST(RefInfoTEST, RefIdToIndex)
{
    RefInfo ri;

    std::string names[] = {"ref1", "ref3 description", "ref4 chr1 1:100"};
    ri.fullName.insert(ri.fullName.begin(), names, names + 3);

    int id[] = {10, 7, 5};
    //int lens [] = {400, 300, 100};
    ri.id.insert(ri.id.begin(), id, id + 3);

    int index;
    EXPECT_TRUE(ri.RefIdToIndex(10, index));
    EXPECT_EQ(index, 0);

    EXPECT_TRUE(ri.RefIdToIndex(7, index));
    EXPECT_EQ(index, 1);

    EXPECT_TRUE(ri.RefIdToIndex(5, index));
    EXPECT_EQ(index, 2);
}