Changeset 2929
- Timestamp:
- Dec 26, 2012, 2:32:57 AM (10 years ago)
- Location:
- branches/0.10-stable/test
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.10-stable/test/Suite.h
r2649 r2929 25 25 26 26 #define YAT_TEST_PROLOGUE "\n=== " << __func__ << " ===\n" 27 28 // used to tell automake that test should be skipped 29 #define EXIT_SKIP 77 27 30 28 31 #include <yat/utility/VectorMutable.h> -
branches/0.10-stable/test/bam_iterator.cc
r2895 r2929 20 20 #include "Suite.h" 21 21 22 #ifdef HAVE_LIBBAM 22 23 #include "yat/omic/BamFile.h" 23 24 #include "yat/omic/BamRead.h" 24 25 #include "yat/omic/BamReadIterator.h" 25 26 #include "yat/omic/BamWriteIterator.h" 27 #endif 26 28 27 29 #include <algorithm> 28 30 #include <cassert> 29 31 #include <fstream> 30 #include <iostream>31 32 #include <string> 32 33 33 34 using namespace theplu::yat; 35 36 void test1(test::Suite& suite); 37 38 int main(int argc, char* argv[]) 39 { 40 test::Suite suite(argc, argv); 41 #ifndef HAVE_LIBBAM 42 suite.out() << "no libbam\n"; 43 return EXIT_SKIP; 44 #endif 45 #ifndef HAVE_SAMTOOLS 46 suite.out() << "no samtools\n"; 47 return EXIT_SKIP; 48 #endif 49 test1(suite); 50 return suite.return_value(); 51 } 52 53 #ifdef HAVE_LIBBAM 34 54 using namespace omic; 35 55 … … 79 99 }; 80 100 81 int main(int argc, char* argv[]) 101 102 void test1(test::Suite& suite) 82 103 { 83 #ifndef HAVE_SAMTOOLS84 return EXIT_SKIP;85 #endif86 test::Suite suite(argc, argv);87 88 104 std::string file = "../../data/foo.sorted.bam"; 89 105 … … 99 115 in.open(file); 100 116 size_t n1 = std::distance(BamReadIterator(in), BamReadIterator()); 101 s td::cout<< "entries in " << file << ": " << n1 << "\n";117 suite.out() << "entries in " << file << ": " << n1 << "\n"; 102 118 in.close(); 103 119 … … 105 121 size_t n2 = std::distance(BamReadIterator(copy), BamReadIterator()); 106 122 copy.close(); 107 s td::cout<< "entries in " << outname << ": " << n2 << "\n";123 suite.out() << "entries in " << outname << ": " << n2 << "\n"; 108 124 if (n1!=n2) { 109 s td::cout<< "error: not same number of entries in copy\n";110 exit(1);125 suite.out() << "error: not same number of entries in copy\n"; 126 suite.add(false); 111 127 } 112 128 … … 115 131 if (!std::equal(BamReadIterator(in), BamReadIterator(), 116 132 BamReadIterator(copy), BamReadEqual())) { 117 s td::cout<< "error: " << file << " and " << outname << " not equal\n";118 exit(1);133 suite.out() << "error: " << file << " and " << outname << " not equal\n"; 134 suite.add(false); 119 135 } 120 136 copy.close(); 121 137 in.close(); 122 138 unlink(outname.c_str()); 123 std::cout << "OK\n";124 return 0;125 139 } 140 #endif -
branches/0.10-stable/test/bam_pair_analyse.cc
r2902 r2929 20 20 #include "Suite.h" 21 21 22 using namespace theplu::yat; 23 24 #if HAVE_LIBBAM 22 25 #include "yat/omic/algorithm.h" 23 26 #include "yat/omic/BamRead.h" 24 27 #include "yat/omic/BamReadIterator.h" 28 #endif 25 29 26 using namespace theplu::yat; 30 void test1(test::Suite& suite); 31 32 int main(int argc, char* argv[]) 33 { 34 test::Suite suite(argc, argv); 35 #ifndef HAVE_LIBBAM 36 suite.out() << "no libbam\n"; 37 return EXIT_SKIP; 38 #endif 39 #ifndef HAVE_SAMTOOLS 40 suite.out() << "no samtools available\n"; 41 return EXIT_SKIP; 42 #endif 43 44 #ifdef HAVE_LIBBAM 45 test1(suite); 46 #endif 47 return suite.return_value(); 48 } 49 50 51 #ifdef HAVE_LIBBAM 27 52 using namespace omic; 28 53 … … 39 64 }; 40 65 41 42 int main(int argc, char* argv[]) 66 void test1(test::Suite& suite) 43 67 { 44 #ifndef HAVE_SAMTOOLS45 return EXIT_SKIP;46 #endif47 test::Suite suite(argc, argv);48 49 68 std::string file = "../../data/foo.sorted.bam"; 50 69 … … 54 73 Counter counter; 55 74 bam_pair_analyse(iter, end, counter); 56 57 75 suite.out() << counter.n_ << "\n"; 58 59 76 suite.add(counter.n_==395); 60 61 77 is.close(); 62 return suite.return_value();63 78 } 79 #endif -
branches/0.10-stable/test/bam_region_iterator.cc
r2928 r2929 20 20 #include "Suite.h" 21 21 22 #ifdef HAVE_LIBBAM 22 23 #include "yat/omic/BamReadIterator.h" 23 24 #include "yat/omic/BamWriteIterator.h" 24 25 #include "yat/omic/config_bam.h" 26 #endif 25 27 28 #ifdef YAT_BAM_HEADER 26 29 #include YAT_BAM_HEADER 30 #endif 27 31 28 32 #include <algorithm> … … 33 37 34 38 using namespace theplu::yat; 35 using namespace theplu::yat::omic; 39 40 void test1(test::Suite& suite); 41 int main(int argc, char* argv[]) 42 { 43 test::Suite suite(argc, argv); 44 #ifndef HAVE_LIBBAM 45 suite.out() << "no libbam\n"; 46 return EXIT_SKIP; 47 #endif 48 #ifndef HAVE_SAMTOOLS 49 suite.out() << "no samtools\n"; 50 return EXIT_SKIP; 51 #endif 52 53 try { 54 test1(suite); 55 } 56 catch (std::runtime_error& e) { 57 suite.err() << "what: " << e.what() << "\n"; 58 suite.add(false); 59 } 60 61 return suite.return_value(); 62 } 36 63 37 64 void test1(test::Suite& suite) 38 65 { 66 #ifdef HAVE_LIBBAM 67 using namespace omic; 39 68 std::string file = "../../data/foo.sorted.bam"; 40 69 … … 64 93 suite.err() << "count: " << count << "\nexpected: 185\n"; 65 94 suite.add(false); 95 #endif 66 96 } 67 68 69 int main(int argc, char* argv[])70 {71 #ifndef HAVE_SAMTOOLS72 return EXIT_SKIP;73 #endif74 test::Suite suite(argc, argv);75 76 try {77 test1(suite);78 }79 catch (std::runtime_error& e) {80 suite.err() << "what: " << e.what() << "\n";81 suite.add(false);82 }83 84 return suite.return_value();85 }
Note: See TracChangeset
for help on using the changeset viewer.