bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

date-week-number test in srfi-19.test


From: Andreas Vögele
Subject: date-week-number test in srfi-19.test
Date: Sun, 25 Apr 2004 17:57:38 +0200

I'm wondering whether the second date-week-number test at the end of
srfi-19.test or the SRFI 19 implementation is broken.

The second tests is supposed to return 0:

  (with-test-prefix "date-week-number"
    (pass-if (= 0 (date-week-number (make-date 0 0 0 0 1 1 1984 0) 0)))
    (pass-if (= 0 (date-week-number (make-date 0 0 0 0 7 1 1984 0) 0)))
    (pass-if (= 1 (date-week-number (make-date 0 0 0 0 8 1 1984 0) 0)))))

But I'm always getting the result 1 when I execute the second
date-week-number expression in Guile, Scsh, or MzScheme:

$ guile
guile> (use-modules (srfi srfi-19))
guile> (date-week-number (make-date 0 0 0 0 7 1 1984 0) 0)
1

$ scsh -o srfi-19
Welcome to scsh 0.6.5 (0.6.6)
Type ,? for help.
> (date-week-number (make-date 0 0 0 0 7 1 1984 0) 0)
1

$ mzscheme
Welcome to MzScheme version 206p1, Copyright (c) 2004 PLT Scheme, Inc.
> (require (lib "19.ss" "srfi"))
> (tm:date-week-number (tm:make-date 0 0 0 0 7 1 1984 0) 0)
1

Here's the description of date-week-number from SRFI 19:

date-week-number date day-of-week-starting-week -> integer 

The ordinal week of the year which holds this date, ignoring a first
partial week. 'Day-of-week-starting-week' is the integer corresponding
to the day of the week which is to be considered the first day of the
week (Sunday=0, Monday=1, etc.).

The output of cal 1 1984:

   January 1984
 S  M Tu  W Th  F  S
 1  2  3  4  5  6  7
 8  9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31

If the ordinal week is zero based, I'd indeed expect the second test
to return 0 but why do all three SRFI 19 implementations return 1?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]