I've been doing some coverage analysis to see what our test suite does
and doesn't exercise.

In src/data/calendar.c

/* Takes a count of days from 14 Oct 1582 and returns the
   corresponding weekday 1...7, with 1=Sunday. */
int
calendar_offset_to_wday (int ofs)
{
  int wday = (ofs - EPOCH + 1) % 7 + 1;
  if (wday <= 0)
    wday += 7;
  return wday;
}


Can the the condition in the above IF statement ever be true?  So far
as I can tell, only if the ofs < (EPOCH - 1) but dates before EPOCH
are not permitted.

So shouldn't the "if (wday <=0) ... ;" be replaced with
"assert(wday>0);" ?



J'

-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.


Attachment: signature.asc
Description: Digital signature

_______________________________________________
pspp-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/pspp-dev

Reply via email to