A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/seqfeat__unit__test_8cpp_source.html below:

NCBI C++ ToolKit: src/objects/seq/unit_test/seqfeat_unit_test.cpp Source File

49 #include <boost/test/parameterized_test.hpp> 64

uobj->SetType().SetStr(type_str);

71

TExtsTypeToCount s_CalcExtsTypesCounts(

const CSeq_feat

& seq_feat)

73

TExtsTypeToCount counting_map;

76

++counting_map[(*ext_it)->GetType().GetStr()];

88  const string

exts_names[] = {

95  for

(

size_t

idx = 0; idx <

ArraySize

(exts_names); ++idx ) {

96

seq_feat->AddExt(s_CreateSimpleUserObj(exts_names[idx]));

98

BOOST_CHECK_EQUAL(seq_feat->GetExts().size(),

ArraySize

(exts_names));

101  for

(

size_t

idx = 0; idx <

ArraySize

(exts_names); ++idx ) {

103

BOOST_CHECK_EQUAL(uobj->

GetType

().

GetStr

(), exts_names[idx]);

107  const size_t

idx_of_name_to_remove = 1;

108

seq_feat->RemoveExt(exts_names[idx_of_name_to_remove]);

109

BOOST_CHECK_EQUAL(seq_feat->GetExts().size(),

111  for

(

size_t

idx = 0; idx <

ArraySize

(exts_names); ++idx ) {

113  if

( idx == idx_of_name_to_remove ) {

114

BOOST_CHECK( ! uobj );

116

BOOST_CHECK_EQUAL(uobj->

GetType

().

GetStr

(), exts_names[idx]);

121  const string

plain_ext_name =

"foo"

;

122

seq_feat->SetExt().SetType().SetStr(plain_ext_name);

123

BOOST_CHECK( !! seq_feat->IsSetExt() );

125

seq_feat->FindExt(plain_ext_name)->GetType().GetStr(),

127

seq_feat->RemoveExt(plain_ext_name);

128

BOOST_CHECK( ! seq_feat->IsSetExt() );

132  const string

combo_ext_name =

"CombinedFeatureUserObjects"

;

133  const string

combo_test_ext_names[] = {

139

seq_feat->SetExt().SetType().SetStr(combo_ext_name);

141  for

(

size_t

idx = 0; idx <

ArraySize

(combo_test_ext_names) ; ++idx ) {

143

new_elem_ext->

SetData

().SetObject().SetType().SetStr(combo_test_ext_names[idx]);

144

combo_data.push_back(new_elem_ext);

147

seq_feat->GetExt().GetData().size(),

ArraySize

(combo_test_ext_names));

150  const size_t

combo_idx_to_remove = 2;

151

seq_feat->RemoveExt(combo_test_ext_names[combo_idx_to_remove]);

153

seq_feat->GetExt().GetData().size(),

154

(

ArraySize

(combo_test_ext_names) - 1));

155  for

(

size_t

idx = 0; idx <

ArraySize

(combo_test_ext_names) ; ++idx ) {

157  if

( idx == combo_idx_to_remove ) {

158

BOOST_CHECK( ! uobj );

161

combo_test_ext_names[idx]);

170  const string

ext_type(

"foo"

);

173

seq_feat->AddExt(s_CreateSimpleUserObj(ext_type));

174

seq_feat->AddExt(s_CreateSimpleUserObj(ext_type));

175

seq_feat->AddExt(s_CreateSimpleUserObj(ext_type));

176

seq_feat->AddExt(s_CreateSimpleUserObj(ext_type));

177

TExtsTypeToCount counting_map_1 = s_CalcExtsTypesCounts(*seq_feat);

178

BOOST_CHECK_EQUAL(counting_map_1.size(), 1u);

179

BOOST_CHECK_EQUAL(counting_map_1[ext_type], 4u);

182  const string

ext_type_2(

"baz"

);

183

seq_feat->AddExt(s_CreateSimpleUserObj(ext_type_2));

184

TExtsTypeToCount counting_map_2 = s_CalcExtsTypesCounts(*seq_feat);

185

BOOST_CHECK_EQUAL(counting_map_2.size(), 2u);

186

BOOST_CHECK_EQUAL(counting_map_2[ext_type], 4u);

187

BOOST_CHECK_EQUAL(counting_map_2[ext_type_2], 1u);

190

seq_feat->AddExt(s_CreateSimpleUserObj(ext_type),

192

TExtsTypeToCount counting_map_3 = s_CalcExtsTypesCounts(*seq_feat);

193

BOOST_CHECK_EQUAL(counting_map_3.size(), 2u);

194

BOOST_CHECK_EQUAL(counting_map_3[ext_type], 1u);

195

BOOST_CHECK_EQUAL(counting_map_3[ext_type_2], 1u);

namespace ncbi::objects::

@ fAddExt_ReplaceAll

Before adding, remove all previous.

constexpr size_t ArraySize(const Element(&)[Size])

#define ITERATE(Type, Var, Cont)

ITERATE macro to sequence through container elements.

const TStr & GetStr(void) const

Get the variant data.

void SetData(TData &value)

Assign a value to Data data member.

const TType & GetType(void) const

Get the Type member data.

vector< CRef< CUser_field > > TData

const TExts & GetExts(void) const

Get the Exts member data.

list< CRef< CUser_object > > TExts

bool IsSetExts(void) const

set of extensions; will replace 'ext' field Check if a value has been assigned to Exts data member.

Defines the CNcbiApplication and CAppException classes for creating NCBI applications.

Miscellaneous common-use basic types and functionality.

BOOST_AUTO_TEST_CASE(Test_FindAddRemoveExts)

Utility stuff for more convenient using of Boost.Test library.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4