Skip to content

Commit

Permalink
7unit tests now pass. 2 open issues to discuss with Sorina
Browse files Browse the repository at this point in the history
1. Two unit tests are left commented out, but with all necessary API changes made.
   In both cases I am unsure of what input PRG and query read to use, and I've
   indicated where they should go. Sorina - can you help?

2. These warnings bother me:
warning: converting ‘false’ to pointer type for argument 1 of ‘char testing::internal::IsNullLiteralHelper
  • Loading branch information
zamiqbal committed Jul 28, 2016
1 parent 4f52725 commit 53598fc
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/test/unittest_bidir_search_bwd_fwd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,18 @@ std::vector<int> mask_a;
/*
TEST(BackwardSearchTest, NoVariants){
csa_wt<wt_int<bit_vector,rank_support_v5<>>,2,2> csa=csa_constr(test_file,covgs, "int_alphabet_file","memory_log_file","csa_file",true);
//SORINA - WHAT GOES HERE?if you can fill in the next 3 lines, this should compile and run
test_file2="";
query="";
mask_file="../test_cases/";
ifstream g(mask_file);
bool precalc=false;
int a;
mask_a.clear();
while (g>>a) mask_a.push_back(a);
csa_wt<wt_int<bit_vector,rank_support_v5<>>,2,16777216> csa=csa_constr(test_file, "int_alphabet_file","memory_log_file","csa_file",true);
std::list<std::pair<uint64_t,uint64_t>> sa_intervals, sa_intervals_rev;
std::list<std::vector<std::pair<uint32_t, std::vector<int>>>> sites;
Expand All @@ -30,6 +41,7 @@ TEST(BackwardSearchTest, NoVariants){
q=*it;
bool first_del=false;
bool precalc = false;
int occ_expt=0;
int pos=prg.find(q,0);
Expand All @@ -45,7 +57,7 @@ TEST(BackwardSearchTest, NoVariants){
if (q[i]=='T' or q[i]=='t') p.push_back(4);
}
std::vector<uint8_t>::iterator res_it=bidir_search_bwd(csa,0,csa.size(),0,csa.size(),p.begin(),p.end(), sa_intervals,sa_intervals_rev,sites,mask_a,5,first_del);
std::vector<uint8_t>::iterator res_it=bidir_search_bwd(csa,0,csa.size(),0,csa.size(),p.begin(),p.end(), sa_intervals,sa_intervals_rev,sites,mask_a,5,first_del, precalc);
uint64_t no_occ=(*sa_intervals.begin()).second-(*sa_intervals.begin()).first;
EXPECT_EQ(false,first_del);
Expand All @@ -56,9 +68,9 @@ TEST(BackwardSearchTest, NoVariants){
sa_intervals_rev.clear();
sites.clear();
csa_wt<wt_int<bit_vector,rank_support_v5<>>,2,2> csa_rev=csa_constr(test_file,covgs, "int_alphabet_file","memory_log_file","csa_file",false);
csa_wt<wt_int<bit_vector,rank_support_v5<>>,2,16777216> csa_rev=csa_constr(test_file, "int_alphabet_file","memory_log_file","csa_file",false);
first_del=false;
res_it=bidir_search_fwd(csa_rev,0,csa_rev.size(),0,csa_rev.size(),p.begin(),p.end(), sa_intervals,sa_intervals_rev,sites,mask_a,5,first_del);
res_it=bidir_search_fwd(csa_rev,0,csa_rev.size(),0,csa_rev.size(),p.begin(),p.end(), sa_intervals,sa_intervals_rev,sites,mask_a,5,first_del, precalc);
no_occ=(*sa_intervals.begin()).second-(*sa_intervals.begin()).first;
EXPECT_EQ(false,first_del);
Expand Down

6 comments on commit 53598fc

@sm0179
Copy link
Collaborator

@sm0179 sm0179 commented on 53598fc Jul 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test files for PRGs with no variants are: one_byte.txt, 100a.txt, abc_abc_abc.txt, actg.txt, MSP3.4_200_bases.txt
for query, there is a function generate_all_substrings at the bottom, I was calling that and querying all the substrings of the PRG
A mask is not needed for the PRG with no variants, so you can leave it empty I think

@sm0179
Copy link
Collaborator

@sm0179 sm0179 commented on 53598fc Jul 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the line of the warning in number 2?

@sm0179
Copy link
Collaborator

@sm0179 sm0179 commented on 53598fc Jul 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for test Long_site_and_repeated_snp_on_edge_of_site:
test file is repeated_snp_on_both_edges.txt
query is tagacacacagtgtcgcctcgtcggctttgagtggtgctagacccca
Mask is match_within_long_site_mask_a.txt

@iqbal-lab
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've started adding these - see 32b286f . f

@iqbal-lab
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re warning line, it's every comparison between first_del and false

./test/unittest_bidir_search_bwd_fwd.cpp:74:5: warning: converting ‘false’ to pointer type for argument 1 of ‘char testing::internal::IsNullLiteralHelper(testing::internal::Secret_)’ [-Wconversion-null]
./test/unittest_bidir_search_bwd_fwd.cpp:87:5: warning: converting ‘false’ to pointer type for argument 1 of ‘char testing::internal::IsNullLiteralHelper(testing::internal::Secret_)’ [-Wconversion-null]
./test/unittest_bidir_search_bwd_fwd.cpp:43:8: warning: unused variable ‘precalc’ [-Wunused-variable]
./test/unittest_bidir_search_bwd_fwd.cpp: In member function ‘virtual void BackwardSearchTest_NoVariants2_Test::TestBody()’:
./test/unittest_bidir_search_bwd_fwd.cpp:116:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
./test/unittest_bidir_search_bwd_fwd.cpp:138:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
./test/unittest_bidir_search_bwd_fwd.cpp:153:5: warning: converting ‘false’ to pointer type for argument 1 of ‘char testing::internal::IsNullLiteralHelper(testing::internal::Secret_)’ [-Wconversion-null]
./test/unittest_bidir_search_bwd_fwd.cpp:166:5: warning: converting ‘false’ to pointer type for argument 1 of ‘char testing::internal::IsNullLiteralHelper(testing::internal::Secret_)’ [-Wconversion-null]
./test/unittest_bidir_search_bwd_fwd.cpp:122:8: warning: unused variable ‘precalc’ [-Wunused-variable]
./test/unittest_bidir_search_bwd_fwd.cpp: In member function ‘virtual void BackwardSearchTest_Two_matches_one_variable_one_nonvariable_region_Test::TestBody()’:
./test/unittest_bidir_search_bwd_fwd.cpp:318:3: warning: converting ‘false’ to pointer type for argument 1 of ‘char testing::internal::IsNullLiteralHelper(testing::internal::Secret_)’ [-Wconversion-null]
./test/unittest_bidir_search_bwd_fwd.cpp:334:3: warning: converting ‘false’ to pointer type for argument 1 of ‘char testing::internal::IsNullLiteralHelper(testing::internal::Secret_)’ [-Wconversion-null]
./test/unittest_bidir_search_bwd_fwd.cpp: In member function ‘virtual void BackwardSearchTest_Match_within_long_site_match_outside_Test::TestBody()’:
./test/unittest_bidir_search_bwd_fwd.cpp:442:3: warning: converting ‘false’ to pointer type for argument 1 of ‘char testing::internal::IsNullLiteralHelper(testing::internal::Secret_)’ [-Wconversion-null]
./test/unittest_bidir_search_bwd_fwd.cpp:459:3: warning: converting ‘false’ to pointer type for argument 1 of ‘char testing::internal::IsNullLiteralHelper(testing::internal::Secret_)’ [-Wconversion-null]
./test/unittest_bidir_search_bwd_fwd.cpp: In member function ‘virtual void BackwardSearchTest_Multiple_matches_over_multiple_sites_Test::TestBody()’:

@iqbal-lab
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warnings mentioned in previous comments are fixed here: cce3cf9

Please sign in to comment.