uobj->SetType().SetStr(type_str);
71TExtsTypeToCount s_CalcExtsTypesCounts(
const CSeq_feat& seq_feat)
73TExtsTypeToCount counting_map;
76++counting_map[(*ext_it)->GetType().GetStr()];
88 const stringexts_names[] = {
95 for(
size_tidx = 0; idx <
ArraySize(exts_names); ++idx ) {
96seq_feat->AddExt(s_CreateSimpleUserObj(exts_names[idx]));
98BOOST_CHECK_EQUAL(seq_feat->GetExts().size(),
ArraySize(exts_names));
101 for(
size_tidx = 0; idx <
ArraySize(exts_names); ++idx ) {
103BOOST_CHECK_EQUAL(uobj->
GetType().
GetStr(), exts_names[idx]);
107 const size_tidx_of_name_to_remove = 1;
108seq_feat->RemoveExt(exts_names[idx_of_name_to_remove]);
109BOOST_CHECK_EQUAL(seq_feat->GetExts().size(),
111 for(
size_tidx = 0; idx <
ArraySize(exts_names); ++idx ) {
113 if( idx == idx_of_name_to_remove ) {
114BOOST_CHECK( ! uobj );
116BOOST_CHECK_EQUAL(uobj->
GetType().
GetStr(), exts_names[idx]);
121 const stringplain_ext_name =
"foo";
122seq_feat->SetExt().SetType().SetStr(plain_ext_name);
123BOOST_CHECK( !! seq_feat->IsSetExt() );
125seq_feat->FindExt(plain_ext_name)->GetType().GetStr(),
127seq_feat->RemoveExt(plain_ext_name);
128BOOST_CHECK( ! seq_feat->IsSetExt() );
132 const stringcombo_ext_name =
"CombinedFeatureUserObjects";
133 const stringcombo_test_ext_names[] = {
139seq_feat->SetExt().SetType().SetStr(combo_ext_name);
141 for(
size_tidx = 0; idx <
ArraySize(combo_test_ext_names) ; ++idx ) {
143new_elem_ext->
SetData().SetObject().SetType().SetStr(combo_test_ext_names[idx]);
144combo_data.push_back(new_elem_ext);
147seq_feat->GetExt().GetData().size(),
ArraySize(combo_test_ext_names));
150 const size_tcombo_idx_to_remove = 2;
151seq_feat->RemoveExt(combo_test_ext_names[combo_idx_to_remove]);
153seq_feat->GetExt().GetData().size(),
154(
ArraySize(combo_test_ext_names) - 1));
155 for(
size_tidx = 0; idx <
ArraySize(combo_test_ext_names) ; ++idx ) {
157 if( idx == combo_idx_to_remove ) {
158BOOST_CHECK( ! uobj );
161combo_test_ext_names[idx]);
170 const stringext_type(
"foo");
173seq_feat->AddExt(s_CreateSimpleUserObj(ext_type));
174seq_feat->AddExt(s_CreateSimpleUserObj(ext_type));
175seq_feat->AddExt(s_CreateSimpleUserObj(ext_type));
176seq_feat->AddExt(s_CreateSimpleUserObj(ext_type));
177TExtsTypeToCount counting_map_1 = s_CalcExtsTypesCounts(*seq_feat);
178BOOST_CHECK_EQUAL(counting_map_1.size(), 1u);
179BOOST_CHECK_EQUAL(counting_map_1[ext_type], 4u);
182 const stringext_type_2(
"baz");
183seq_feat->AddExt(s_CreateSimpleUserObj(ext_type_2));
184TExtsTypeToCount counting_map_2 = s_CalcExtsTypesCounts(*seq_feat);
185BOOST_CHECK_EQUAL(counting_map_2.size(), 2u);
186BOOST_CHECK_EQUAL(counting_map_2[ext_type], 4u);
187BOOST_CHECK_EQUAL(counting_map_2[ext_type_2], 1u);
190seq_feat->AddExt(s_CreateSimpleUserObj(ext_type),
192TExtsTypeToCount counting_map_3 = s_CalcExtsTypesCounts(*seq_feat);
193BOOST_CHECK_EQUAL(counting_map_3.size(), 2u);
194BOOST_CHECK_EQUAL(counting_map_3[ext_type], 1u);
195BOOST_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