1 /*  $Id: optionshandle_unit_test.cpp 535507 2017-05-09 15:35:47Z madden $
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:  Christiam Camacho
27 *
28 * File Description:
29 *   Unit test module for the blast options handle class
30 *
31 * ===========================================================================
32 */
33 #include <ncbi_pch.hpp>
34 #include <corelib/test_boost.hpp>
35 
36 #include <algo/blast/api/blast_options_handle.hpp>
37 #include <algo/blast/api/blast_prot_options.hpp>
38 #include <algo/blast/api/psiblast_options.hpp>
39 #include <algo/blast/api/blast_advprot_options.hpp>
40 #include <algo/blast/api/blast_nucl_options.hpp>
41 #include <algo/blast/api/disc_nucl_options.hpp>
42 #include <algo/blast/api/blastx_options.hpp>
43 #include <algo/blast/api/tblastn_options.hpp>
44 #include <algo/blast/api/tblastx_options.hpp>
45 #include <algo/blast/api/blastp_kmer_options.hpp>
46 #include <algo/blast/core/blast_def.h>
47 
48 #include "test_objmgr.hpp"
49 
50 #ifdef NCBI_OS_IRIX
51 #include <stdlib.h>
52 #else
53 #include <cstdlib>
54 #endif
55 
56 // template function to invoke mutator/accessor (setter/getter) member
57 // functions on classes derived from the class BC and verifies the assignment
58 // using BOOST_REQUIRE_EQUAL
59 template <class BC, class T>
VerifyMutatorAccessor(BC & obj,void (BC::* mutator)(T),T (BC::* accessor)(void)const,T & expected_value)60 void VerifyMutatorAccessor(BC& obj,
61                            void (BC::*mutator)(T),
62                            T (BC::*accessor)(void) const,
63                            T& expected_value)
64 {
65 #   define CALL_MEMBER_FUNCTION(obj, membFnPtr) ((obj).*(membFnPtr))
66 
67     CALL_MEMBER_FUNCTION(obj, mutator)(expected_value);
68     T actual_value = CALL_MEMBER_FUNCTION(obj, accessor)();
69     BOOST_REQUIRE_EQUAL(expected_value, actual_value);
70 }
71 
72 using namespace std;
73 using namespace ncbi;
74 using namespace ncbi::blast;
75 
76 struct UniversalOptiosHandleFixture {
UniversalOptiosHandleFixtureUniversalOptiosHandleFixture77     UniversalOptiosHandleFixture() {
78         // Use a randomly chosen program to ensure all derived classes support
79         // these methods.  Addition and subtraction of one ensures that the
80         // results is not zero (eBlastNotSet).
81         EProgram p = (EProgram) (1 + rand() % ((int)eBlastProgramMax - 1));
82         m_OptsHandle = CBlastOptionsFactory::Create(p);
83     }
~UniversalOptiosHandleFixtureUniversalOptiosHandleFixture84     ~UniversalOptiosHandleFixture() { delete m_OptsHandle;}
85 
86     CBlastOptionsHandle* m_OptsHandle;
87 };
88 
89 // Test the "universal" BLAST optins (apply to all programs)
90 // TLM - CBlastOptionsHandleTest
91 
BOOST_FIXTURE_TEST_CASE(Set_Get_MaskAtHash_Universal,UniversalOptiosHandleFixture)92 BOOST_FIXTURE_TEST_CASE(Set_Get_MaskAtHash_Universal, UniversalOptiosHandleFixture) {
93         bool value = true;
94 
95         VerifyMutatorAccessor<CBlastOptionsHandle, bool>
96             (*m_OptsHandle,
97              &CBlastOptionsHandle::SetMaskAtHash,
98              &CBlastOptionsHandle::GetMaskAtHash,
99              value);
100 }
101 
BOOST_FIXTURE_TEST_CASE(Set_Get_GapXDropoff_Universal,UniversalOptiosHandleFixture)102 BOOST_FIXTURE_TEST_CASE(Set_Get_GapXDropoff_Universal, UniversalOptiosHandleFixture) {
103         double value = 10.5;
104 
105         VerifyMutatorAccessor<CBlastOptionsHandle, double>
106             (*m_OptsHandle,
107              &CBlastOptionsHandle::SetGapXDropoff,
108              &CBlastOptionsHandle::GetGapXDropoff,
109              value);
110 }
111 
BOOST_FIXTURE_TEST_CASE(Set_Get_GapTrigger_Universal,UniversalOptiosHandleFixture)112 BOOST_FIXTURE_TEST_CASE(Set_Get_GapTrigger_Universal, UniversalOptiosHandleFixture) {
113         double value = 10.5;
114 
115         VerifyMutatorAccessor<CBlastOptionsHandle, double>
116             (*m_OptsHandle,
117              &CBlastOptionsHandle::SetGapTrigger,
118              &CBlastOptionsHandle::GetGapTrigger,
119              value);
120 }
121 
BOOST_FIXTURE_TEST_CASE(Set_Get_HitlistSize_Universal,UniversalOptiosHandleFixture)122 BOOST_FIXTURE_TEST_CASE(Set_Get_HitlistSize_Universal, UniversalOptiosHandleFixture) {
123         int value = 100;
124 
125         VerifyMutatorAccessor<CBlastOptionsHandle, int>
126             (*m_OptsHandle,
127              &CBlastOptionsHandle::SetHitlistSize,
128              &CBlastOptionsHandle::GetHitlistSize,
129              value);
130 }
131 
BOOST_FIXTURE_TEST_CASE(Set_Get_MaxNumHspPerSequence_Universal,UniversalOptiosHandleFixture)132 BOOST_FIXTURE_TEST_CASE(Set_Get_MaxNumHspPerSequence_Universal, UniversalOptiosHandleFixture) {
133         int value = 100;
134 
135         VerifyMutatorAccessor<CBlastOptionsHandle, int>
136             (*m_OptsHandle,
137              &CBlastOptionsHandle::SetMaxNumHspPerSequence,
138              &CBlastOptionsHandle::GetMaxNumHspPerSequence,
139              value);
140 }
141 
BOOST_FIXTURE_TEST_CASE(Set_Get_EvalueThreshold_Universal,UniversalOptiosHandleFixture)142 BOOST_FIXTURE_TEST_CASE(Set_Get_EvalueThreshold_Universal, UniversalOptiosHandleFixture) {
143         double value = -10.5;
144 
145         VerifyMutatorAccessor<CBlastOptionsHandle, double>
146             (*m_OptsHandle,
147              &CBlastOptionsHandle::SetEvalueThreshold,
148              &CBlastOptionsHandle::GetEvalueThreshold,
149              value);
150 }
151 
BOOST_FIXTURE_TEST_CASE(Set_Get_CutoffScore_Universal,UniversalOptiosHandleFixture)152 BOOST_FIXTURE_TEST_CASE(Set_Get_CutoffScore_Universal, UniversalOptiosHandleFixture) {
153         int value = -10;
154 
155         VerifyMutatorAccessor<CBlastOptionsHandle, int>
156             (*m_OptsHandle,
157              &CBlastOptionsHandle::SetCutoffScore,
158              &CBlastOptionsHandle::GetCutoffScore,
159              value);
160 }
161 
BOOST_FIXTURE_TEST_CASE(Set_Get_PercentIdentity_Universal,UniversalOptiosHandleFixture)162 BOOST_FIXTURE_TEST_CASE(Set_Get_PercentIdentity_Universal, UniversalOptiosHandleFixture) {
163         double value = 1.5;
164 
165         VerifyMutatorAccessor<CBlastOptionsHandle, double>
166             (*m_OptsHandle,
167              &CBlastOptionsHandle::SetPercentIdentity,
168              &CBlastOptionsHandle::GetPercentIdentity,
169              value);
170 }
171 
BOOST_FIXTURE_TEST_CASE(Set_Get_GappedMode_Universal,UniversalOptiosHandleFixture)172 BOOST_FIXTURE_TEST_CASE(Set_Get_GappedMode_Universal, UniversalOptiosHandleFixture) {
173         bool value = false;
174 
175         VerifyMutatorAccessor<CBlastOptionsHandle, bool>
176             (*m_OptsHandle,
177              &CBlastOptionsHandle::SetGappedMode,
178              &CBlastOptionsHandle::GetGappedMode,
179              value);
180 }
181 
BOOST_FIXTURE_TEST_CASE(Set_Get_Culling_Universal,UniversalOptiosHandleFixture)182 BOOST_FIXTURE_TEST_CASE(Set_Get_Culling_Universal, UniversalOptiosHandleFixture) {
183         int value = 20;
184 
185         VerifyMutatorAccessor<CBlastOptionsHandle, int>
186             (*m_OptsHandle,
187              &CBlastOptionsHandle::SetCullingLimit,
188              &CBlastOptionsHandle::GetCullingLimit,
189              value);
190 }
191 
192 // Test creation of BlastOptionsHandle.
193 // TLM - CBlastOptionsCreateTaskTest
194 
BOOST_AUTO_TEST_CASE(BlastnTest)195 BOOST_AUTO_TEST_CASE(BlastnTest) {
196        CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("blastn");
197        CBlastNucleotideOptionsHandle* opts =
198              dynamic_cast<CBlastNucleotideOptionsHandle*> (handle);
199        BOOST_REQUIRE(opts != NULL);
200        BOOST_REQUIRE_EQUAL(2, opts->GetMatchReward());
201        delete handle;
202 }
203 
BOOST_AUTO_TEST_CASE(BlastnShortTest)204 BOOST_AUTO_TEST_CASE(BlastnShortTest) {
205        CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("blastn-short");
206        CBlastNucleotideOptionsHandle* opts =
207              dynamic_cast<CBlastNucleotideOptionsHandle*> (handle);
208        BOOST_REQUIRE(opts != NULL);
209        BOOST_REQUIRE_EQUAL(1, opts->GetMatchReward());
210        BOOST_REQUIRE_EQUAL(7, opts->GetWordSize());
211        delete handle;
212 }
213 
BOOST_AUTO_TEST_CASE(MegablastTest)214 BOOST_AUTO_TEST_CASE(MegablastTest) {
215        CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("megablast");
216        CBlastNucleotideOptionsHandle* opts =
217              dynamic_cast<CBlastNucleotideOptionsHandle*> (handle);
218        BOOST_REQUIRE(opts != NULL);
219        BOOST_REQUIRE_EQUAL(1, opts->GetMatchReward());
220        delete handle;
221 }
222 
BOOST_AUTO_TEST_CASE(DCMegablastTest)223 BOOST_AUTO_TEST_CASE(DCMegablastTest) {
224        CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("dc-megablast");
225        CDiscNucleotideOptionsHandle* opts =
226              dynamic_cast<CDiscNucleotideOptionsHandle*> (handle);
227        BOOST_REQUIRE(opts != NULL);
228        BOOST_REQUIRE_EQUAL(2, opts->GetMatchReward());
229        BOOST_REQUIRE_EQUAL(18, (int) opts->GetTemplateLength());
230        delete handle;
231 }
232 
BOOST_AUTO_TEST_CASE(CaseSensitiveTest)233 BOOST_AUTO_TEST_CASE(CaseSensitiveTest) {
234        CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("MeGaBlaSt");
235        CBlastNucleotideOptionsHandle* opts =
236              dynamic_cast<CBlastNucleotideOptionsHandle*> (handle);
237        BOOST_REQUIRE(opts != NULL);
238        delete handle;
239 }
240 
BOOST_AUTO_TEST_CASE(BadNameTest)241 BOOST_AUTO_TEST_CASE(BadNameTest) {
242        CBlastOptionsHandle* handle = NULL;
243        BOOST_CHECK_THROW(handle = CBlastOptionsFactory::CreateTask("mega"),
244                          CBlastException);
245        CBlastNucleotideOptionsHandle* opts =
246              dynamic_cast<CBlastNucleotideOptionsHandle*> (handle);
247        BOOST_REQUIRE(opts == NULL);
248        delete handle;
249 }
250 
BOOST_AUTO_TEST_CASE(BlastpTest)251 BOOST_AUTO_TEST_CASE(BlastpTest) {
252        CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("blastp");
253        CBlastAdvancedProteinOptionsHandle* opts =
254              dynamic_cast<CBlastAdvancedProteinOptionsHandle*> (handle);
255        BOOST_REQUIRE(opts != NULL);
256        BOOST_REQUIRE(!strcmp("BLOSUM62", opts->GetMatrixName()));
257        BOOST_REQUIRE_EQUAL(3, opts->GetWordSize());
258        delete handle;
259 }
260 
BOOST_AUTO_TEST_CASE(BlastpLookupTableType)261 BOOST_AUTO_TEST_CASE(BlastpLookupTableType) {
262        CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("blastp");
263        CBlastAdvancedProteinOptionsHandle* opts =
264              dynamic_cast<CBlastAdvancedProteinOptionsHandle*> (handle);
265        const CBlastOptions& kOpts = opts->GetOptions();
266        BOOST_REQUIRE_EQUAL(eAaLookupTable, kOpts.GetLookupTableType());
267        opts->SetWordSize(6);
268        BOOST_REQUIRE_EQUAL(eCompressedAaLookupTable, kOpts.GetLookupTableType());
269        opts->SetWordSize(2);
270        BOOST_REQUIRE_EQUAL(eAaLookupTable, kOpts.GetLookupTableType());
271 }
272 
BOOST_AUTO_TEST_CASE(BlastpShortTest)273 BOOST_AUTO_TEST_CASE(BlastpShortTest) {
274        CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("blastp-short");
275        CBlastAdvancedProteinOptionsHandle* opts =
276              dynamic_cast<CBlastAdvancedProteinOptionsHandle*> (handle);
277        BOOST_REQUIRE(opts != NULL);
278        BOOST_REQUIRE(!strcmp("PAM30", opts->GetMatrixName()));
279        BOOST_REQUIRE_EQUAL(2, opts->GetWordSize());
280        delete handle;
281 }
282 
BOOST_AUTO_TEST_CASE(BlastxTest)283 BOOST_AUTO_TEST_CASE(BlastxTest) {
284        CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("blastx");
285        CBlastxOptionsHandle* opts =
286              dynamic_cast<CBlastxOptionsHandle*> (handle);
287        BOOST_REQUIRE(opts != NULL);
288        BOOST_REQUIRE(!strcmp("BLOSUM62", opts->GetMatrixName()));
289        BOOST_REQUIRE_EQUAL(3, opts->GetWordSize());
290        delete handle;
291 }
292 
BOOST_AUTO_TEST_CASE(TblastnTest)293 BOOST_AUTO_TEST_CASE(TblastnTest) {
294        CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("tblastn");
295        CTBlastnOptionsHandle* opts =
296              dynamic_cast<CTBlastnOptionsHandle*> (handle);
297        BOOST_REQUIRE(opts != NULL);
298        BOOST_REQUIRE(!strcmp("BLOSUM62", opts->GetMatrixName()));
299        BOOST_REQUIRE_EQUAL(3, opts->GetWordSize());
300        delete handle;
301 }
302 
BOOST_AUTO_TEST_CASE(TblastxTest)303 BOOST_AUTO_TEST_CASE(TblastxTest) {
304        CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("tblastx");
305        CTBlastxOptionsHandle* opts =
306              dynamic_cast<CTBlastxOptionsHandle*> (handle);
307        BOOST_REQUIRE(opts != NULL);
308        BOOST_REQUIRE(!strcmp("BLOSUM62", opts->GetMatrixName()));
309        BOOST_REQUIRE_EQUAL(3, opts->GetWordSize());
310        delete handle;
311 }
312 
BOOST_AUTO_TEST_CASE(KBlastpTest)313 BOOST_AUTO_TEST_CASE(KBlastpTest) {
314        CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("kblastp");
315        CBlastpKmerOptionsHandle* opts =
316              dynamic_cast<CBlastpKmerOptionsHandle*> (handle);
317        BOOST_REQUIRE(opts != NULL);
318        BOOST_REQUIRE_EQUAL(1, opts->GetMinHits());
319        BOOST_REQUIRE_EQUAL(1000, opts->GetCandidateSeqs());
320        BOOST_REQUIRE(!strcmp("BLOSUM62", opts->GetMatrixName()));
321        delete handle;
322 }
323 
324 struct ProteinOptiosHandleFixture {
ProteinOptiosHandleFixtureProteinOptiosHandleFixture325     ProteinOptiosHandleFixture() {
326         m_OptsHandle = new CBlastProteinOptionsHandle();
327     }
~ProteinOptiosHandleFixtureProteinOptiosHandleFixture328     ~ProteinOptiosHandleFixture() { delete m_OptsHandle;}
329 
330     CBlastProteinOptionsHandle* m_OptsHandle;
331 };
332 
333 
334 // Protein options.
335 // TLM - CBlastProtOptionsHandleTest
336 
BOOST_FIXTURE_TEST_CASE(Set_Get_WordThreshold_Protein,ProteinOptiosHandleFixture)337 BOOST_FIXTURE_TEST_CASE(Set_Get_WordThreshold_Protein, ProteinOptiosHandleFixture) {
338         double value = 15;
339 
340         VerifyMutatorAccessor<CBlastProteinOptionsHandle, double>
341             (*m_OptsHandle,
342              &CBlastProteinOptionsHandle::SetWordThreshold,
343              &CBlastProteinOptionsHandle::GetWordThreshold,
344              value);
345 }
346 
BOOST_FIXTURE_TEST_CASE(Set_Get_WordSize_Protein,ProteinOptiosHandleFixture)347 BOOST_FIXTURE_TEST_CASE(Set_Get_WordSize_Protein, ProteinOptiosHandleFixture) {
348         int value = 5;
349 
350         VerifyMutatorAccessor<CBlastProteinOptionsHandle, int>
351             (*m_OptsHandle,
352              &CBlastProteinOptionsHandle::SetWordSize,
353              &CBlastProteinOptionsHandle::GetWordSize,
354              value);
355 }
356 
BOOST_FIXTURE_TEST_CASE(Set_Get_WindowSize_Protein,ProteinOptiosHandleFixture)357 BOOST_FIXTURE_TEST_CASE(Set_Get_WindowSize_Protein, ProteinOptiosHandleFixture) {
358         int value = 50;
359 
360         VerifyMutatorAccessor<CBlastProteinOptionsHandle, int>
361             (*m_OptsHandle,
362              &CBlastProteinOptionsHandle::SetWindowSize,
363              &CBlastProteinOptionsHandle::GetWindowSize,
364              value);
365 }
366 
BOOST_FIXTURE_TEST_CASE(Set_Get_XDropoff_Protein,ProteinOptiosHandleFixture)367 BOOST_FIXTURE_TEST_CASE(Set_Get_XDropoff_Protein, ProteinOptiosHandleFixture) {
368         double value = 26.2;
369 
370         VerifyMutatorAccessor<CBlastProteinOptionsHandle, double>
371             (*m_OptsHandle,
372              &CBlastProteinOptionsHandle::SetXDropoff,
373              &CBlastProteinOptionsHandle::GetXDropoff,
374              value);
375 }
376 
BOOST_FIXTURE_TEST_CASE(Set_Get_GapXDropoffFinal_Protein,ProteinOptiosHandleFixture)377 BOOST_FIXTURE_TEST_CASE(Set_Get_GapXDropoffFinal_Protein, ProteinOptiosHandleFixture) {
378         double value = 26.2;
379 
380         VerifyMutatorAccessor<CBlastProteinOptionsHandle, double>
381             (*m_OptsHandle,
382              &CBlastProteinOptionsHandle::SetGapXDropoffFinal,
383              &CBlastProteinOptionsHandle::GetGapXDropoffFinal,
384              value);
385 }
386 
BOOST_FIXTURE_TEST_CASE(Set_Get_DbLength_Protein,ProteinOptiosHandleFixture)387 BOOST_FIXTURE_TEST_CASE(Set_Get_DbLength_Protein, ProteinOptiosHandleFixture) {
388         Int8 value = 1000000;
389 
390         VerifyMutatorAccessor<CBlastProteinOptionsHandle, Int8>
391             (*m_OptsHandle,
392              &CBlastProteinOptionsHandle::SetDbLength,
393              &CBlastProteinOptionsHandle::GetDbLength,
394              value);
395 }
396 
BOOST_FIXTURE_TEST_CASE(Set_Get_DbSeqNum_Protein,ProteinOptiosHandleFixture)397 BOOST_FIXTURE_TEST_CASE(Set_Get_DbSeqNum_Protein, ProteinOptiosHandleFixture) {
398         unsigned int value = 0x1<<16;
399 
400         VerifyMutatorAccessor<CBlastProteinOptionsHandle, unsigned int>
401             (*m_OptsHandle,
402              &CBlastProteinOptionsHandle::SetDbSeqNum,
403              &CBlastProteinOptionsHandle::GetDbSeqNum,
404              value);
405 }
406 
BOOST_FIXTURE_TEST_CASE(Set_Get_EffectiveSearchSpace_Protein,ProteinOptiosHandleFixture)407 BOOST_FIXTURE_TEST_CASE(Set_Get_EffectiveSearchSpace_Protein, ProteinOptiosHandleFixture) {
408         Int8 value = 1000000;
409 
410         VerifyMutatorAccessor<CBlastProteinOptionsHandle, Int8>
411             (*m_OptsHandle,
412              &CBlastProteinOptionsHandle::SetEffectiveSearchSpace,
413              &CBlastProteinOptionsHandle::GetEffectiveSearchSpace,
414              value);
415 }
416 
BOOST_FIXTURE_TEST_CASE(Set_Get_SegFiltering_Protein,ProteinOptiosHandleFixture)417 BOOST_FIXTURE_TEST_CASE(Set_Get_SegFiltering_Protein, ProteinOptiosHandleFixture) {
418         bool value = true;
419 
420         VerifyMutatorAccessor<CBlastProteinOptionsHandle, bool>
421             (*m_OptsHandle,
422              &CBlastProteinOptionsHandle::SetSegFiltering,
423              &CBlastProteinOptionsHandle::GetSegFiltering,
424              value);
425 }
426 
BOOST_FIXTURE_TEST_CASE(Set_Get_SegFilteringWindow_Protein,ProteinOptiosHandleFixture)427 BOOST_FIXTURE_TEST_CASE(Set_Get_SegFilteringWindow_Protein, ProteinOptiosHandleFixture) {
428         int value = 26;
429 
430         VerifyMutatorAccessor<CBlastProteinOptionsHandle, int>
431             (*m_OptsHandle,
432              &CBlastProteinOptionsHandle::SetSegFilteringWindow,
433              &CBlastProteinOptionsHandle::GetSegFilteringWindow,
434              value);
435 }
436 
BOOST_FIXTURE_TEST_CASE(Get_SegWindowWithSegOptionsUnallocated_Protein,ProteinOptiosHandleFixture)437 BOOST_FIXTURE_TEST_CASE(Get_SegWindowWithSegOptionsUnallocated_Protein, ProteinOptiosHandleFixture) {
438 
439         m_OptsHandle->SetSegFiltering(false); // turn off SEG filtering.
440         // the following call should turn it on again.
441         int value = m_OptsHandle->GetSegFilteringWindow();
442         BOOST_REQUIRE(value < 0);
443 }
444 
BOOST_FIXTURE_TEST_CASE(Set_Get_SegFilteringLocut_Protein,ProteinOptiosHandleFixture)445 BOOST_FIXTURE_TEST_CASE(Set_Get_SegFilteringLocut_Protein, ProteinOptiosHandleFixture) {
446         double value = 1.7;
447 
448         VerifyMutatorAccessor<CBlastProteinOptionsHandle, double>
449             (*m_OptsHandle,
450              &CBlastProteinOptionsHandle::SetSegFilteringLocut,
451              &CBlastProteinOptionsHandle::GetSegFilteringLocut,
452              value);
453 }
454 
BOOST_FIXTURE_TEST_CASE(Get_SegLocutWithSegOptionsUnallocated_Protein,ProteinOptiosHandleFixture)455 BOOST_FIXTURE_TEST_CASE(Get_SegLocutWithSegOptionsUnallocated_Protein, ProteinOptiosHandleFixture) {
456 
457         m_OptsHandle->SetSegFiltering(false); // turn off SEG filtering.
458         // the following call should turn it on again.
459         double value = m_OptsHandle->GetSegFilteringLocut();
460         BOOST_REQUIRE(value < 0);
461 }
462 
BOOST_FIXTURE_TEST_CASE(Set_Get_SegFilteringHicut_Protein,ProteinOptiosHandleFixture)463 BOOST_FIXTURE_TEST_CASE(Set_Get_SegFilteringHicut_Protein, ProteinOptiosHandleFixture) {
464         double value = 3.7;
465 
466         VerifyMutatorAccessor<CBlastProteinOptionsHandle, double>
467             (*m_OptsHandle,
468              &CBlastProteinOptionsHandle::SetSegFilteringHicut,
469              &CBlastProteinOptionsHandle::GetSegFilteringHicut,
470              value);
471 }
472 
BOOST_FIXTURE_TEST_CASE(Get_SegHicutWithSegOptionsUnallocated_Protein,ProteinOptiosHandleFixture)473 BOOST_FIXTURE_TEST_CASE(Get_SegHicutWithSegOptionsUnallocated_Protein, ProteinOptiosHandleFixture) {
474 
475         m_OptsHandle->SetSegFiltering(false); // turn off SEG filtering.
476         // the following call should turn it on again.
477         double value = m_OptsHandle->GetSegFilteringHicut();
478         BOOST_REQUIRE(value < 0);
479 }
480 
BOOST_FIXTURE_TEST_CASE(Set_Get_MatrixName_Protein,ProteinOptiosHandleFixture)481 BOOST_FIXTURE_TEST_CASE(Set_Get_MatrixName_Protein, ProteinOptiosHandleFixture) {
482         const char* value = "dummy matrix";
483 
484         VerifyMutatorAccessor<CBlastProteinOptionsHandle, const char*>
485             (*m_OptsHandle,
486              &CBlastProteinOptionsHandle::SetMatrixName,
487              &CBlastProteinOptionsHandle::GetMatrixName,
488              value);
489 }
490 
BOOST_FIXTURE_TEST_CASE(Set_Get_GapOpeningCost_Protein,ProteinOptiosHandleFixture)491 BOOST_FIXTURE_TEST_CASE(Set_Get_GapOpeningCost_Protein, ProteinOptiosHandleFixture) {
492         int value = 150;
493 
494         VerifyMutatorAccessor<CBlastProteinOptionsHandle, int>
495             (*m_OptsHandle,
496              &CBlastProteinOptionsHandle::SetGapOpeningCost,
497              &CBlastProteinOptionsHandle::GetGapOpeningCost,
498              value);
499 }
500 
BOOST_FIXTURE_TEST_CASE(Set_Get_GapExtensionCost_Protein,ProteinOptiosHandleFixture)501 BOOST_FIXTURE_TEST_CASE(Set_Get_GapExtensionCost_Protein, ProteinOptiosHandleFixture) {
502         int value = 150;
503 
504         VerifyMutatorAccessor<CBlastProteinOptionsHandle, int>
505             (*m_OptsHandle,
506              &CBlastProteinOptionsHandle::SetGapExtensionCost,
507              &CBlastProteinOptionsHandle::GetGapExtensionCost,
508              value);
509 }
510 
511 struct PSIBlastOptiosHandleFixture {
PSIBlastOptiosHandleFixturePSIBlastOptiosHandleFixture512     PSIBlastOptiosHandleFixture() {
513         m_OptsHandle = new CPSIBlastOptionsHandle();
514     }
~PSIBlastOptiosHandleFixturePSIBlastOptiosHandleFixture515     ~PSIBlastOptiosHandleFixture() { delete m_OptsHandle;}
516 
517     CPSIBlastOptionsHandle* m_OptsHandle;
518 };
519 
520 
521 // PSI-BLAST options
522 // TLM - CPSIBlastOptionsHandleTest
523 
BOOST_FIXTURE_TEST_CASE(Set_Get_WordThreshold_PSIBlast,PSIBlastOptiosHandleFixture)524 BOOST_FIXTURE_TEST_CASE(Set_Get_WordThreshold_PSIBlast, PSIBlastOptiosHandleFixture) {
525         double value = 15;
526 
527         VerifyMutatorAccessor<CPSIBlastOptionsHandle, double>
528             (*m_OptsHandle,
529              &CPSIBlastOptionsHandle::SetWordThreshold,
530              &CPSIBlastOptionsHandle::GetWordThreshold,
531              value);
532 }
533 
BOOST_FIXTURE_TEST_CASE(Set_Get_InclusionThreshold_PSIBlast,PSIBlastOptiosHandleFixture)534 BOOST_FIXTURE_TEST_CASE(Set_Get_InclusionThreshold_PSIBlast, PSIBlastOptiosHandleFixture) {
535         double value = 0.05;
536 
537         VerifyMutatorAccessor<CPSIBlastOptionsHandle, double>
538             (*m_OptsHandle,
539              &CPSIBlastOptionsHandle::SetInclusionThreshold,
540              &CPSIBlastOptionsHandle::GetInclusionThreshold,
541              value);
542 }
543 
BOOST_FIXTURE_TEST_CASE(Set_Get_SegFiltering_PSIBlast,PSIBlastOptiosHandleFixture)544 BOOST_FIXTURE_TEST_CASE(Set_Get_SegFiltering_PSIBlast, PSIBlastOptiosHandleFixture) {
545         bool value = true;
546 
547         VerifyMutatorAccessor<CPSIBlastOptionsHandle, bool>
548             (*m_OptsHandle,
549              &CPSIBlastOptionsHandle::SetSegFiltering,
550              &CPSIBlastOptionsHandle::GetSegFiltering,
551              value);
552 }
553 
BOOST_FIXTURE_TEST_CASE(Set_Get_SegFilteringWindow_PSIBlast,PSIBlastOptiosHandleFixture)554 BOOST_FIXTURE_TEST_CASE(Set_Get_SegFilteringWindow_PSIBlast, PSIBlastOptiosHandleFixture) {
555         int value = 26;
556 
557         VerifyMutatorAccessor<CPSIBlastOptionsHandle, int>
558             (*m_OptsHandle,
559              &CPSIBlastOptionsHandle::SetSegFilteringWindow,
560              &CPSIBlastOptionsHandle::GetSegFilteringWindow,
561              value);
562 }
563 
564 struct AdvancedProteinOptionsHandleFixture {
AdvancedProteinOptionsHandleFixtureAdvancedProteinOptionsHandleFixture565     AdvancedProteinOptionsHandleFixture() {
566         m_OptsHandle = new CBlastAdvancedProteinOptionsHandle();
567     }
~AdvancedProteinOptionsHandleFixtureAdvancedProteinOptionsHandleFixture568     ~AdvancedProteinOptionsHandleFixture() { delete m_OptsHandle;}
569 
570     CBlastAdvancedProteinOptionsHandle* m_OptsHandle;
571 };
572 
573 // Advanced Protein options
574 // TLM - CBlastAdvancedProtOptionsHandleTest
BOOST_FIXTURE_TEST_CASE(Set_Get_CompositionBasedStats_AdvancedProtein,AdvancedProteinOptionsHandleFixture)575 BOOST_FIXTURE_TEST_CASE(Set_Get_CompositionBasedStats_AdvancedProtein, AdvancedProteinOptionsHandleFixture) {
576         ECompoAdjustModes value = eNoCompositionBasedStats;
577 
578         VerifyMutatorAccessor<CBlastAdvancedProteinOptionsHandle,
579                               ECompoAdjustModes>
580             (*m_OptsHandle,
581              &CBlastAdvancedProteinOptionsHandle::SetCompositionBasedStats,
582              &CBlastAdvancedProteinOptionsHandle::GetCompositionBasedStats,
583              value);
584 }
585 
BOOST_FIXTURE_TEST_CASE(Set_Get_SmithWatermanMode_AdvancedProtein,AdvancedProteinOptionsHandleFixture)586 BOOST_FIXTURE_TEST_CASE(Set_Get_SmithWatermanMode_AdvancedProtein, AdvancedProteinOptionsHandleFixture) {
587         bool value = true;
588 
589         VerifyMutatorAccessor<CBlastAdvancedProteinOptionsHandle, bool>
590             (*m_OptsHandle,
591              &CBlastAdvancedProteinOptionsHandle::SetSmithWatermanMode,
592              &CBlastAdvancedProteinOptionsHandle::GetSmithWatermanMode,
593              value);
594 }
595 
596 struct BlastNuclOptionsHandleFixture {
BlastNuclOptionsHandleFixtureBlastNuclOptionsHandleFixture597     BlastNuclOptionsHandleFixture() {
598         m_OptsHandle = new CBlastNucleotideOptionsHandle();
599     }
~BlastNuclOptionsHandleFixtureBlastNuclOptionsHandleFixture600     ~BlastNuclOptionsHandleFixture() { delete m_OptsHandle;}
601 
602     CBlastNucleotideOptionsHandle* m_OptsHandle;
603 };
604 
605 // Nucleotide blast
606 // TLM - CBlastNuclOptionsHandleTest
607 
BOOST_FIXTURE_TEST_CASE(Set_Get_LookupTableType_BlastNucl,BlastNuclOptionsHandleFixture)608 BOOST_FIXTURE_TEST_CASE(Set_Get_LookupTableType_BlastNucl, BlastNuclOptionsHandleFixture) {
609         ELookupTableType value = eNaLookupTable;
610 
611         VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, ELookupTableType>
612             (*m_OptsHandle,
613              &CBlastNucleotideOptionsHandle::SetLookupTableType,
614              &CBlastNucleotideOptionsHandle::GetLookupTableType,
615              value);
616 }
617 
BOOST_FIXTURE_TEST_CASE(Set_Get_WordSize_BlastNucl,BlastNuclOptionsHandleFixture)618 BOOST_FIXTURE_TEST_CASE(Set_Get_WordSize_BlastNucl, BlastNuclOptionsHandleFixture) {
619         int value = 23;
620 
621         VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, int>
622             (*m_OptsHandle,
623              &CBlastNucleotideOptionsHandle::SetWordSize,
624              &CBlastNucleotideOptionsHandle::GetWordSize,
625              value);
626 }
627 
BOOST_FIXTURE_TEST_CASE(Set_Get_StrandOption_BlastNucl,BlastNuclOptionsHandleFixture)628 BOOST_FIXTURE_TEST_CASE(Set_Get_StrandOption_BlastNucl, BlastNuclOptionsHandleFixture) {
629         objects::ENa_strand value = objects::eNa_strand_minus;
630         m_OptsHandle->SetStrandOption(value);
631         objects::ENa_strand actual_value = m_OptsHandle->GetStrandOption();
632         BOOST_REQUIRE_EQUAL((int)value, (int)actual_value);
633 }
634 
BOOST_FIXTURE_TEST_CASE(Set_Get_WindowSize_BlastNucl,BlastNuclOptionsHandleFixture)635 BOOST_FIXTURE_TEST_CASE(Set_Get_WindowSize_BlastNucl, BlastNuclOptionsHandleFixture) {
636         int value = 50;
637 
638         VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, int>
639             (*m_OptsHandle,
640              &CBlastNucleotideOptionsHandle::SetWindowSize,
641              &CBlastNucleotideOptionsHandle::GetWindowSize,
642              value);
643 }
644 
BOOST_FIXTURE_TEST_CASE(Set_Get_XDropoff_BlastNucl,BlastNuclOptionsHandleFixture)645 BOOST_FIXTURE_TEST_CASE(Set_Get_XDropoff_BlastNucl, BlastNuclOptionsHandleFixture) {
646         double value = 40;
647 
648         VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, double>
649             (*m_OptsHandle,
650              &CBlastNucleotideOptionsHandle::SetXDropoff,
651              &CBlastNucleotideOptionsHandle::GetXDropoff,
652              value);
653 }
654 
BOOST_FIXTURE_TEST_CASE(Set_Get_GapXDropoffFinal_BlastNucl,BlastNuclOptionsHandleFixture)655 BOOST_FIXTURE_TEST_CASE(Set_Get_GapXDropoffFinal_BlastNucl, BlastNuclOptionsHandleFixture) {
656         double value = 100;
657 
658         VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, double>
659             (*m_OptsHandle,
660              &CBlastNucleotideOptionsHandle::SetGapXDropoffFinal,
661              &CBlastNucleotideOptionsHandle::GetGapXDropoffFinal,
662              value);
663 }
664 
BOOST_FIXTURE_TEST_CASE(Set_Get_GapExtnAlgorithm_BlastNucl,BlastNuclOptionsHandleFixture)665 BOOST_FIXTURE_TEST_CASE(Set_Get_GapExtnAlgorithm_BlastNucl, BlastNuclOptionsHandleFixture) {
666         EBlastPrelimGapExt value = eDynProgScoreOnly;
667         const int kGapOpen = 7;
668         const int kGapExtend = 3;
669 
670         m_OptsHandle->SetGapOpeningCost(kGapOpen);
671         m_OptsHandle->SetGapExtensionCost(kGapExtend);
672 
673         VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, EBlastPrelimGapExt>
674             (*m_OptsHandle,
675              &CBlastNucleotideOptionsHandle::SetGapExtnAlgorithm,
676              &CBlastNucleotideOptionsHandle::GetGapExtnAlgorithm,
677              value);
678 
679         BOOST_REQUIRE_EQUAL(kGapOpen, m_OptsHandle->GetGapOpeningCost());
680         BOOST_REQUIRE_EQUAL(kGapExtend, m_OptsHandle->GetGapExtensionCost());
681 
682         value = eGreedyScoreOnly;
683         VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, EBlastPrelimGapExt>
684             (*m_OptsHandle,
685              &CBlastNucleotideOptionsHandle::SetGapExtnAlgorithm,
686              &CBlastNucleotideOptionsHandle::GetGapExtnAlgorithm,
687              value);
688 
689         BOOST_REQUIRE_EQUAL(kGapOpen, m_OptsHandle->GetGapOpeningCost());
690         BOOST_REQUIRE_EQUAL(kGapExtend, m_OptsHandle->GetGapExtensionCost());
691 
692 }
693 
BOOST_FIXTURE_TEST_CASE(Set_Get_GapTracebackAlgorithm_BlastNucl,BlastNuclOptionsHandleFixture)694 BOOST_FIXTURE_TEST_CASE(Set_Get_GapTracebackAlgorithm_BlastNucl, BlastNuclOptionsHandleFixture) {
695         EBlastTbackExt value = eDynProgTbck;
696         const int kGapOpen = 7;
697         const int kGapExtend = 3;
698 
699         m_OptsHandle->SetGapOpeningCost(kGapOpen);
700         m_OptsHandle->SetGapExtensionCost(kGapExtend);
701 
702         VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, EBlastTbackExt>
703             (*m_OptsHandle,
704              &CBlastNucleotideOptionsHandle::SetGapTracebackAlgorithm,
705              &CBlastNucleotideOptionsHandle::GetGapTracebackAlgorithm,
706              value);
707 
708         BOOST_REQUIRE_EQUAL(kGapOpen, m_OptsHandle->GetGapOpeningCost());
709         BOOST_REQUIRE_EQUAL(kGapExtend, m_OptsHandle->GetGapExtensionCost());
710 
711 }
712 
BOOST_FIXTURE_TEST_CASE(Set_Get_MatchReward_BlastNucl,BlastNuclOptionsHandleFixture)713 BOOST_FIXTURE_TEST_CASE(Set_Get_MatchReward_BlastNucl, BlastNuclOptionsHandleFixture) {
714         int value = 2;
715 
716         VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, int>
717             (*m_OptsHandle,
718              &CBlastNucleotideOptionsHandle::SetMatchReward,
719              &CBlastNucleotideOptionsHandle::GetMatchReward,
720              value);
721 }
722 
BOOST_FIXTURE_TEST_CASE(Set_Get_MismatchPenalty_BlastNucl,BlastNuclOptionsHandleFixture)723 BOOST_FIXTURE_TEST_CASE(Set_Get_MismatchPenalty_BlastNucl, BlastNuclOptionsHandleFixture) {
724         int value = -3;
725 
726         VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, int>
727             (*m_OptsHandle,
728              &CBlastNucleotideOptionsHandle::SetMismatchPenalty,
729              &CBlastNucleotideOptionsHandle::GetMismatchPenalty,
730              value);
731 }
732 
BOOST_FIXTURE_TEST_CASE(Set_Get_MatrixName_BlastNucl,BlastNuclOptionsHandleFixture)733 BOOST_FIXTURE_TEST_CASE(Set_Get_MatrixName_BlastNucl, BlastNuclOptionsHandleFixture) {
734         const char* value = "MYNAMATRIX";
735 
736         VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, const char*>
737             (*m_OptsHandle,
738              &CBlastNucleotideOptionsHandle::SetMatrixName,
739              &CBlastNucleotideOptionsHandle::GetMatrixName,
740              value);
741 }
742 
BOOST_FIXTURE_TEST_CASE(Set_Get_GapOpeningCost_BlastNucl,BlastNuclOptionsHandleFixture)743 BOOST_FIXTURE_TEST_CASE(Set_Get_GapOpeningCost_BlastNucl, BlastNuclOptionsHandleFixture) {
744         int value = 4;
745 
746         VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, int>
747             (*m_OptsHandle,
748              &CBlastNucleotideOptionsHandle::SetGapOpeningCost,
749              &CBlastNucleotideOptionsHandle::GetGapOpeningCost,
750              value);
751 }
752 
BOOST_FIXTURE_TEST_CASE(Set_Get_GapExtensionCost_BlastNucl,BlastNuclOptionsHandleFixture)753 BOOST_FIXTURE_TEST_CASE(Set_Get_GapExtensionCost_BlastNucl, BlastNuclOptionsHandleFixture) {
754         int value = 1;
755 
756         VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, int>
757             (*m_OptsHandle,
758              &CBlastNucleotideOptionsHandle::SetGapExtensionCost,
759              &CBlastNucleotideOptionsHandle::GetGapExtensionCost,
760              value);
761 }
762 
BOOST_FIXTURE_TEST_CASE(Set_Get_EffectiveSearchSpace_BlastNucl,BlastNuclOptionsHandleFixture)763 BOOST_FIXTURE_TEST_CASE(Set_Get_EffectiveSearchSpace_BlastNucl, BlastNuclOptionsHandleFixture) {
764         Int8 value = 20000000;
765 
766         VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, Int8>
767             (*m_OptsHandle,
768              &CBlastNucleotideOptionsHandle::SetEffectiveSearchSpace,
769              &CBlastNucleotideOptionsHandle::GetEffectiveSearchSpace,
770              value);
771 }
772 
BOOST_FIXTURE_TEST_CASE(Set_Get_DustFiltering_BlastNucl,BlastNuclOptionsHandleFixture)773 BOOST_FIXTURE_TEST_CASE(Set_Get_DustFiltering_BlastNucl, BlastNuclOptionsHandleFixture) {
774         bool value = true;
775 
776         VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, bool>
777             (*m_OptsHandle,
778              &CBlastNucleotideOptionsHandle::SetDustFiltering,
779              &CBlastNucleotideOptionsHandle::GetDustFiltering,
780              value);
781 }
782 
BOOST_FIXTURE_TEST_CASE(Set_Get_DustFilteringLevel_BlastNucl,BlastNuclOptionsHandleFixture)783 BOOST_FIXTURE_TEST_CASE(Set_Get_DustFilteringLevel_BlastNucl, BlastNuclOptionsHandleFixture) {
784         int value = 20;
785 
786         VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, int>
787             (*m_OptsHandle,
788              &CBlastNucleotideOptionsHandle::SetDustFilteringLevel,
789              &CBlastNucleotideOptionsHandle::GetDustFilteringLevel,
790              value);
791 }
792 
BOOST_FIXTURE_TEST_CASE(Get_DustLevelWithDustOptionsUnallocated_BlastNucl,BlastNuclOptionsHandleFixture)793 BOOST_FIXTURE_TEST_CASE(Get_DustLevelWithDustOptionsUnallocated_BlastNucl, BlastNuclOptionsHandleFixture) {
794 
795         m_OptsHandle->SetDustFiltering(false); // turn off dust filtering.
796         // the following call should turn it on again.
797         int value = m_OptsHandle->GetDustFilteringLevel();
798         BOOST_REQUIRE(value < 0);
799 }
800 
BOOST_FIXTURE_TEST_CASE(Set_Get_DustFilteringWindow_BlastNucl,BlastNuclOptionsHandleFixture)801 BOOST_FIXTURE_TEST_CASE(Set_Get_DustFilteringWindow_BlastNucl, BlastNuclOptionsHandleFixture) {
802         int value = 21;
803 
804         VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, int>
805             (*m_OptsHandle,
806              &CBlastNucleotideOptionsHandle::SetDustFilteringWindow,
807              &CBlastNucleotideOptionsHandle::GetDustFilteringWindow,
808              value);
809 }
810 
BOOST_FIXTURE_TEST_CASE(Get_DustWindowWithDustOptionsUnallocated_BlastNucl,BlastNuclOptionsHandleFixture)811 BOOST_FIXTURE_TEST_CASE(Get_DustWindowWithDustOptionsUnallocated_BlastNucl, BlastNuclOptionsHandleFixture) {
812 
813         m_OptsHandle->SetDustFiltering(false); // turn off dust filtering.
814         // the following call should turn it on again.
815         int value = m_OptsHandle->GetDustFilteringWindow();
816         BOOST_REQUIRE(value < 0);
817 }
818 
BOOST_FIXTURE_TEST_CASE(Set_Get_DustFilteringLinker_BlastNucl,BlastNuclOptionsHandleFixture)819 BOOST_FIXTURE_TEST_CASE(Set_Get_DustFilteringLinker_BlastNucl, BlastNuclOptionsHandleFixture) {
820         int value = 22;
821 
822         VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, int>
823             (*m_OptsHandle,
824              &CBlastNucleotideOptionsHandle::SetDustFilteringLinker,
825              &CBlastNucleotideOptionsHandle::GetDustFilteringLinker,
826              value);
827 }
828 
BOOST_FIXTURE_TEST_CASE(Get_DustLinkerWithDustOptionsUnallocated_BlastNucl,BlastNuclOptionsHandleFixture)829 BOOST_FIXTURE_TEST_CASE(Get_DustLinkerWithDustOptionsUnallocated_BlastNucl, BlastNuclOptionsHandleFixture) {
830 
831         m_OptsHandle->SetDustFiltering(false); // turn off dust filtering.
832         // the following call should turn it on again.
833         int value = m_OptsHandle->GetDustFilteringLinker();
834         BOOST_REQUIRE(value < 0);
835 }
836 
BOOST_FIXTURE_TEST_CASE(Set_Get_RepeatFiltering_BlastNucl,BlastNuclOptionsHandleFixture)837 BOOST_FIXTURE_TEST_CASE(Set_Get_RepeatFiltering_BlastNucl, BlastNuclOptionsHandleFixture) {
838         bool value = true;
839 
840         VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, bool>
841             (*m_OptsHandle,
842              &CBlastNucleotideOptionsHandle::SetRepeatFiltering,
843              &CBlastNucleotideOptionsHandle::GetRepeatFiltering,
844              value);
845 }
846 
BOOST_FIXTURE_TEST_CASE(Set_Get_RepeatFilteringDB_BlastNucl,BlastNuclOptionsHandleFixture)847 BOOST_FIXTURE_TEST_CASE(Set_Get_RepeatFilteringDB_BlastNucl, BlastNuclOptionsHandleFixture) {
848         const char* db = "my_repeat_db";
849 
850         VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, const char*>
851             (*m_OptsHandle,
852              &CBlastNucleotideOptionsHandle::SetRepeatFilteringDB,
853              &CBlastNucleotideOptionsHandle::GetRepeatFilteringDB,
854              db);
855 }
856 
857 struct DiscNucleotideOptionsHandleFixture {
DiscNucleotideOptionsHandleFixtureDiscNucleotideOptionsHandleFixture858     DiscNucleotideOptionsHandleFixture() {
859         m_OptsHandle = new CDiscNucleotideOptionsHandle();
860     }
~DiscNucleotideOptionsHandleFixtureDiscNucleotideOptionsHandleFixture861     ~DiscNucleotideOptionsHandleFixture() { delete m_OptsHandle;}
862 
863     CDiscNucleotideOptionsHandle* m_OptsHandle;
864 };
865 
866 
867 // Discontiguous nucleotide blast
868 // TLM - CDiscNuclOptionsHandleTest
BOOST_FIXTURE_TEST_CASE(Set_Get_TemplateLength_DiscNucleotide,DiscNucleotideOptionsHandleFixture)869 BOOST_FIXTURE_TEST_CASE(Set_Get_TemplateLength_DiscNucleotide, DiscNucleotideOptionsHandleFixture) {
870         unsigned char value = 18;
871 
872         VerifyMutatorAccessor<CDiscNucleotideOptionsHandle, unsigned char>
873             (*m_OptsHandle,
874              &CDiscNucleotideOptionsHandle::SetTemplateLength,
875              &CDiscNucleotideOptionsHandle::GetTemplateLength,
876              value);
877 }
878 
BOOST_FIXTURE_TEST_CASE(Set_Get_TemplateType_DiscNucleotide,DiscNucleotideOptionsHandleFixture)879 BOOST_FIXTURE_TEST_CASE(Set_Get_TemplateType_DiscNucleotide, DiscNucleotideOptionsHandleFixture) {
880         unsigned char value = 1;
881 
882         VerifyMutatorAccessor<CDiscNucleotideOptionsHandle, unsigned char>
883             (*m_OptsHandle,
884              &CDiscNucleotideOptionsHandle::SetTemplateType,
885              &CDiscNucleotideOptionsHandle::GetTemplateType,
886              value);
887 }
888 
BOOST_FIXTURE_TEST_CASE(Set_Get_WordSize_DiscNucleotide,DiscNucleotideOptionsHandleFixture)889 BOOST_FIXTURE_TEST_CASE(Set_Get_WordSize_DiscNucleotide, DiscNucleotideOptionsHandleFixture) {
890         int value = 12;
891 
892         VerifyMutatorAccessor<CDiscNucleotideOptionsHandle, int>
893             (*m_OptsHandle,
894              &CDiscNucleotideOptionsHandle::SetWordSize,
895              &CDiscNucleotideOptionsHandle::GetWordSize,
896              value);
897         value = 16;
898         try {
899             m_OptsHandle->SetWordSize(value);
900         } catch (const CBlastException& exptn) {
901             BOOST_REQUIRE(!strcmp("Word size must be 11 or 12 only", exptn.GetMsg().c_str()));
902         }
903 }
904 
BOOST_FIXTURE_TEST_CASE(Set_Get_QueryCoverageHspPercentage,BlastNuclOptionsHandleFixture)905 BOOST_FIXTURE_TEST_CASE(Set_Get_QueryCoverageHspPercentage, BlastNuclOptionsHandleFixture) {
906 
907         int value = m_OptsHandle->GetQueryCovHspPerc();
908         //Test default
909         BOOST_REQUIRE(value == 0);
910         m_OptsHandle->SetQueryCovHspPerc(52);
911         value = m_OptsHandle->GetQueryCovHspPerc();
912         BOOST_REQUIRE(value == 52);
913 }
914 
915 
916 
917 
918 //BOOST_AUTO_TEST_SUITE_END()
919 
920 /*
921 * ===========================================================================
922 *
923 * $Log: optionshandle-cppunit.cpp,v $
924 * Revision 1.32  2008/07/18 14:16:43  camacho
925 * Minor fix to previous commit
926 *
927 * Revision 1.31  2008/07/18 14:05:21  camacho
928 * Irix fixes
929 *
930 * Revision 1.30  2007/10/23 16:00:57  madden
931 * Changes for removal of [SG]etUngappedExtension
932 *
933 * Revision 1.29  2007/07/25 12:41:39  madden
934 * Accomodates changes to blastn type defaults
935 *
936 * Revision 1.28  2007/07/10 13:52:40  madden
937 * tests of CBlastOptionsFactory::CreateTask (CBlastOptionsCreateTaskTest)
938 *
939 * Revision 1.27  2007/04/05 13:00:20  madden
940 * 2nd arg to SetFilterString
941 *
942 * Revision 1.26  2007/03/07 19:20:41  papadopo
943 * make lookup table threshold a double
944 *
945 * Revision 1.25  2007/02/14 20:18:01  papadopo
946 * remove SetFullByteScan and discontig. megablast with stride 4
947 *
948 * Revision 1.24  2007/02/08 17:13:49  papadopo
949 * change enum value
950 *
951 * Revision 1.23  2006/12/19 16:38:23  madden
952 * Fix if filtering option is NULL
953 *
954 * Revision 1.22  2006/12/13 13:52:35  madden
955 * Add CPSIBlastOptionsHandleTest
956 *
957 * Revision 1.21  2006/11/28 13:29:30  madden
958 * Ensure that eBlastNotSet is never chosen as a program
959 *
960 * Revision 1.20  2006/11/21 17:47:36  papadopo
961 * use enum for lookup table type
962 *
963 * Revision 1.19  2006/06/12 17:23:41  madden
964 * Remove [GS]etMatrixPath
965 *
966 * Revision 1.18  2006/06/05 13:34:05  madden
967 * Changes to remove [GS]etMatrixPath and use callback instead
968 *
969 * Revision 1.17  2006/01/23 19:57:52  camacho
970 * Allow new varieties of composition based statistics
971 *
972 * Revision 1.16  2005/12/22 14:17:00  papadopo
973 * remove variable wordsize test
974 *
975 * Revision 1.15  2005/08/01 12:55:28  madden
976 * Check that SetGapTracebackAlgorithm and SetGapExtnAlgorithm do not change gap costs
977 *
978 * Revision 1.14  2005/05/24 19:16:22  camacho
979 * Register advanced options handle tests with a unique name
980 *
981 * Revision 1.13  2005/05/24 18:48:25  madden
982 * Add CBlastAdvancedProtOptionsHandleTest
983 *
984 * Revision 1.12  2005/03/04 17:20:45  bealer
985 * - Command line option support.
986 *
987 * Revision 1.11  2005/03/02 22:39:10  camacho
988 * Remove deprecated methods
989 *
990 * Revision 1.10  2005/02/24 13:48:58  madden
991 * Add tests of getters and setters for structured filtering options
992 *
993 * Revision 1.9  2005/01/10 14:57:40  madden
994 * Add Set_Get_FullByteScan for discontiguous megablast
995 *
996 * Revision 1.8  2005/01/10 14:04:30  madden
997 * Removed calls to methods that no longer exist
998 *
999 * Revision 1.7  2004/12/28 13:37:48  madden
1000 * Use an int rather than a short for word size
1001 *
1002 * Revision 1.6  2004/08/30 16:54:29  dondosha
1003 * Added unit tests for nucleotide and discontiguous options handles setters and getters
1004 *
1005 * Revision 1.5  2004/07/06 19:40:11  camacho
1006 * Remove extra qualification of assertion_traits
1007 *
1008 * Revision 1.4  2004/03/10 15:54:06  madden
1009 * Changes for rps options handle
1010 *
1011 * Revision 1.3  2004/02/20 23:20:37  camacho
1012 * Remove undefs.h
1013 *
1014 * Revision 1.2  2003/12/12 16:16:33  camacho
1015 * Minor
1016 *
1017 * Revision 1.1  2003/11/26 18:47:13  camacho
1018 * Initial revision. Intended as example of CppUnit framework use
1019 *
1020 *
1021 * ===========================================================================
1022 */
1023