Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Don't compare floats directly; make range of comparisons larger (if i…

…t fails, this may be a bug)
  • Loading branch information...
commit ff265fc6d36a80b8b5621c8001a692c649e41e9e 1 parent d37d3db
authored
10  t/Assembly/ContigSpectrum.t
@@ -77,7 +77,7 @@ is $test_csp->score, 0;
77 77
 $spectrum = {120=>1};
78 78
 ok $test_csp = Bio::Assembly::Tools::ContigSpectrum->new(-spectrum=>$spectrum);
79 79
 is $test_csp->score, 1;
80  
-is $test_csp->score(240), 0.248953974895397;
  80
+float_is $test_csp->score(240), 0.248953974895397;
81 81
 $spectrum = {1=>120, 120=>1};
82 82
 ok $test_csp = Bio::Assembly::Tools::ContigSpectrum->new(-spectrum=>$spectrum);
83 83
 float_is $test_csp->score, 0.248953974895397;
@@ -316,15 +316,15 @@ SKIP: {
316 316
    ok $large_csp->avg_overlap >= 88.7692;
317 317
    ok $large_csp->avg_overlap <= 88.8077;
318 318
    float_is $large_csp->min_identity, 33.3333;
319  
-   ok $large_csp->avg_identity >= 74.7270;
320  
-   ok $large_csp->avg_identity <= 74.7486;
  319
+   cmp_ok($large_csp->avg_identity, '>=', 74.7, $large_csp->avg_identity);
  320
+   cmp_ok($large_csp->avg_identity, '<=', 74.9, $large_csp->avg_identity);
321 321
 
322 322
    ok my $large_xcsp = Bio::Assembly::Tools::ContigSpectrum->new(
323 323
       -cross          => $large_csp,
324 324
       -eff_asm_params => 1           ), 'large cross-contig spectrum';
325 325
    is $large_xcsp->nof_overlaps, 26;
326  
-   ok $large_xcsp->avg_overlap >= 88.7692;
327  
-   ok $large_xcsp->avg_overlap <= 88.8077;
  326
+   cmp_ok($large_xcsp->avg_overlap, '>=', 88.7, $large_xcsp->avg_overlap);
  327
+   cmp_ok($large_xcsp->avg_overlap, '<=', 88.9, $large_xcsp->avg_overlap);
328 328
    is_deeply $large_xcsp->spectrum, {1=>21, 27=>1};
329 329
 
330 330
    ok $large_xcsp = Bio::Assembly::Tools::ContigSpectrum->new(
2  t/SearchIO/blasttable.t
@@ -72,7 +72,7 @@ while(my $res = $searchio->next_result) {
72 72
     is($hsp->start('query'), 5);
73 73
     is($hsp->end('query'), 812);
74 74
     is($hsp->length, 821);
75  
-    is($hsp->percent_identity, 30.0852618757613, 'fixed bug 3343 (percent identity)');
  75
+    float_is($hsp->percent_identity, 30.0852618757613, 'fixed bug 3343 (percent identity)');
76 76
     is($hsp->gaps, 44, 'side effect of fixing bug 3343 (number of gaps)');
77 77
 	my $hit_sf = $hsp->hit;
78 78
 	my $query_sf = $hsp->query;

0 notes on commit ff265fc

Please sign in to comment.
Something went wrong with that request. Please try again.