NCBI C++ ToolKit
unit_test_linkage_evidence.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: unit_test_linkage_evidence.cpp 100710 2023-08-31 20:12:19Z lavr $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * Author: Justin Foley
27 *
28 * File Description:
29 * Unit tests for CLinkage_evidence class
30 *
31 */
32 
33 #include <ncbi_pch.hpp>
34 
35 // This header must be included before all Boost.Test headers if there are any
36 #include <corelib/test_boost.hpp>
38 #include <common/test_assert.h> /* This header must go last */
39 
40 
43 
44 BOOST_AUTO_TEST_CASE(GetLinkageEvidence)
45 {
46  vector<string> evidence_strings {"paired-ends",
47  "align_genus",
48  "align_xgenus",
49  "align_trnscpt",
50  "within_clone",
51  "clone_contig",
52  "map",
53  "strobe",
54  "unspecified",
55  "pcr",
56  "proximity_ligation"};
57 
59  auto success = CLinkage_evidence::GetLinkageEvidence(output_vector, evidence_strings);
60 
61  BOOST_CHECK(success);
62  BOOST_CHECK_EQUAL(output_vector.size(), evidence_strings.size());
63 }
64 
65 
67 {
68  vector<string> initial_strings {"paired-ends",
69  "align_genus",
70  "align_xgenus",
71  "align_trnscpt",
72  "within_clone",
73  "clone_contig",
74  "map",
75  "strobe",
76  "unspecified",
77  "pcr",
78  "proximity_ligation"};
79 
81  CLinkage_evidence::GetLinkageEvidence(evidence_vector, initial_strings);
82 
83  string output;
84  auto success = CLinkage_evidence::VecToString(output, evidence_vector);
85  BOOST_CHECK(success);
86  string expected = "paired-ends;align_genus;align_xgenus;"
87  "align_trnscpt;within_clone;clone_contig;"
88  "map;strobe;unspecified;pcr;proximity_ligation";
89  BOOST_CHECK_EQUAL(output, expected);
90 }
91 
92 
93 BOOST_AUTO_TEST_CASE(VecToStringUnknown)
94 {
95  vector<CLinkage_evidence::EType> type_vector {
99 
100 
101  CLinkage_evidence::TLinkage_evidence evidence_vector;
102  for (auto linkage_type : type_vector) {
103  auto evidence = Ref(new CLinkage_evidence());
104  evidence->SetType(linkage_type);
105  evidence_vector.push_back(std::move(evidence));
106  }
107 
108  string output;
109  auto success = CLinkage_evidence::VecToString(output, evidence_vector);
110  BOOST_CHECK(!success);
111  string expected = "paired-ends;UNKNOWN;unspecified";
112  BOOST_CHECK_EQUAL(output, expected);
113 }
114 
User-defined methods of the data storage class.
list< CRef< CLinkage_evidence > > TLinkage_evidence
static bool GetLinkageEvidence(TLinkage_evidence &output_result, const string &linkage_evidence)
static bool VecToString(string &output_result, const TLinkage_evidence &linkage_evidence)
static const char * expected[]
Definition: bcp.c:42
static SQLCHAR output[256]
Definition: print.c:5
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
Definition: ncbiobj.hpp:2015
Utility stuff for more convenient using of Boost.Test library.
USING_SCOPE(objects)
BOOST_AUTO_TEST_CASE(GetLinkageEvidence)
Modified on Wed Apr 17 13:09:54 2024 by modify_doxy.py rev. 669887