code coverage for db.cc
frederic-mahe opened this issue · 2 comments
frederic-mahe commented
I think that line 287 cannot be reached (see below). If the abundance value is negative ;size=-1;
then it cannot be captured by the regex and the error message is:
Error: Abundance annotations not found for 1 sequences, starting on line 1.
4925: 277: if (opt_usearch_abundance)
-: 278: {
-: 279: /* (^|;)size=([0-9]+)(;|$) */
-: 280:
50: 281: if (find_usearch_abundance(header, & start, & end, & number))
-: 282: {
45: 283: if (number > 0)
45: 284: abundance = number;
-: 285: else
-: 286: {
#####: 287: fprintf(stderr,
-: 288: "\nError: Illegal abundance value on line %" PRIu64 ":\n%s\n"
-: 289: "Abundance values should be positive integers.\n\n",
-: 290: lineno,
-: 291: header);
#####: 292: exit(1);
-: 293: }
-: 294: }
-: 295: }
torognes commented
What if the abundance is zero? E.g. printf ">s;size=0\nA\n" | swarm -z
frederic-mahe commented
Of course, you are right. I must be really tired, I read number > 0
as number >= 0
. Sorry!
Code coverage is progressing but I will need your help for the last percents.