diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-10-02 19:26:40 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-10-02 19:28:44 +0200 |
commit | 712654d4c023a2ab13190c6905d313e0ba897965 (patch) | |
tree | b8505b420d6621022fa6a46271340071d8881322 /tests/test | |
parent | Made displayln into a library export. (diff) | |
download | calp-712654d4c023a2ab13190c6905d313e0ba897965.tar.gz calp-712654d4c023a2ab13190c6905d313e0ba897965.tar.xz |
Rewrite test running system.
Diffstat (limited to '')
-rw-r--r-- | tests/html-components/caltable.scm (renamed from tests/test/html/caltable.scm) | 0 | ||||
-rw-r--r-- | tests/html-components/component.scm (renamed from tests/test/html/component.scm) | 0 | ||||
-rw-r--r-- | tests/test/data-stores/file.scm | 0 | ||||
-rw-r--r-- | tests/test/data-stores/sqlite.scm | 0 | ||||
-rw-r--r-- | tests/test/data-stores/vdir.scm | 0 | ||||
-rw-r--r-- | tests/test/recurrence-advanced.scm | 1550 | ||||
-rw-r--r-- | tests/test/timespec.scm | 88 | ||||
-rw-r--r-- | tests/test/translation.scm | 15 | ||||
-rw-r--r-- | tests/unit/c/cpp.scm (renamed from tests/test/cpp.scm) | 2 | ||||
-rw-r--r-- | tests/unit/datetime/datetime.scm (renamed from tests/test/datetime.scm) | 212 | ||||
-rw-r--r-- | tests/unit/datetime/tz.scm (renamed from tests/test/tz.scm) | 13 | ||||
-rw-r--r-- | tests/unit/datetime/zic.scm (renamed from tests/test/zic.scm) | 134 | ||||
-rw-r--r-- | tests/unit/termios/termios.scm (renamed from tests/test/termios.scm) | 1 | ||||
-rw-r--r-- | tests/unit/util/base64.scm (renamed from tests/test/base64.scm) | 2 | ||||
-rw-r--r-- | tests/unit/util/crypto.scm (renamed from tests/test/crypto.scm) | 2 | ||||
-rw-r--r-- | tests/unit/util/hnh-util-env.scm (renamed from tests/test/hnh-util-env.scm) | 2 | ||||
-rw-r--r-- | tests/unit/util/hnh-util-lens.scm (renamed from tests/test/hnh-util-lens.scm) | 2 | ||||
-rw-r--r-- | tests/unit/util/hnh-util-path.scm (renamed from tests/test/hnh-util-path.scm) | 2 | ||||
-rw-r--r-- | tests/unit/util/hnh-util-state-monad.scm (renamed from tests/test/hnh-util-state-monad.scm) | 1 | ||||
-rw-r--r-- | tests/unit/util/hnh-util.scm (renamed from tests/test/hnh-util.scm) | 374 | ||||
-rw-r--r-- | tests/unit/util/object.scm (renamed from tests/test/object.scm) | 2 | ||||
-rw-r--r-- | tests/unit/util/srfi-41-util.scm (renamed from tests/test/srfi-41-util.scm) | 2 | ||||
-rw-r--r-- | tests/unit/util/sxml-namespaced.scm (renamed from tests/test/sxml-namespaced.scm) | 2 | ||||
-rw-r--r-- | tests/unit/util/uuid.scm (renamed from tests/test/uuid.scm) | 2 | ||||
-rw-r--r-- | tests/unit/util/xdg-basedir.scm (renamed from tests/test/xdg-basedir.scm) | 1 | ||||
-rw-r--r-- | tests/unit/util/xml-namespace.scm (renamed from tests/test/xml-namespace.scm) | 2 | ||||
-rw-r--r-- | tests/unit/vcomponent/annoying-events.scm (renamed from tests/test/annoying-events.scm) | 19 | ||||
-rw-r--r-- | tests/unit/vcomponent/create.scm (renamed from tests/test/create.scm) | 3 | ||||
-rw-r--r-- | tests/unit/vcomponent/param.scm (renamed from tests/test/param.scm) | 3 | ||||
-rw-r--r-- | tests/unit/vcomponent/recurrence-simple.scm (renamed from tests/test/recurrence-simple.scm) | 11 | ||||
-rw-r--r-- | tests/unit/vcomponent/rrule-serialization.scm (renamed from tests/test/rrule-serialization.scm) | 2 | ||||
-rw-r--r-- | tests/unit/vcomponent/vcomponent-control.scm (renamed from tests/test/vcomponent-control.scm) | 2 | ||||
-rw-r--r-- | tests/unit/vcomponent/vcomponent-datetime.scm (renamed from tests/test/vcomponent-datetime.scm) | 17 | ||||
-rw-r--r-- | tests/unit/vcomponent/vcomponent-formats-common-types.scm (renamed from tests/test/vcomponent-formats-common-types.scm) | 8 | ||||
-rw-r--r-- | tests/unit/vcomponent/vcomponent.scm (renamed from tests/test/vcomponent.scm) | 4 | ||||
-rw-r--r-- | tests/unit/web-util/server.scm (renamed from tests/test/server.scm) | 3 | ||||
-rw-r--r-- | tests/unit/web-util/web-query.scm (renamed from tests/test/web-query.scm) | 3 | ||||
-rw-r--r-- | tests/unit/webdav/webdav-file.scm (renamed from tests/test/webdav-file.scm) | 3 | ||||
-rw-r--r-- | tests/unit/webdav/webdav-server.scm (renamed from tests/test/webdav-server.scm) | 2 | ||||
-rw-r--r-- | tests/unit/webdav/webdav-tree.scm (renamed from tests/test/webdav-tree.scm) | 3 | ||||
-rw-r--r-- | tests/unit/webdav/webdav-util.scm (renamed from tests/test/webdav-util.scm) | 2 | ||||
-rw-r--r-- | tests/unit/webdav/webdav.scm (renamed from tests/test/webdav.scm) | 6 | ||||
-rw-r--r-- | tests/web/web-server.scm (renamed from tests/test/web-server.scm) | 0 |
43 files changed, 473 insertions, 2029 deletions
diff --git a/tests/test/html/caltable.scm b/tests/html-components/caltable.scm index fec1ace4..fec1ace4 100644 --- a/tests/test/html/caltable.scm +++ b/tests/html-components/caltable.scm diff --git a/tests/test/html/component.scm b/tests/html-components/component.scm index a1fbdfbc..a1fbdfbc 100644 --- a/tests/test/html/component.scm +++ b/tests/html-components/component.scm diff --git a/tests/test/data-stores/file.scm b/tests/test/data-stores/file.scm deleted file mode 100644 index e69de29b..00000000 --- a/tests/test/data-stores/file.scm +++ /dev/null diff --git a/tests/test/data-stores/sqlite.scm b/tests/test/data-stores/sqlite.scm deleted file mode 100644 index e69de29b..00000000 --- a/tests/test/data-stores/sqlite.scm +++ /dev/null diff --git a/tests/test/data-stores/vdir.scm b/tests/test/data-stores/vdir.scm deleted file mode 100644 index e69de29b..00000000 --- a/tests/test/data-stores/vdir.scm +++ /dev/null diff --git a/tests/test/recurrence-advanced.scm b/tests/test/recurrence-advanced.scm deleted file mode 100644 index c2d71e61..00000000 --- a/tests/test/recurrence-advanced.scm +++ /dev/null @@ -1,1550 +0,0 @@ -;;; Commentary: -;; Tests of recurrence rule generation with focus on correct instances -;; being generated. For tests of basic recurrence functionallity, see -;; recurrence-simple.scm. -;; -;; This file also tests format-recurrence-rule, which checks that human -;; readable representations of the RRULES work. -;; -;; Also contains the tests for EXDATE. -;; -;; Most examples copied from RFC5545, some home written. -;;; Code: - -(define-module (test recurrence-advanced) - :use-module (srfi srfi-64) - :use-module (srfi srfi-88) - :use-module ((vcomponent recurrence) - :select (make-recur-rule)) - :use-module ((vcomponent recurrence generate) - :select (generate-recurrence-set)) - :use-module ((vcomponent recurrence display) - :select (format-recurrence-rule)) - :use-module ((vcomponent recurrence internal) - :select (count until)) - :use-module ((vcomponent base) - :select (prop prop* extract)) - :use-module (vcomponent create) - :use-module ((datetime) - :select (parse-ics-datetime - datetime - datetime-date - time - date - jan feb mar apr may jun jul aug sep oct nov dec - mon tue wed thu fri sat sun - datetime->string)) - :use-module ((hnh util) :select (-> set!)) - :use-module ((srfi srfi-41) :select (stream->list)) - :use-module ((srfi srfi-88) :select (keyword->string))) - -(test-expect-fail "REC: The third instance into the month of one of Tuesday, Wednesday, or Thursday, for the next 3 months") - -(test-expect-fail "STR: The third instance into the month of one of Tuesday, Wednesday, or Thursday, for the next 3 months") - -(test-expect-fail "REC: The second-to-last weekday of the month") - -(test-expect-fail "STR: The second-to-last weekday of the month") - -;; TODO this test is really slow, figure out why (takes approx. 25s to run) -(test-skip "REC: Every day in January, for 3 years (alt 2)") - -(define (run-test comp) - (test-equal - (string-append "REC: " (prop comp 'SUMMARY)) - (prop comp 'X-SET) - (let ((r (generate-recurrence-set comp))) - (map (extract 'DTSTART) - (if (or (until (prop comp 'RRULE)) - (count (prop comp 'RRULE))) - (stream->list r) - (stream->list 20 r))))) - (test-equal - (string-append "STR: " (prop comp 'SUMMARY)) - (prop comp 'X-SUMMARY) - ;; TODO setting language='en causes messages to be in english, but date - ;; strings still format LC_TIME (which I have set to swedish)... - ;; TODO possibly test with other languages - (format-recurrence-rule (prop comp 'RRULE) 'sv))) - -(map run-test - (list (vevent - summary: - "Daily for 10 occurrences" - dtstart: - #1997-09-02T09:00:00 - rrule: - (make-recur-rule - freq: 'DAILY - count: 10) - x-summary: - "dagligen, totalt 10 gånger" - x-set: - (list #1997-09-02T09:00:00 - #1997-09-03T09:00:00 - #1997-09-04T09:00:00 - #1997-09-05T09:00:00 - #1997-09-06T09:00:00 - #1997-09-07T09:00:00 - #1997-09-08T09:00:00 - #1997-09-09T09:00:00 - #1997-09-10T09:00:00 - #1997-09-11T09:00:00)) - (vevent - summary: - "Daily until December 24, 1997" - dtstart: - #1997-09-02T09:00:00 - rrule: - (make-recur-rule - freq: 'DAILY - until: #1997-12-24T00:00:00Z) - x-summary: - "dagligen, till och med den 24 december, 1997 kl. 0:00" - x-set: - (list #1997-09-02T09:00:00 - #1997-09-03T09:00:00 - #1997-09-04T09:00:00 - #1997-09-05T09:00:00 - #1997-09-06T09:00:00 - #1997-09-07T09:00:00 - #1997-09-08T09:00:00 - #1997-09-09T09:00:00 - #1997-09-10T09:00:00 - #1997-09-11T09:00:00 - #1997-09-12T09:00:00 - #1997-09-13T09:00:00 - #1997-09-14T09:00:00 - #1997-09-15T09:00:00 - #1997-09-16T09:00:00 - #1997-09-17T09:00:00 - #1997-09-18T09:00:00 - #1997-09-19T09:00:00 - #1997-09-20T09:00:00 - #1997-09-21T09:00:00 - #1997-09-22T09:00:00 - #1997-09-23T09:00:00 - #1997-09-24T09:00:00 - #1997-09-25T09:00:00 - #1997-09-26T09:00:00 - #1997-09-27T09:00:00 - #1997-09-28T09:00:00 - #1997-09-29T09:00:00 - #1997-09-30T09:00:00 - #1997-10-01T09:00:00 - #1997-10-02T09:00:00 - #1997-10-03T09:00:00 - #1997-10-04T09:00:00 - #1997-10-05T09:00:00 - #1997-10-06T09:00:00 - #1997-10-07T09:00:00 - #1997-10-08T09:00:00 - #1997-10-09T09:00:00 - #1997-10-10T09:00:00 - #1997-10-11T09:00:00 - #1997-10-12T09:00:00 - #1997-10-13T09:00:00 - #1997-10-14T09:00:00 - #1997-10-15T09:00:00 - #1997-10-16T09:00:00 - #1997-10-17T09:00:00 - #1997-10-18T09:00:00 - #1997-10-19T09:00:00 - #1997-10-20T09:00:00 - #1997-10-21T09:00:00 - #1997-10-22T09:00:00 - #1997-10-23T09:00:00 - #1997-10-24T09:00:00 - #1997-10-25T09:00:00 - #1997-10-26T09:00:00 - #1997-10-27T09:00:00 - #1997-10-28T09:00:00 - #1997-10-29T09:00:00 - #1997-10-30T09:00:00 - #1997-10-31T09:00:00 - #1997-11-01T09:00:00 - #1997-11-02T09:00:00 - #1997-11-03T09:00:00 - #1997-11-04T09:00:00 - #1997-11-05T09:00:00 - #1997-11-06T09:00:00 - #1997-11-07T09:00:00 - #1997-11-08T09:00:00 - #1997-11-09T09:00:00 - #1997-11-10T09:00:00 - #1997-11-11T09:00:00 - #1997-11-12T09:00:00 - #1997-11-13T09:00:00 - #1997-11-14T09:00:00 - #1997-11-15T09:00:00 - #1997-11-16T09:00:00 - #1997-11-17T09:00:00 - #1997-11-18T09:00:00 - #1997-11-19T09:00:00 - #1997-11-20T09:00:00 - #1997-11-21T09:00:00 - #1997-11-22T09:00:00 - #1997-11-23T09:00:00 - #1997-11-24T09:00:00 - #1997-11-25T09:00:00 - #1997-11-26T09:00:00 - #1997-11-27T09:00:00 - #1997-11-28T09:00:00 - #1997-11-29T09:00:00 - #1997-11-30T09:00:00 - #1997-12-01T09:00:00 - #1997-12-02T09:00:00 - #1997-12-03T09:00:00 - #1997-12-04T09:00:00 - #1997-12-05T09:00:00 - #1997-12-06T09:00:00 - #1997-12-07T09:00:00 - #1997-12-08T09:00:00 - #1997-12-09T09:00:00 - #1997-12-10T09:00:00 - #1997-12-11T09:00:00 - #1997-12-12T09:00:00 - #1997-12-13T09:00:00 - #1997-12-14T09:00:00 - #1997-12-15T09:00:00 - #1997-12-16T09:00:00 - #1997-12-17T09:00:00 - #1997-12-18T09:00:00 - #1997-12-19T09:00:00 - #1997-12-20T09:00:00 - #1997-12-21T09:00:00 - #1997-12-22T09:00:00 - #1997-12-23T09:00:00)) - (vevent - summary: - "Every other day - forever" - dtstart: - #1997-09-02T09:00:00 - rrule: - (make-recur-rule - freq: 'DAILY - interval: 2) - x-summary: - "varannan dag" - x-set: - (list #1997-09-02T09:00:00 - #1997-09-04T09:00:00 - #1997-09-06T09:00:00 - #1997-09-08T09:00:00 - #1997-09-10T09:00:00 - #1997-09-12T09:00:00 - #1997-09-14T09:00:00 - #1997-09-16T09:00:00 - #1997-09-18T09:00:00 - #1997-09-20T09:00:00 - #1997-09-22T09:00:00 - #1997-09-24T09:00:00 - #1997-09-26T09:00:00 - #1997-09-28T09:00:00 - #1997-09-30T09:00:00 - #1997-10-02T09:00:00 - #1997-10-04T09:00:00 - #1997-10-06T09:00:00 - #1997-10-08T09:00:00 - #1997-10-10T09:00:00)) - (vevent - summary: - "Every 10 days, 5 occurrences" - dtstart: - #1997-09-02T09:00:00 - rrule: - (make-recur-rule - freq: 'DAILY - interval: 10 - count: 5) - x-summary: - "var tionde dag, totalt 5 gånger" - x-set: - (list #1997-09-02T09:00:00 - #1997-09-12T09:00:00 - #1997-09-22T09:00:00 - #1997-10-02T09:00:00 - #1997-10-12T09:00:00)) - (vevent - summary: - "Every day in January, for 3 years (alt 1)" - dtstart: - #1998-01-01T09:00:00 - rrule: - (make-recur-rule - freq: 'YEARLY - until: #2000-01-31T14:00:00Z - bymonth: (list jan) - byday: (list sun mon tue wed thu fri sat)) - x-summary: - "varje lördag, fredag, torsdag, onsdag, tisdag, måndag & söndag i januari, årligen, till och med den 31 januari, 2000 kl. 14:00" - x-set: - (list #1998-01-01T09:00:00 - #1998-01-02T09:00:00 - #1998-01-03T09:00:00 - #1998-01-04T09:00:00 - #1998-01-05T09:00:00 - #1998-01-06T09:00:00 - #1998-01-07T09:00:00 - #1998-01-08T09:00:00 - #1998-01-09T09:00:00 - #1998-01-10T09:00:00 - #1998-01-11T09:00:00 - #1998-01-12T09:00:00 - #1998-01-13T09:00:00 - #1998-01-14T09:00:00 - #1998-01-15T09:00:00 - #1998-01-16T09:00:00 - #1998-01-17T09:00:00 - #1998-01-18T09:00:00 - #1998-01-19T09:00:00 - #1998-01-20T09:00:00 - #1998-01-21T09:00:00 - #1998-01-22T09:00:00 - #1998-01-23T09:00:00 - #1998-01-24T09:00:00 - #1998-01-25T09:00:00 - #1998-01-26T09:00:00 - #1998-01-27T09:00:00 - #1998-01-28T09:00:00 - #1998-01-29T09:00:00 - #1998-01-30T09:00:00 - #1998-01-31T09:00:00 - #1999-01-01T09:00:00 - #1999-01-02T09:00:00 - #1999-01-03T09:00:00 - #1999-01-04T09:00:00 - #1999-01-05T09:00:00 - #1999-01-06T09:00:00 - #1999-01-07T09:00:00 - #1999-01-08T09:00:00 - #1999-01-09T09:00:00 - #1999-01-10T09:00:00 - #1999-01-11T09:00:00 - #1999-01-12T09:00:00 - #1999-01-13T09:00:00 - #1999-01-14T09:00:00 - #1999-01-15T09:00:00 - #1999-01-16T09:00:00 - #1999-01-17T09:00:00 - #1999-01-18T09:00:00 - #1999-01-19T09:00:00 - #1999-01-20T09:00:00 - #1999-01-21T09:00:00 - #1999-01-22T09:00:00 - #1999-01-23T09:00:00 - #1999-01-24T09:00:00 - #1999-01-25T09:00:00 - #1999-01-26T09:00:00 - #1999-01-27T09:00:00 - #1999-01-28T09:00:00 - #1999-01-29T09:00:00 - #1999-01-30T09:00:00 - #1999-01-31T09:00:00 - #2000-01-01T09:00:00 - #2000-01-02T09:00:00 - #2000-01-03T09:00:00 - #2000-01-04T09:00:00 - #2000-01-05T09:00:00 - #2000-01-06T09:00:00 - #2000-01-07T09:00:00 - #2000-01-08T09:00:00 - #2000-01-09T09:00:00 - #2000-01-10T09:00:00 - #2000-01-11T09:00:00 - #2000-01-12T09:00:00 - #2000-01-13T09:00:00 - #2000-01-14T09:00:00 - #2000-01-15T09:00:00 - #2000-01-16T09:00:00 - #2000-01-17T09:00:00 - #2000-01-18T09:00:00 - #2000-01-19T09:00:00 - #2000-01-20T09:00:00 - #2000-01-21T09:00:00 - #2000-01-22T09:00:00 - #2000-01-23T09:00:00 - #2000-01-24T09:00:00 - #2000-01-25T09:00:00 - #2000-01-26T09:00:00 - #2000-01-27T09:00:00 - #2000-01-28T09:00:00 - #2000-01-29T09:00:00 - #2000-01-30T09:00:00 - #2000-01-31T09:00:00)) - (vevent - summary: - "Every day in January, for 3 years (alt 2)" - dtstart: - #1998-01-01T09:00:00 - rrule: - (make-recur-rule - freq: 'DAILY - until: #2000-01-31T14:00:00Z - bymonth: 1) - x-summary: - "dagligen, till och med den 31 januari, 2000 kl. 14:00" - x-set: - (list #1998-01-01T09:00:00 - #1998-01-02T09:00:00 - #1998-01-03T09:00:00 - #1998-01-04T09:00:00 - #1998-01-05T09:00:00 - #1998-01-06T09:00:00 - #1998-01-07T09:00:00 - #1998-01-08T09:00:00 - #1998-01-09T09:00:00 - #1998-01-10T09:00:00 - #1998-01-11T09:00:00 - #1998-01-12T09:00:00 - #1998-01-13T09:00:00 - #1998-01-14T09:00:00 - #1998-01-15T09:00:00 - #1998-01-16T09:00:00 - #1998-01-17T09:00:00 - #1998-01-18T09:00:00 - #1998-01-19T09:00:00 - #1998-01-20T09:00:00 - #1998-01-21T09:00:00 - #1998-01-22T09:00:00 - #1998-01-23T09:00:00 - #1998-01-24T09:00:00 - #1998-01-25T09:00:00 - #1998-01-26T09:00:00 - #1998-01-27T09:00:00 - #1998-01-28T09:00:00 - #1998-01-29T09:00:00 - #1998-01-30T09:00:00 - #1998-01-31T09:00:00 - #1999-01-01T09:00:00 - #1999-01-02T09:00:00 - #1999-01-03T09:00:00 - #1999-01-04T09:00:00 - #1999-01-05T09:00:00 - #1999-01-06T09:00:00 - #1999-01-07T09:00:00 - #1999-01-08T09:00:00 - #1999-01-09T09:00:00 - #1999-01-10T09:00:00 - #1999-01-11T09:00:00 - #1999-01-12T09:00:00 - #1999-01-13T09:00:00 - #1999-01-14T09:00:00 - #1999-01-15T09:00:00 - #1999-01-16T09:00:00 - #1999-01-17T09:00:00 - #1999-01-18T09:00:00 - #1999-01-19T09:00:00 - #1999-01-20T09:00:00 - #1999-01-21T09:00:00 - #1999-01-22T09:00:00 - #1999-01-23T09:00:00 - #1999-01-24T09:00:00 - #1999-01-25T09:00:00 - #1999-01-26T09:00:00 - #1999-01-27T09:00:00 - #1999-01-28T09:00:00 - #1999-01-29T09:00:00 - #1999-01-30T09:00:00 - #1999-01-31T09:00:00 - #2000-01-01T09:00:00 - #2000-01-02T09:00:00 - #2000-01-03T09:00:00 - #2000-01-04T09:00:00 - #2000-01-05T09:00:00 - #2000-01-06T09:00:00 - #2000-01-07T09:00:00 - #2000-01-08T09:00:00 - #2000-01-09T09:00:00 - #2000-01-10T09:00:00 - #2000-01-11T09:00:00 - #2000-01-12T09:00:00 - #2000-01-13T09:00:00 - #2000-01-14T09:00:00 - #2000-01-15T09:00:00 - #2000-01-16T09:00:00 - #2000-01-17T09:00:00 - #2000-01-18T09:00:00 - #2000-01-19T09:00:00 - #2000-01-20T09:00:00 - #2000-01-21T09:00:00 - #2000-01-22T09:00:00 - #2000-01-23T09:00:00 - #2000-01-24T09:00:00 - #2000-01-25T09:00:00 - #2000-01-26T09:00:00 - #2000-01-27T09:00:00 - #2000-01-28T09:00:00 - #2000-01-29T09:00:00 - #2000-01-30T09:00:00 - #2000-01-31T09:00:00)) - (vevent - summary: - "Weekly for 10 occurrences" - dtstart: - #1997-09-02T09:00:00 - rrule: - (make-recur-rule - freq: 'WEEKLY - count: 10) - x-summary: - "varje vecka, totalt 10 gånger" - x-set: - (list #1997-09-02T09:00:00 - #1997-09-09T09:00:00 - #1997-09-16T09:00:00 - #1997-09-23T09:00:00 - #1997-09-30T09:00:00 - #1997-10-07T09:00:00 - #1997-10-14T09:00:00 - #1997-10-21T09:00:00 - #1997-10-28T09:00:00 - #1997-11-04T09:00:00)) - (vevent - summary: - "Weekly until December 24, 1997" - dtstart: - #1997-09-02T09:00:00 - rrule: - (make-recur-rule - freq: 'WEEKLY - until: #1997-12-24T00:00:00Z) - x-summary: - "varje vecka, till och med den 24 december, 1997 kl. 0:00" - x-set: - (list #1997-09-02T09:00:00 - #1997-09-09T09:00:00 - #1997-09-16T09:00:00 - #1997-09-23T09:00:00 - #1997-09-30T09:00:00 - #1997-10-07T09:00:00 - #1997-10-14T09:00:00 - #1997-10-21T09:00:00 - #1997-10-28T09:00:00 - #1997-11-04T09:00:00 - #1997-11-11T09:00:00 - #1997-11-18T09:00:00 - #1997-11-25T09:00:00 - #1997-12-02T09:00:00 - #1997-12-09T09:00:00 - #1997-12-16T09:00:00 - #1997-12-23T09:00:00)) - (vevent - summary: - "Every other week - forever" - dtstart: - #1997-09-02T09:00:00 - rrule: - (make-recur-rule - freq: 'WEEKLY - interval: 2 - wkst: sun) - x-summary: - "varannan vecka" - x-set: - (list #1997-09-02T09:00:00 - #1997-09-16T09:00:00 - #1997-09-30T09:00:00 - #1997-10-14T09:00:00 - #1997-10-28T09:00:00 - #1997-11-11T09:00:00 - #1997-11-25T09:00:00 - #1997-12-09T09:00:00 - #1997-12-23T09:00:00 - #1998-01-06T09:00:00 - #1998-01-20T09:00:00 - #1998-02-03T09:00:00 - #1998-02-17T09:00:00 - #1998-03-03T09:00:00 - #1998-03-17T09:00:00 - #1998-03-31T09:00:00 - #1998-04-14T09:00:00 - #1998-04-28T09:00:00 - #1998-05-12T09:00:00 - #1998-05-26T09:00:00)) - (vevent - summary: - "Weekly on Tuesday and Thursday for five weeks (alt 1)" - dtstart: - #1997-09-02T09:00:00 - rrule: - (make-recur-rule - freq: 'WEEKLY - until: #1997-10-07T00:00:00Z - wkst: sun - byday: (list tue thu)) - x-summary: - "varje tisdag & torsdag, till och med den 07 oktober, 1997 kl. 0:00" - x-set: - (list #1997-09-02T09:00:00 - #1997-09-04T09:00:00 - #1997-09-09T09:00:00 - #1997-09-11T09:00:00 - #1997-09-16T09:00:00 - #1997-09-18T09:00:00 - #1997-09-23T09:00:00 - #1997-09-25T09:00:00 - #1997-09-30T09:00:00 - #1997-10-02T09:00:00)) - (vevent - summary: - "Weekly on Tuesday and Thursday for five weeks (alt 2)" - dtstart: - #1997-09-02T09:00:00 - rrule: - (make-recur-rule - freq: 'WEEKLY - count: 10 - wkst: sun - byday: (list tue thu)) - x-summary: - "varje tisdag & torsdag, totalt 10 gånger" - x-set: - (list #1997-09-02T09:00:00 - #1997-09-04T09:00:00 - #1997-09-09T09:00:00 - #1997-09-11T09:00:00 - #1997-09-16T09:00:00 - #1997-09-18T09:00:00 - #1997-09-23T09:00:00 - #1997-09-25T09:00:00 - #1997-09-30T09:00:00 - #1997-10-02T09:00:00)) - (vevent - summary: - "Every other week on Monday, Wednesday, and Friday until December 24, 1997, starting on Monday, September 1, 1997:" - dtstart: - #1997-09-01T09:00:00 - rrule: - (make-recur-rule - freq: 'WEEKLY - interval: 2 - until: #1997-12-24T00:00:00Z - wkst: sun - byday: (list mon wed fri)) - x-summary: - "varannan måndag, onsdag & fredag, till och med den 24 december, 1997 kl. 0:00" - x-set: - (list #1997-09-01T09:00:00 - #1997-09-03T09:00:00 - #1997-09-05T09:00:00 - #1997-09-15T09:00:00 - #1997-09-17T09:00:00 - #1997-09-19T09:00:00 - #1997-09-29T09:00:00 - #1997-10-01T09:00:00 - #1997-10-03T09:00:00 - #1997-10-13T09:00:00 - #1997-10-15T09:00:00 - #1997-10-17T09:00:00 - #1997-10-27T09:00:00 - #1997-10-29T09:00:00 - #1997-10-31T09:00:00 - #1997-11-10T09:00:00 - #1997-11-12T09:00:00 - #1997-11-14T09:00:00 - #1997-11-24T09:00:00 - #1997-11-26T09:00:00 - #1997-11-28T09:00:00 - #1997-12-08T09:00:00 - #1997-12-10T09:00:00 - #1997-12-12T09:00:00 - #1997-12-22T09:00:00)) - (vevent - summary: - "Every other week on Tuesday and Thursday, for 8 occurrences" - dtstart: - #1997-09-02T09:00:00 - rrule: - (make-recur-rule - freq: 'WEEKLY - interval: 2 - count: 8 - wkst: sun - byday: (list tue thu)) - x-summary: - "varannan tisdag & torsdag, totalt 8 gånger" - x-set: - (list #1997-09-02T09:00:00 - #1997-09-04T09:00:00 - #1997-09-16T09:00:00 - #1997-09-18T09:00:00 - #1997-09-30T09:00:00 - #1997-10-02T09:00:00 - #1997-10-14T09:00:00 - #1997-10-16T09:00:00)) - (vevent - summary: - "Monthly on the first Friday for 10 occurrences" - dtstart: - #1997-09-05T09:00:00 - rrule: - (make-recur-rule - freq: 'MONTHLY - count: 10 - byday: (list (cons 1 fri))) - x-summary: - "första fredagen varje månad, totalt 10 gånger" - x-set: - (list #1997-09-05T09:00:00 - #1997-10-03T09:00:00 - #1997-11-07T09:00:00 - #1997-12-05T09:00:00 - #1998-01-02T09:00:00 - #1998-02-06T09:00:00 - #1998-03-06T09:00:00 - #1998-04-03T09:00:00 - #1998-05-01T09:00:00 - #1998-06-05T09:00:00)) - (vevent - summary: - "Monthly on the first Friday until December 24, 1997" - dtstart: - #1997-09-05T09:00:00 - rrule: - (make-recur-rule - freq: 'MONTHLY - until: #1997-12-24T00:00:00Z - byday: (list (cons 1 fri))) - x-summary: - "första fredagen varje månad, till och med den 24 december, 1997 kl. 0:00" - x-set: - (list #1997-09-05T09:00:00 - #1997-10-03T09:00:00 - #1997-11-07T09:00:00 - #1997-12-05T09:00:00)) - (vevent - summary: - "Every other month on the first and last Sunday of the month for 10 occurrences" - dtstart: - #1997-09-07T09:00:00 - rrule: - (make-recur-rule - freq: 'MONTHLY - interval: 2 - count: 10 - byday: (list (cons 1 sun) - (cons -1 sun))) - x-summary: - "första söndagen samt sista söndagen varannan månad, totalt 10 gånger" - x-set: - (list #1997-09-07T09:00:00 - #1997-09-28T09:00:00 - #1997-11-02T09:00:00 - #1997-11-30T09:00:00 - #1998-01-04T09:00:00 - #1998-01-25T09:00:00 - #1998-03-01T09:00:00 - #1998-03-29T09:00:00 - #1998-05-03T09:00:00 - #1998-05-31T09:00:00)) - (vevent - summary: - "Monthly on the second-to-last Monday of the month for 6 months" - dtstart: - #1997-09-22T09:00:00 - rrule: - (make-recur-rule - freq: 'MONTHLY - count: 6 - byday: (list (cons -2 mon))) - x-summary: - "näst sista måndagen varje månad, totalt 6 gånger" - x-set: - (list #1997-09-22T09:00:00 - #1997-10-20T09:00:00 - #1997-11-17T09:00:00 - #1997-12-22T09:00:00 - #1998-01-19T09:00:00 - #1998-02-16T09:00:00)) - (vevent - summary: - "Monthly on the third-to-the-last day of the month, forever" - dtstart: - #1997-09-28T09:00:00 - rrule: - (make-recur-rule - freq: 'MONTHLY - bymonthday: (list -3)) - x-summary: - "den tredje sista varje månad" - x-set: - (list #1997-09-28T09:00:00 - #1997-10-29T09:00:00 - #1997-11-28T09:00:00 - #1997-12-29T09:00:00 - #1998-01-29T09:00:00 - #1998-02-26T09:00:00 - #1998-03-29T09:00:00 - #1998-04-28T09:00:00 - #1998-05-29T09:00:00 - #1998-06-28T09:00:00 - #1998-07-29T09:00:00 - #1998-08-29T09:00:00 - #1998-09-28T09:00:00 - #1998-10-29T09:00:00 - #1998-11-28T09:00:00 - #1998-12-29T09:00:00 - #1999-01-29T09:00:00 - #1999-02-26T09:00:00 - #1999-03-29T09:00:00 - #1999-04-28T09:00:00)) - (vevent - summary: - "Monthly on the 2nd and 15th of the month for 10 occurrences" - dtstart: - #1997-09-02T09:00:00 - rrule: - (make-recur-rule - freq: 'MONTHLY - count: 10 - bymonthday: (list 2 15)) - x-summary: - "den andre & femtonde varje månad, totalt 10 gånger" - x-set: - (list #1997-09-02T09:00:00 - #1997-09-15T09:00:00 - #1997-10-02T09:00:00 - #1997-10-15T09:00:00 - #1997-11-02T09:00:00 - #1997-11-15T09:00:00 - #1997-12-02T09:00:00 - #1997-12-15T09:00:00 - #1998-01-02T09:00:00 - #1998-01-15T09:00:00)) - (vevent - summary: - "Monthly on the first and last day of the month for 10 occurrences" - dtstart: - #1997-09-30T09:00:00 - rrule: - (make-recur-rule - freq: 'MONTHLY - count: 10 - bymonthday: (list 1 -1)) - x-summary: - "den förste & sista varje månad, totalt 10 gånger" - x-set: - (list #1997-09-30T09:00:00 - #1997-10-01T09:00:00 - #1997-10-31T09:00:00 - #1997-11-01T09:00:00 - #1997-11-30T09:00:00 - #1997-12-01T09:00:00 - #1997-12-31T09:00:00 - #1998-01-01T09:00:00 - #1998-01-31T09:00:00 - #1998-03-01T09:00:00)) - (vevent - summary: - "Every 18 months on the 10th thru 15th of the month for 10 occurrences" - dtstart: - #1997-09-10T09:00:00 - rrule: - (make-recur-rule - freq: 'MONTHLY - interval: 18 - count: 10 - bymonthday: (list 10 11 12 13 14 15)) - x-summary: - "den tionde, elfte, tolfte, trettonde, fjortonde & femtonde var artonde månad, totalt 10 gånger" - x-set: - (list #1997-09-10T09:00:00 - #1997-09-11T09:00:00 - #1997-09-12T09:00:00 - #1997-09-13T09:00:00 - #1997-09-14T09:00:00 - #1997-09-15T09:00:00 - #1999-03-10T09:00:00 - #1999-03-11T09:00:00 - #1999-03-12T09:00:00 - #1999-03-13T09:00:00)) - (vevent - summary: - "Every Tuesday, every other month" - dtstart: - #1997-09-02T09:00:00 - rrule: - (make-recur-rule - freq: 'MONTHLY - interval: 2 - byday: (list tue)) - x-summary: - "varje tisdag varannan månad" - x-set: - (list #1997-09-02T09:00:00 - #1997-09-09T09:00:00 - #1997-09-16T09:00:00 - #1997-09-23T09:00:00 - #1997-09-30T09:00:00 - #1997-11-04T09:00:00 - #1997-11-11T09:00:00 - #1997-11-18T09:00:00 - #1997-11-25T09:00:00 - #1998-01-06T09:00:00 - #1998-01-13T09:00:00 - #1998-01-20T09:00:00 - #1998-01-27T09:00:00 - #1998-03-03T09:00:00 - #1998-03-10T09:00:00 - #1998-03-17T09:00:00 - #1998-03-24T09:00:00 - #1998-03-31T09:00:00 - #1998-05-05T09:00:00 - #1998-05-12T09:00:00)) - (vevent - summary: - "Yearly in June and July for 10 occurrences:\n: Since none of the BYDAY, BYMONTHDAY, or BYYEARDAY\nonents are specified, the day is gotten from \"DTSTART\"" - dtstart: - #1997-06-10T09:00:00 - rrule: - (make-recur-rule - freq: 'YEARLY - count: 10 - bymonth: (list 6 7)) - x-summary: - "juni & juli, årligen, totalt 10 gånger" - x-set: - (list #1997-06-10T09:00:00 - #1997-07-10T09:00:00 - #1998-06-10T09:00:00 - #1998-07-10T09:00:00 - #1999-06-10T09:00:00 - #1999-07-10T09:00:00 - #2000-06-10T09:00:00 - #2000-07-10T09:00:00 - #2001-06-10T09:00:00 - #2001-07-10T09:00:00)) - (vevent - summary: - "Every other year on January, February, and March for 10 occurrences" - dtstart: - #1997-03-10T09:00:00 - rrule: - (make-recur-rule - freq: 'YEARLY - interval: 2 - count: 10 - bymonth: (list jan feb mar)) - x-summary: - "januari, februari & mars vartannat år, totalt 10 gånger" - x-set: - (list #1997-03-10T09:00:00 - #1999-01-10T09:00:00 - #1999-02-10T09:00:00 - #1999-03-10T09:00:00 - #2001-01-10T09:00:00 - #2001-02-10T09:00:00 - #2001-03-10T09:00:00 - #2003-01-10T09:00:00 - #2003-02-10T09:00:00 - #2003-03-10T09:00:00)) - (vevent - summary: - "Every third year on the 1st, 100th, and 200th day for 10 occurrences" - dtstart: - #1997-01-01T09:00:00 - rrule: - (make-recur-rule - freq: 'YEARLY - interval: 3 - count: 10 - byyearday: (list 1 100 200)) - x-summary: - "dag 1, 100 & 200 vart tredje år, totalt 10 gånger" - x-set: - (list #1997-01-01T09:00:00 - #1997-04-10T09:00:00 - #1997-07-19T09:00:00 - #2000-01-01T09:00:00 - #2000-04-09T09:00:00 - #2000-07-18T09:00:00 - #2003-01-01T09:00:00 - #2003-04-10T09:00:00 - #2003-07-19T09:00:00 - #2006-01-01T09:00:00)) - (vevent - summary: - "Every 20th Monday of the year, forever" - dtstart: - #1997-05-19T09:00:00 - rrule: - (make-recur-rule - freq: 'YEARLY - byday: (list (cons 20 mon))) - x-summary: - "tjugonde måndagen, årligen" - x-set: - (list #1997-05-19T09:00:00 - #1998-05-18T09:00:00 - #1999-05-17T09:00:00 - #2000-05-15T09:00:00 - #2001-05-14T09:00:00 - #2002-05-20T09:00:00 - #2003-05-19T09:00:00 - #2004-05-17T09:00:00 - #2005-05-16T09:00:00 - #2006-05-15T09:00:00 - #2007-05-14T09:00:00 - #2008-05-19T09:00:00 - #2009-05-18T09:00:00 - #2010-05-17T09:00:00 - #2011-05-16T09:00:00 - #2012-05-14T09:00:00 - #2013-05-20T09:00:00 - #2014-05-19T09:00:00 - #2015-05-18T09:00:00 - #2016-05-16T09:00:00)) - (vevent - summary: - "Monday of week number 20 (where the default start of the week is Monday), forever" - dtstart: - #1997-05-12T09:00:00 - rrule: - (make-recur-rule - freq: 'YEARLY - byweekno: (list 20) - byday: (list mon)) - x-summary: - "varje måndag v.20, årligen" - x-set: - (list #1997-05-12T09:00:00 - #1998-05-11T09:00:00 - #1999-05-17T09:00:00 - #2000-05-15T09:00:00 - #2001-05-14T09:00:00 - #2002-05-13T09:00:00 - #2003-05-12T09:00:00 - #2004-05-10T09:00:00 - #2005-05-16T09:00:00 - #2006-05-15T09:00:00 - #2007-05-14T09:00:00 - #2008-05-12T09:00:00 - #2009-05-11T09:00:00 - #2010-05-17T09:00:00 - #2011-05-16T09:00:00 - #2012-05-14T09:00:00 - #2013-05-13T09:00:00 - #2014-05-12T09:00:00 - #2015-05-11T09:00:00 - #2016-05-16T09:00:00)) - (vevent - summary: - "Every Thursday in March, forever" - dtstart: - #1997-03-13T09:00:00 - rrule: - (make-recur-rule - freq: 'YEARLY - bymonth: (list mar) - byday: (list thu)) - x-summary: - "varje torsdag i mars, årligen" - x-set: - (list #1997-03-13T09:00:00 - #1997-03-20T09:00:00 - #1997-03-27T09:00:00 - #1998-03-05T09:00:00 - #1998-03-12T09:00:00 - #1998-03-19T09:00:00 - #1998-03-26T09:00:00 - #1999-03-04T09:00:00 - #1999-03-11T09:00:00 - #1999-03-18T09:00:00 - #1999-03-25T09:00:00 - #2000-03-02T09:00:00 - #2000-03-09T09:00:00 - #2000-03-16T09:00:00 - #2000-03-23T09:00:00 - #2000-03-30T09:00:00 - #2001-03-01T09:00:00 - #2001-03-08T09:00:00 - #2001-03-15T09:00:00 - #2001-03-22T09:00:00)) - (vevent - summary: - "Every Thursday, but only during June, July, and August, forever" - dtstart: - #1997-06-05T09:00:00 - rrule: - (make-recur-rule - freq: 'YEARLY - byday: (list thu) - bymonth: (list 6 7 8)) - x-summary: - "varje torsdag i juni, juli & augusti, årligen" - x-set: - (list #1997-06-05T09:00:00 - #1997-06-12T09:00:00 - #1997-06-19T09:00:00 - #1997-06-26T09:00:00 - #1997-07-03T09:00:00 - #1997-07-10T09:00:00 - #1997-07-17T09:00:00 - #1997-07-24T09:00:00 - #1997-07-31T09:00:00 - #1997-08-07T09:00:00 - #1997-08-14T09:00:00 - #1997-08-21T09:00:00 - #1997-08-28T09:00:00 - #1998-06-04T09:00:00 - #1998-06-11T09:00:00 - #1998-06-18T09:00:00 - #1998-06-25T09:00:00 - #1998-07-02T09:00:00 - #1998-07-09T09:00:00 - #1998-07-16T09:00:00)) - (vevent - summary: - "Every Friday the 13th, forever" - dtstart: - #1997-09-02T09:00:00 - exdate: - (as-list - (list #1997-09-02T09:00:00)) - rrule: - (make-recur-rule - freq: 'MONTHLY - byday: (list fri) - bymonthday: (list 13)) - x-summary: - "varje fredag den trettonde varje månad" - x-set: - (list #1998-02-13T09:00:00 - #1998-03-13T09:00:00 - #1998-11-13T09:00:00 - #1999-08-13T09:00:00 - #2000-10-13T09:00:00 - #2001-04-13T09:00:00 - #2001-07-13T09:00:00 - #2002-09-13T09:00:00 - #2002-12-13T09:00:00 - #2003-06-13T09:00:00 - #2004-02-13T09:00:00 - #2004-08-13T09:00:00 - #2005-05-13T09:00:00 - #2006-01-13T09:00:00 - #2006-10-13T09:00:00 - #2007-04-13T09:00:00 - #2007-07-13T09:00:00 - #2008-06-13T09:00:00 - #2009-02-13T09:00:00 - #2009-03-13T09:00:00)) - (vevent - summary: - "The first Saturday that follows the first Sunday of the month, forever" - dtstart: - #1997-09-13T09:00:00 - rrule: - (make-recur-rule - freq: 'MONTHLY - byday: (list sat) - bymonthday: (list 7 8 9 10 11 12 13)) - x-summary: - "varje lördag den sjunde, åttonde, nionde, tionde, elfte, tolfte & trettonde varje månad" - x-set: - (list #1997-09-13T09:00:00 - #1997-10-11T09:00:00 - #1997-11-08T09:00:00 - #1997-12-13T09:00:00 - #1998-01-10T09:00:00 - #1998-02-07T09:00:00 - #1998-03-07T09:00:00 - #1998-04-11T09:00:00 - #1998-05-09T09:00:00 - #1998-06-13T09:00:00 - #1998-07-11T09:00:00 - #1998-08-08T09:00:00 - #1998-09-12T09:00:00 - #1998-10-10T09:00:00 - #1998-11-07T09:00:00 - #1998-12-12T09:00:00 - #1999-01-09T09:00:00 - #1999-02-13T09:00:00 - #1999-03-13T09:00:00 - #1999-04-10T09:00:00)) - (vevent - summary: - "Every 4 years, the first Tuesday after a Monday in November,\nver (U.S. Presidential Election day)" - dtstart: - #1996-11-05T09:00:00 - rrule: - (make-recur-rule - freq: 'YEARLY - interval: 4 - bymonth: (list nov) - byday: (list tue) - bymonthday: (list 2 3 4 5 6 7 8)) - x-summary: - "varje tisdag den andre, tredje, fjärde, femte, sjätte, sjunde eller åttonde i november vart fjärde år" - x-set: - (list #1996-11-05T09:00:00 - #2000-11-07T09:00:00 - #2004-11-02T09:00:00 - #2008-11-04T09:00:00 - #2012-11-06T09:00:00 - #2016-11-08T09:00:00 - #2020-11-03T09:00:00 - #2024-11-05T09:00:00 - #2028-11-07T09:00:00 - #2032-11-02T09:00:00 - #2036-11-04T09:00:00 - #2040-11-06T09:00:00 - #2044-11-08T09:00:00 - #2048-11-03T09:00:00 - #2052-11-05T09:00:00 - #2056-11-07T09:00:00 - #2060-11-02T09:00:00 - #2064-11-04T09:00:00 - #2068-11-06T09:00:00 - #2072-11-08T09:00:00)) - (vevent - summary: - "The third instance into the month of one of Tuesday, Wednesday, or Thursday, for the next 3 months" - dtstart: - #1997-09-04T09:00:00 - rrule: - (make-recur-rule - freq: 'MONTHLY - count: 3 - byday: (list tue wed thu) - bysetpos: (list 3)) - x-summary: - "NOT YET IMPLEMENTED" - x-set: - (list #1997-09-04T09:00:00 - #1997-10-07T09:00:00 - #1997-11-06T09:00:00)) - (vevent - summary: - "The second-to-last weekday of the month" - dtstart: - #1997-09-29T09:00:00 - rrule: - (make-recur-rule - freq: 'MONTHLY - byday: (list mon tue wed thu fri) - bysetpos: (list -2)) - x-summary: - "NOT YET IMPLEMENTED" - x-set: - (list #1997-09-29T09:00:00 - #1997-10-30T09:00:00 - #1997-11-27T09:00:00 - #1997-12-30T09:00:00 - #1998-01-29T09:00:00)) - (vevent - summary: - "Every 3 hours from 9:00 AM to 5:00 PM on a specific day" - dtstart: - #1997-09-02T09:00:00 - rrule: - (make-recur-rule - freq: 'HOURLY - interval: 3 - until: #1997-09-02T17:00:00Z) - x-summary: - "var tredje timme, till och med den 02 september, 1997 kl. 17:00" - x-set: - (list #1997-09-02T09:00:00 - #1997-09-02T12:00:00 - #1997-09-02T15:00:00)) - (vevent - summary: - "Every 15 minutes for 6 occurrences" - dtstart: - #1997-09-02T09:00:00 - rrule: - (make-recur-rule - freq: 'MINUTELY - interval: 15 - count: 6) - x-summary: - "varje kvart, totalt 6 gånger" - x-set: - (list #1997-09-02T09:00:00 - #1997-09-02T09:15:00 - #1997-09-02T09:30:00 - #1997-09-02T09:45:00 - #1997-09-02T10:00:00 - #1997-09-02T10:15:00)) - (vevent - summary: - "Every hour and a half for 4 occurrences" - dtstart: - #1997-09-02T09:00:00 - rrule: - (make-recur-rule - freq: 'MINUTELY - interval: 90 - count: 4) - x-summary: - "var sjätte kvart, totalt 4 gånger" - x-set: - (list #1997-09-02T09:00:00 - #1997-09-02T10:30:00 - #1997-09-02T12:00:00 - #1997-09-02T13:30:00)) - (vevent - summary: - "Every 20 minutes from 9:00 AM to 4:40 PM every day (alt 1)" - dtstart: - #1997-09-02T09:00:00 - rrule: - (make-recur-rule - freq: 'DAILY - byhour: (list 9 10 11 12 13 14 15 16) - byminute: (list 0 20 40)) - x-summary: - "dagligen kl. 09:00, 09:20, 09:40, 10:00, 10:20, 10:40, 11:00, 11:20, 11:40, 12:00, 12:20, 12:40, 13:00, 13:20, 13:40, 14:00, 14:20, 14:40, 15:00, 15:20, 15:40, 16:00, 16:20 & 16:40" - x-set: - (list #1997-09-02T09:00:00 - #1997-09-02T09:20:00 - #1997-09-02T09:40:00 - #1997-09-02T10:00:00 - #1997-09-02T10:20:00 - #1997-09-02T10:40:00 - #1997-09-02T11:00:00 - #1997-09-02T11:20:00 - #1997-09-02T11:40:00 - #1997-09-02T12:00:00 - #1997-09-02T12:20:00 - #1997-09-02T12:40:00 - #1997-09-02T13:00:00 - #1997-09-02T13:20:00 - #1997-09-02T13:40:00 - #1997-09-02T14:00:00 - #1997-09-02T14:20:00 - #1997-09-02T14:40:00 - #1997-09-02T15:00:00 - #1997-09-02T15:20:00)) - (vevent - summary: - "Every 20 minutes from 9:00 AM to 4:40 PM every day (alt 2)" - dtstart: - #1997-09-02T09:00:00 - rrule: - (make-recur-rule - freq: 'MINUTELY - interval: 20 - byhour: (list 9 10 11 12 13 14 15 16)) - x-summary: - "var tjugonde minut kl. 9, 10, 11, 12, 13, 14, 15 & 16" - x-set: - (list #1997-09-02T09:00:00 - #1997-09-02T09:20:00 - #1997-09-02T09:40:00 - #1997-09-02T10:00:00 - #1997-09-02T10:20:00 - #1997-09-02T10:40:00 - #1997-09-02T11:00:00 - #1997-09-02T11:20:00 - #1997-09-02T11:40:00 - #1997-09-02T12:00:00 - #1997-09-02T12:20:00 - #1997-09-02T12:40:00 - #1997-09-02T13:00:00 - #1997-09-02T13:20:00 - #1997-09-02T13:40:00 - #1997-09-02T14:00:00 - #1997-09-02T14:20:00 - #1997-09-02T14:40:00 - #1997-09-02T15:00:00 - #1997-09-02T15:20:00)) - (vevent - summary: - "An example where the days generated makes a difference because of WKST" - dtstart: - #1997-08-05T09:00:00 - rrule: - (make-recur-rule - freq: 'WEEKLY - interval: 2 - count: 4 - byday: (list tue sun) - wkst: mon) - x-summary: - "varannan tisdag & söndag, totalt 4 gånger" - x-set: - (list #1997-08-05T09:00:00 - #1997-08-10T09:00:00 - #1997-08-19T09:00:00 - #1997-08-24T09:00:00)) - (vevent - summary: - "changing only WKST from MO to SU, yields different results.." - dtstart: - #1997-08-05T09:00:00 - rrule: - (make-recur-rule - freq: 'WEEKLY - interval: 2 - count: 4 - byday: (list tue sun) - wkst: sun) - x-summary: - "varannan tisdag & söndag, totalt 4 gånger" - x-set: - (list #1997-08-05T09:00:00 - #1997-08-17T09:00:00 - #1997-08-19T09:00:00 - #1997-08-31T09:00:00)) - (vevent - summary: - "An example where an invalid date (i.e., February 30) is ignored" - dtstart: - #2007-01-15T09:00:00 - rrule: - (make-recur-rule - freq: 'MONTHLY - bymonthday: (list 15 30) - count: 5) - x-summary: - "den femtonde & tretionde varje månad, totalt 5 gånger" - x-set: - (list #2007-01-15T09:00:00 - #2007-01-30T09:00:00 - #2007-02-15T09:00:00 - #2007-03-15T09:00:00 - #2007-03-30T09:00:00)) - (vevent - summary: - "Every Friday & Wednesday the 13th, forever" - dtstart: - #1997-09-02T09:00:00 - exdate: - (as-list - (list #1997-09-02T09:00:00)) - rrule: - (make-recur-rule - freq: 'MONTHLY - byday: (list fri wed) - bymonthday: (list 13)) - x-summary: - "varje onsdag & fredag den trettonde varje månad" - x-set: - (list #1998-02-13T09:00:00 - #1998-03-13T09:00:00 - #1998-05-13T09:00:00 - #1998-11-13T09:00:00 - #1999-01-13T09:00:00 - #1999-08-13T09:00:00 - #1999-10-13T09:00:00 - #2000-09-13T09:00:00 - #2000-10-13T09:00:00 - #2000-12-13T09:00:00 - #2001-04-13T09:00:00 - #2001-06-13T09:00:00 - #2001-07-13T09:00:00 - #2002-02-13T09:00:00 - #2002-03-13T09:00:00 - #2002-09-13T09:00:00 - #2002-11-13T09:00:00 - #2002-12-13T09:00:00 - #2003-06-13T09:00:00 - #2003-08-13T09:00:00)) - (vevent - summary: - "Monday & Wednesday of week number 20 (where the default start of the week is Monday), forever" - dtstart: - #1997-05-12T09:00:00 - rrule: - (make-recur-rule - freq: 'YEARLY - byweekno: (list 20) - byday: (list mon wed)) - x-summary: - "varje onsdag & måndag v.20, årligen" - x-set: - (list #1997-05-12T09:00:00 - #1997-05-14T09:00:00 - #1998-05-11T09:00:00 - #1998-05-13T09:00:00 - #1999-05-17T09:00:00 - #1999-05-19T09:00:00 - #2000-05-15T09:00:00 - #2000-05-17T09:00:00 - #2001-05-14T09:00:00 - #2001-05-16T09:00:00 - #2002-05-13T09:00:00 - #2002-05-15T09:00:00 - #2003-05-12T09:00:00 - #2003-05-14T09:00:00 - #2004-05-10T09:00:00 - #2004-05-12T09:00:00 - #2005-05-16T09:00:00 - #2005-05-18T09:00:00 - #2006-05-15T09:00:00 - #2006-05-17T09:00:00)) - (vevent - summary: "Each second, for ever" - dtstart: #2020-10-10T10:00:00 - rrule: (make-recur-rule freq: 'SECONDLY) - x-summary: "varje sekund" - x-set: (list #2020-10-10T10:00:00 - #2020-10-10T10:00:01 - #2020-10-10T10:00:02 - #2020-10-10T10:00:03 - #2020-10-10T10:00:04 - #2020-10-10T10:00:05 - #2020-10-10T10:00:06 - #2020-10-10T10:00:07 - #2020-10-10T10:00:08 - #2020-10-10T10:00:09 - #2020-10-10T10:00:10 - #2020-10-10T10:00:11 - #2020-10-10T10:00:12 - #2020-10-10T10:00:13 - #2020-10-10T10:00:14 - #2020-10-10T10:00:15 - #2020-10-10T10:00:16 - #2020-10-10T10:00:17 - #2020-10-10T10:00:18 - #2020-10-10T10:00:19)) - ;; Exdates are applied after rrule's, meaning that less than count - ;; instances may be present. - (vevent - summary: "Exdates are applied AFTER rrule's" - dtstart: #2022-06-10T10:00:00 - rrule: (make-recur-rule freq: 'DAILY count: 5) - exdate: (as-list (list #2022-06-12T10:00:00)) - x-summary: "dagligen, totalt 5 gånger" - x-set: (list #2022-06-10T10:00:00 - #2022-06-11T10:00:00 - ;; #2022-06-12T10:00:00 ; skipped by exdate - #2022-06-13T10:00:00 - #2022-06-14T10:00:00 - )) - (vevent - summary: "RDATE:s add to the recurrence rule" - dtstart: #2022-06-10T10:00:00 - rrule: (make-recur-rule freq: 'DAILY count: 5) - rdate: (as-list (list #2022-06-20T10:00:00)) - x-summary: "dagligen, totalt 5 gånger" - x-set: (list #2022-06-10T10:00:00 - #2022-06-11T10:00:00 - #2022-06-12T10:00:00 - #2022-06-13T10:00:00 - #2022-06-14T10:00:00 - #2022-06-20T10:00:00 ; added by rdate - ) - ) - (vevent - summary: "RDATE:s add to the recurrence rule" - dtstart: #2022-06-10T10:00:00 - rrule: (make-recur-rule freq: 'DAILY count: 5) - exdate: (as-list (list #2022-06-20T10:00:00)) - rdate: (as-list (list #2022-06-20T10:00:00)) - x-summary: "dagligen, totalt 5 gånger" - x-set: (list #2022-06-10T10:00:00 - #2022-06-11T10:00:00 - #2022-06-12T10:00:00 - #2022-06-13T10:00:00 - #2022-06-14T10:00:00 - ;; #2022-06-20T10:00:00 ; added by rdate, removed by exdate - )) - ;; TODO rdate with different timezone than dtstart - ;; TODO rdate with period - )) - - diff --git a/tests/test/timespec.scm b/tests/test/timespec.scm deleted file mode 100644 index 256c01bf..00000000 --- a/tests/test/timespec.scm +++ /dev/null @@ -1,88 +0,0 @@ -(define-module (test timespec) - :use-module (srfi srfi-64) - :use-module (srfi srfi-88) - :use-module (datetime) - :use-module (datetime timespec)) - -(test-equal "The empty string parses to the empty timespec" - (timespec-zero) (parse-time-spec "")) - -(test-group "timespec-add" - - (test-equal "Zero operands gives 0" - (timespec-zero) (timespec-add)) - - (let ((ts (make-timespec #10:20:30 '- #\z))) - (test-equal "Single operand gives that operand" - ts (timespec-add ts))) - - (test-equal "0 + 0 = 0" - (timespec-zero) (timespec-add (timespec-zero) (timespec-zero))) - - (test-group - "+ -" - (test-equal "Remove a number less than the base" - (make-timespec #10:00:00 '+ #\w) - (timespec-add (make-timespec #10:20:30 '+ #\w) - (make-timespec #00:20:30 '- #\w))) - - (test-equal "Remove a number greater than the base" - (make-timespec #01:00:00 '- #\w) - (timespec-add (make-timespec #10:00:00 '+ #\w) - (make-timespec #11:00:00 '- #\w))) - - (test-equal "x + -x = 0" - (timespec-zero) (timespec-add (make-timespec #10:20:30 '+ #\w) - (make-timespec #10:20:30 '- #\w)))) - - (test-group "- +" - (test-equal "Add a number less than the (negative) base" - (make-timespec #10:00:00 '+ #\w) - (timespec-add (make-timespec #10:20:30 '- #\w) - (make-timespec #00:20:30 '+ #\w))) - - (test-equal "Add a number greater than the (negative) base" - (make-timespec #01:00:00 '- #\w) - (timespec-add (make-timespec #10:00:00 '- #\w) - (make-timespec #11:00:00 '+ #\w))) - - (test-equal "-x + x = 0" - (timespec-zero) (timespec-add (make-timespec #10:20:30 '- #\w) - (make-timespec #10:20:30 '+ #\w)))) - - (test-group "+ +" - (test-equal "x + x = 2x" - (make-timespec #20:41:00 '+ #\w) - (timespec-add (make-timespec #10:20:30 '+ #\w) - (make-timespec #10:20:30 '+ #\w)))) - - (test-group "- -" - (test-equal "-x + -x = -2x" - (make-timespec #20:41:00 '- #\w) - (timespec-add (make-timespec #10:20:30 '- #\w) - (make-timespec #10:20:30 '- #\w)))) - - ;; add more than two timespecs - - ;; add timespecs of differing types - ) - -(test-group "parse-time-spec" - ;; TODO what even is this case? - (test-equal (make-timespec (time) '+ #\g) (parse-time-spec "-g")) - - (test-equal "Parse direct date, with hour minute and second" - (make-timespec #20:00:00 '+ #\w) (parse-time-spec "20:00:00")) - (test-equal "Parse direct date, with hour and minute" - (make-timespec #20:00:00 '+ #\w) (parse-time-spec "20:00")) - (test-equal "Parse direct date, with just hour" - (make-timespec #20:00:00 '+ #\w) (parse-time-spec "20")) - - (test-equal "Parse timespec with letter at end" - (make-timespec #20:00:00 '+ #\g) (parse-time-spec "20:00g")) - - (test-equal "Parse negative timespec" - (make-timespec #20:00:00 '- #\w) (parse-time-spec "-20")) - - (test-equal "Parse negative timespec with letter at end" - (make-timespec #20:00:00 '- #\z) (parse-time-spec "-20z"))) diff --git a/tests/test/translation.scm b/tests/test/translation.scm deleted file mode 100644 index 5fb32ab0..00000000 --- a/tests/test/translation.scm +++ /dev/null @@ -1,15 +0,0 @@ -(define-module (test translation) - :use-module (srfi srfi-64) - :use-module (srfi srfi-88) - :use-module (calp translation) - :use-module (ice-9 i18n)) - -(define sv (make-locale (list LC_CTYPE LC_MESSAGES) "sv_SE.UTF-8")) - -;; empty key should give us translation header -;; this also tests that translations are properly loaded -(test-assert "translations" (string? (translate ""))) - -(test-equal "yes-no yes" 'yes (yes-no-check "y" sv)) -(test-equal "yes-no no" 'no (yes-no-check "n" sv)) -(test-equal "yes-no invalid" #f (yes-no-check "other" sv)) diff --git a/tests/test/cpp.scm b/tests/unit/c/cpp.scm index 9c720fde..43ad0144 100644 --- a/tests/test/cpp.scm +++ b/tests/unit/c/cpp.scm @@ -37,3 +37,5 @@ (test-equal '(+ 2 2 2) (run "2+2+2")) +'((c lex) + (c parse)) diff --git a/tests/test/datetime.scm b/tests/unit/datetime/datetime.scm index f73a0ad2..9f32d4a1 100644 --- a/tests/test/datetime.scm +++ b/tests/unit/datetime/datetime.scm @@ -362,22 +362,22 @@ (test-equal "Datetime->unix-time" - 1656005146 (datetime->unix-time #2022-06-23T17:25:46Z)) + 1656005146 (datetime->unix-time (datetime year: 2022 month: 06 day: 23 hour: 17 minute: 25 second: 46 tz: "UTC"))) (test-equal "Datetime->unix-time before epoch" -62167219200 - (datetime->unix-time #0000-01-01T00:00:00Z)) + (datetime->unix-time (datetime year: 0000 month: 01 day: 01 hour: 00 minute: 00 second: 00 tz: "UTC"))) -(test-equal "unix-time->datetime" #2020-09-13T12:26:40Z +(test-equal "unix-time->datetime" (datetime year: 2020 month: 09 day: 13 hour: 12 minute: 26 second: 40 tz: "UTC") (unix-time->datetime 1600000000)) -(test-equal "unix-time->datetime on epoch" #1970-01-01T00:00:00Z +(test-equal "unix-time->datetime on epoch" (datetime year: 1970 month: 01 day: 01 hour: 00 minute: 00 second: 00 tz: "UTC") (unix-time->datetime 0)) -(test-equal "unix-time->datetime before epoch" #1919-04-20T11:33:20Z +(test-equal "unix-time->datetime before epoch" (datetime year: 1919 month: 04 day: 20 hour: 11 minute: 33 second: 20 tz: "UTC") (unix-time->datetime -1600000000)) -;; (unix-time->datetime (expt 2 31)) ; => #2038-01-19T03:14:08Z -;; (unix-time->datetime (1+ (expt 2 31))) ; => #2038-01-19T03:14:09Z -;; (unix-time->datetime (- (expt 2 31))) ; => #1901-12-13T20:45:52Z +;; (unix-time->datetime (expt 2 31)) ; => (datetime year: 2038 month: 01 day: 19 hour: 03 minute: 14 second: 08 tz: "UTC") +;; (unix-time->datetime (1+ (expt 2 31))) ; => (datetime year: 2038 month: 01 day: 19 hour: 03 minute: 14 second: 09 tz: "UTC") +;; (unix-time->datetime (- (expt 2 31))) ; => (datetime year: 1901 month: 12 day: 13 hour: 20 minute: 45 second: 52 tz: "UTC") (test-assert "Current datetime returns a datetime" @@ -412,50 +412,50 @@ as-datetime (test-equal "365 days in regular year" 365 (days-in-year (date year: 2022))) (test-equal "366 days in leap year" 366 (days-in-year (date year: 2000))) -(test-equal "Start of month" #2020-01-01 (start-of-month #2020-01-15)) -(test-equal "End of month" #2000-02-29 (end-of-month #2000-02-01)) +(test-equal "Start of month" (date year: 2020 month: 01 day: 01) (start-of-month (date year: 2020 month: 01 day: 15))) +(test-equal "End of month" (date year: 2000 month: 02 day: 29) (end-of-month (date year: 2000 month: 02 day: 01))) -(test-equal "Start of year" #2020-01-01 (start-of-year #2020-12-31)) +(test-equal "Start of year" (date year: 2020 month: 01 day: 01) (start-of-year (date year: 2020 month: 12 day: 31))) ;; Note that end-of-year (apparently) doesn't exist (test-group "Date streams" (test-equal "Day stream" - (list #2020-01-01 #2020-01-02 #2020-01-03 #2020-01-04 #2020-01-05) - (stream->list 5 (day-stream #2020-01-01))) + (list (date year: 2020 month: 01 day: 01) (date year: 2020 month: 01 day: 02) (date year: 2020 month: 01 day: 03) (date year: 2020 month: 01 day: 04) (date year: 2020 month: 01 day: 05)) + (stream->list 5 (day-stream (date year: 2020 month: 01 day: 01)))) (test-equal "Week stream" - (list #2020-01-01 #2020-02-01 #2020-03-01 #2020-04-01 #2020-05-01) - (stream->list 5 (month-stream #2020-01-01))) + (list (date year: 2020 month: 01 day: 01) (date year: 2020 month: 02 day: 01) (date year: 2020 month: 03 day: 01) (date year: 2020 month: 04 day: 01) (date year: 2020 month: 05 day: 01)) + (stream->list 5 (month-stream (date year: 2020 month: 01 day: 01)))) (test-equal "Month stream" - (list #2020-01-01 #2020-01-08 #2020-01-15 #2020-01-22 #2020-01-29) - (stream->list 5 (week-stream #2020-01-01)))) + (list (date year: 2020 month: 01 day: 01) (date year: 2020 month: 01 day: 08) (date year: 2020 month: 01 day: 15) (date year: 2020 month: 01 day: 22) (date year: 2020 month: 01 day: 29)) + (stream->list 5 (week-stream (date year: 2020 month: 01 day: 01))))) ;; See time< tests for more context (test-group "Min/max" (test-equal "Time min" - #07:40:50 (time-min #10:20:30 #07:40:50)) + (time hour: 07 minute: 40 second: 50) (time-min (time hour: 10 minute: 20 second: 30) (time hour: 07 minute: 40 second: 50))) (test-equal "Time max" - #10:20:30 (time-max #10:20:30 #07:40:50)) + (time hour: 10 minute: 20 second: 30) (time-max (time hour: 10 minute: 20 second: 30) (time hour: 07 minute: 40 second: 50))) (test-equal "Date min" - #2020-02-02 (date-min #2020-02-02 #2020-03-01)) + (date year: 2020 month: 02 day: 02) (date-min (date year: 2020 month: 02 day: 02) (date year: 2020 month: 03 day: 01))) (test-equal "Date max" - #2020-03-01 (date-max #2020-02-02 #2020-03-01)) + (date year: 2020 month: 03 day: 01) (date-max (date year: 2020 month: 02 day: 02) (date year: 2020 month: 03 day: 01))) (test-equal "Datetime min" - #2020-02-02T10:20:30 (datetime-min #2020-02-02T10:20:30 #2020-03-01T07:40:50)) + (datetime year: 2020 month: 02 day: 02 hour: 10 minute: 20 second: 30) (datetime-min (datetime year: 2020 month: 02 day: 02 hour: 10 minute: 20 second: 30) (datetime year: 2020 month: 03 day: 01 hour: 07 minute: 40 second: 50))) (test-equal "Datetime max" - #2020-03-01T07:40:50 (datetime-max #2020-02-02T10:20:30 #2020-03-01T07:40:50))) + (datetime year: 2020 month: 03 day: 01 hour: 07 minute: 40 second: 50) (datetime-max (datetime year: 2020 month: 02 day: 02 hour: 10 minute: 20 second: 30) (datetime year: 2020 month: 03 day: 01 hour: 07 minute: 40 second: 50)))) -(test-equal "Week day" thu (week-day #2022-06-23)) +(test-equal "Week day" thu (week-day (date year: 2022 month: 06 day: 23))) -(test-equal "week-1-start" #2019-12-30 (week-1-start #2020-01-01 mon)) +(test-equal "week-1-start" (date year: 2019 month: 12 day: 30) (week-1-start (date year: 2020 month: 01 day: 01) mon)) ;; Possibly add case where the end of the year uses next years week numbers -(test-equal "Week number at end of year" 53 (week-number #2008-12-31 sun)) -(test-equal "Week number at start of year" 53 (week-number #2009-01-01 sun)) +(test-equal "Week number at end of year" 53 (week-number (date year: 2008 month: 12 day: 31) sun)) +(test-equal "Week number at start of year" 53 (week-number (date year: 2009 month: 01 day: 01) sun)) -(test-equal #2008-12-28 (date-starting-week 53 (date year: 2008) sun)) -(test-equal #2007-12-30 (date-starting-week 1 (date year: 2008) sun)) +(test-equal (date year: 2008 month: 12 day: 28) (date-starting-week 53 (date year: 2008) sun)) +(test-equal (date year: 2007 month: 12 day: 30) (date-starting-week 1 (date year: 2008) sun)) (test-group "Week day name" (test-equal "Simple" "Saturday" (week-day-name sat locale: en_US)) @@ -473,68 +473,68 @@ as-datetime ;; | | : | | : | || | : | || | : | || | : |s2| ;; | | : | | : | | : | | : : | | (test-assert "End of S1 overlaps start of S2" - (timespan-overlaps? #10:00:00 #12:00:00 - #11:00:00 #13:00:00)) + (timespan-overlaps? (time hour: 10 minute: 00 second: 00) (time hour: 12 minute: 00 second: 00) + (time hour: 11 minute: 00 second: 00) (time hour: 13 minute: 00 second: 00))) (test-assert "Start of S1 overlaps end of S2" - (timespan-overlaps? #11:00:00 #13:00:00 - #10:00:00 #12:00:00)) + (timespan-overlaps? (time hour: 11 minute: 00 second: 00) (time hour: 13 minute: 00 second: 00) + (time hour: 10 minute: 00 second: 00) (time hour: 12 minute: 00 second: 00))) (test-assert "S1 complete encompasses S2" - (timespan-overlaps? #10:00:00 #13:00:00 - #11:00:00 #12:00:00)) + (timespan-overlaps? (time hour: 10 minute: 00 second: 00) (time hour: 13 minute: 00 second: 00) + (time hour: 11 minute: 00 second: 00) (time hour: 12 minute: 00 second: 00))) (test-assert "S2 complete encompasses S1" - (timespan-overlaps? #11:00:00 #12:00:00 - #10:00:00 #13:00:00)) + (timespan-overlaps? (time hour: 11 minute: 00 second: 00) (time hour: 12 minute: 00 second: 00) + (time hour: 10 minute: 00 second: 00) (time hour: 13 minute: 00 second: 00))) (test-assert "S1 is equal to S2" - (timespan-overlaps? #11:00:00 #12:00:00 - #11:00:00 #12:00:00)) + (timespan-overlaps? (time hour: 11 minute: 00 second: 00) (time hour: 12 minute: 00 second: 00) + (time hour: 11 minute: 00 second: 00) (time hour: 12 minute: 00 second: 00))) (test-assert "S1 dosesn't overlap S2" (not - (timespan-overlaps? #10:00:00 #11:00:00 - #12:00:00 #13:00:00))) + (timespan-overlaps? (time hour: 10 minute: 00 second: 00) (time hour: 11 minute: 00 second: 00) + (time hour: 12 minute: 00 second: 00) (time hour: 13 minute: 00 second: 00)))) (test-assert "If the events only share an instant they don't overlap" (not - (timespan-overlaps? #10:00:00 #12:00:00 - #12:00:00 #14:00:00)))) + (timespan-overlaps? (time hour: 10 minute: 00 second: 00) (time hour: 12 minute: 00 second: 00) + (time hour: 12 minute: 00 second: 00) (time hour: 14 minute: 00 second: 00))))) -(test-equal #2022-06-25 (find-first-week-day sat #2022-06-23)) +(test-equal (date year: 2022 month: 06 day: 25) (find-first-week-day sat (date year: 2022 month: 06 day: 23))) (test-group "All weekdays in <>" (test-equal "month, if starting from beginning of month" - (list #2022-06-03 #2022-06-10 #2022-06-17 #2022-06-24) - (all-wday-in-month fri #2022-06-01)) + (list (date year: 2022 month: 06 day: 03) (date year: 2022 month: 06 day: 10) (date year: 2022 month: 06 day: 17) (date year: 2022 month: 06 day: 24)) + (all-wday-in-month fri (date year: 2022 month: 06 day: 01))) (test-equal "month, if starting from the middle" - (list #2022-06-24) - (all-wday-in-month fri #2022-06-23)) + (list (date year: 2022 month: 06 day: 24)) + (all-wday-in-month fri (date year: 2022 month: 06 day: 23))) (test-equal "year, if starting from the beggining" - (list #2022-01-07 #2022-01-14 #2022-01-21 #2022-01-28 #2022-02-04 #2022-02-11 #2022-02-18 #2022-02-25 #2022-03-04 #2022-03-11 #2022-03-18 #2022-03-25 #2022-04-01 #2022-04-08 #2022-04-15 #2022-04-22 #2022-04-29 #2022-05-06 #2022-05-13 #2022-05-20 #2022-05-27 #2022-06-03 #2022-06-10 #2022-06-17 #2022-06-24 #2022-07-01 #2022-07-08 #2022-07-15 #2022-07-22 #2022-07-29 #2022-08-05 #2022-08-12 #2022-08-19 #2022-08-26 #2022-09-02 #2022-09-09 #2022-09-16 #2022-09-23 #2022-09-30 #2022-10-07 #2022-10-14 #2022-10-21 #2022-10-28 #2022-11-04 #2022-11-11 #2022-11-18 #2022-11-25 #2022-12-02 #2022-12-09 #2022-12-16 #2022-12-23 #2022-12-30) - (all-wday-in-year fri #2022-01-01)) + (list (date year: 2022 month: 01 day: 07) (date year: 2022 month: 01 day: 14) (date year: 2022 month: 01 day: 21) (date year: 2022 month: 01 day: 28) (date year: 2022 month: 02 day: 04) (date year: 2022 month: 02 day: 11) (date year: 2022 month: 02 day: 18) (date year: 2022 month: 02 day: 25) (date year: 2022 month: 03 day: 04) (date year: 2022 month: 03 day: 11) (date year: 2022 month: 03 day: 18) (date year: 2022 month: 03 day: 25) (date year: 2022 month: 04 day: 01) (date year: 2022 month: 04 day: 08) (date year: 2022 month: 04 day: 15) (date year: 2022 month: 04 day: 22) (date year: 2022 month: 04 day: 29) (date year: 2022 month: 05 day: 06) (date year: 2022 month: 05 day: 13) (date year: 2022 month: 05 day: 20) (date year: 2022 month: 05 day: 27) (date year: 2022 month: 06 day: 03) (date year: 2022 month: 06 day: 10) (date year: 2022 month: 06 day: 17) (date year: 2022 month: 06 day: 24) (date year: 2022 month: 07 day: 01) (date year: 2022 month: 07 day: 08) (date year: 2022 month: 07 day: 15) (date year: 2022 month: 07 day: 22) (date year: 2022 month: 07 day: 29) (date year: 2022 month: 08 day: 05) (date year: 2022 month: 08 day: 12) (date year: 2022 month: 08 day: 19) (date year: 2022 month: 08 day: 26) (date year: 2022 month: 09 day: 02) (date year: 2022 month: 09 day: 09) (date year: 2022 month: 09 day: 16) (date year: 2022 month: 09 day: 23) (date year: 2022 month: 09 day: 30) (date year: 2022 month: 10 day: 07) (date year: 2022 month: 10 day: 14) (date year: 2022 month: 10 day: 21) (date year: 2022 month: 10 day: 28) (date year: 2022 month: 11 day: 04) (date year: 2022 month: 11 day: 11) (date year: 2022 month: 11 day: 18) (date year: 2022 month: 11 day: 25) (date year: 2022 month: 12 day: 02) (date year: 2022 month: 12 day: 09) (date year: 2022 month: 12 day: 16) (date year: 2022 month: 12 day: 23) (date year: 2022 month: 12 day: 30)) + (all-wday-in-year fri (date year: 2022 month: 01 day: 01))) (test-equal "year, if starting from the middle" - (list #2022-06-03 #2022-06-10 #2022-06-17 #2022-06-24 #2022-07-01 #2022-07-08 #2022-07-15 #2022-07-22 #2022-07-29 #2022-08-05 #2022-08-12 #2022-08-19 #2022-08-26 #2022-09-02 #2022-09-09 #2022-09-16 #2022-09-23 #2022-09-30 #2022-10-07 #2022-10-14 #2022-10-21 #2022-10-28 #2022-11-04 #2022-11-11 #2022-11-18 #2022-11-25 #2022-12-02 #2022-12-09 #2022-12-16 #2022-12-23 #2022-12-30) - (all-wday-in-year fri #2022-06-01))) + (list (date year: 2022 month: 06 day: 03) (date year: 2022 month: 06 day: 10) (date year: 2022 month: 06 day: 17) (date year: 2022 month: 06 day: 24) (date year: 2022 month: 07 day: 01) (date year: 2022 month: 07 day: 08) (date year: 2022 month: 07 day: 15) (date year: 2022 month: 07 day: 22) (date year: 2022 month: 07 day: 29) (date year: 2022 month: 08 day: 05) (date year: 2022 month: 08 day: 12) (date year: 2022 month: 08 day: 19) (date year: 2022 month: 08 day: 26) (date year: 2022 month: 09 day: 02) (date year: 2022 month: 09 day: 09) (date year: 2022 month: 09 day: 16) (date year: 2022 month: 09 day: 23) (date year: 2022 month: 09 day: 30) (date year: 2022 month: 10 day: 07) (date year: 2022 month: 10 day: 14) (date year: 2022 month: 10 day: 21) (date year: 2022 month: 10 day: 28) (date year: 2022 month: 11 day: 04) (date year: 2022 month: 11 day: 11) (date year: 2022 month: 11 day: 18) (date year: 2022 month: 11 day: 25) (date year: 2022 month: 12 day: 02) (date year: 2022 month: 12 day: 09) (date year: 2022 month: 12 day: 16) (date year: 2022 month: 12 day: 23) (date year: 2022 month: 12 day: 30)) + (all-wday-in-year fri (date year: 2022 month: 06 day: 01)))) ;; TODO in-date-range? (test-equal "weekday-list" (list wed thu fri sat sun mon tue) (weekday-list wed)) -(test-equal "start of week" #2022-06-20 (start-of-week #2022-06-23 mon)) -(test-equal "end of week" #2022-06-26 (end-of-week #2022-06-23 mon)) +(test-equal "start of week" (date year: 2022 month: 06 day: 20) (start-of-week (date year: 2022 month: 06 day: 23) mon)) +(test-equal "end of week" (date year: 2022 month: 06 day: 26) (end-of-week (date year: 2022 month: 06 day: 23) mon)) (test-group "month-days" - (call-with-values (lambda () (month-days #2022-06-01 mon)) + (call-with-values (lambda () (month-days (date year: 2022 month: 06 day: 01) mon)) (lambda (before actual after) - (test-equal "before" (list #2022-05-30 #2022-05-31) before) - (test-equal "actual" (stream->list 30 (day-stream #2022-06-01)) actual) - (test-equal "after" (list #2022-07-01 #2022-07-02 #2022-07-03) after)))) + (test-equal "before" (list (date year: 2022 month: 05 day: 30) (date year: 2022 month: 05 day: 31)) before) + (test-equal "actual" (stream->list 30 (day-stream (date year: 2022 month: 06 day: 01))) actual) + (test-equal "after" (list (date year: 2022 month: 07 day: 01) (date year: 2022 month: 07 day: 02) (date year: 2022 month: 07 day: 03)) after)))) (test-group "Days in interval" - (test-equal "Steps from start to end of month" 31 (days-in-interval #2022-01-01 #2022-01-31)) - (test-error "Negative intervals should fail" 'misc-error (days-in-interval #2022-01-01 #2020-01-31))) + (test-equal "Steps from start to end of month" 31 (days-in-interval (date year: 2022 month: 01 day: 01) (date year: 2022 month: 01 day: 31))) + (test-error "Negative intervals should fail" 'misc-error (days-in-interval (date year: 2022 month: 01 day: 01) (date year: 2020 month: 01 day: 31)))) -(test-equal "Year day" 191 (year-day #2020-07-09)) +(test-equal "Year day" 191 (year-day (date year: 2020 month: 07 day: 09))) (test-group "Convertions to decimal time" (test-group "Time->decimal-hour" @@ -550,7 +550,7 @@ in-date-range? (test-error "Can't get length of month without information about which month" 'misc-error (datetime->decimal-hour (datetime month: 1))) (test-equal "Can get length of month if we have a month" - (* 31 24.0) (datetime->decimal-hour (datetime month: 1) #2020-01-01)))) + (* 31 24.0) (datetime->decimal-hour (datetime month: 1) (date year: 2020 month: 01 day: 01))))) ;; TODO date-range @@ -569,20 +569,20 @@ date-range (test-equal "02" (datetime->string (datetime month: 2) "~m")) (test-equal "04" (datetime->string (datetime day: 4) "~d")) (test-equal " 4" (datetime->string (datetime day: 4) "~e")) - (test-equal "1600000000" (datetime->string #2020-09-13T12:26:40Z "~s")) + (test-equal "1600000000" (datetime->string (datetime year: 2020 month: 09 day: 13 hour: 12 minute: 26 second: 40 tz: "UTC") "~s")) - (test-equal "2022-10-20" (datetime->string (datetime date: #2022-10-20) "~1")) - (test-equal "10:20:30" (datetime->string (datetime time: #10:20:30) "~3")) + (test-equal "2022-10-20" (datetime->string (datetime date: (date year: 2022 month: 10 day: 20)) "~1")) + (test-equal "10:20:30" (datetime->string (datetime time: (time hour: 10 minute: 20 second: 30)) "~3")) (test-group "Locale dependant (en_US)" - (test-equal "Saturday" (datetime->string (datetime date: (find-first-week-day sat #2020-01-01)) "~A" en_US)) - (test-equal "Sat" (datetime->string (datetime date: (find-first-week-day sat #2020-01-01)) "~a" en_US)) + (test-equal "Saturday" (datetime->string (datetime date: (find-first-week-day sat (date year: 2020 month: 01 day: 01))) "~A" en_US)) + (test-equal "Sat" (datetime->string (datetime date: (find-first-week-day sat (date year: 2020 month: 01 day: 01))) "~a" en_US)) (test-equal "January" (datetime->string (datetime date: (date month: 1)) "~B" en_US)) (test-equal "Jan" (datetime->string (datetime date: (date month: 1)) "~b" en_US))) (test-group "Locale dependant (sv_SE)" - (test-equal "lördag" (datetime->string (datetime date: (find-first-week-day sat #2020-01-01)) "~A" sv_SE)) - (test-equal "lör" (datetime->string (datetime date: (find-first-week-day sat #2020-01-01)) "~a" sv_SE)) + (test-equal "lördag" (datetime->string (datetime date: (find-first-week-day sat (date year: 2020 month: 01 day: 01))) "~A" sv_SE)) + (test-equal "lör" (datetime->string (datetime date: (find-first-week-day sat (date year: 2020 month: 01 day: 01))) "~a" sv_SE)) (test-equal "januari" (datetime->string (datetime date: (date month: 1)) "~B" sv_SE)) (test-equal "jan" (datetime->string (datetime date: (date month: 1)) "~b" sv_SE))) @@ -593,17 +593,17 @@ date-range (test-equal "Default fomat specifier gives ISO-formatted date" - "2006-01-02T15:04:05" (datetime->string #2006-01-02T15:04:05)) + "2006-01-02T15:04:05" (datetime->string (datetime year: 2006 month: 01 day: 02 hour: 15 minute: 04 second: 05))) (test-group "Invalid specifiers" (test-equal "" (datetime->string (datetime) "~x" allow-unknown?: #t)) (test-error 'misc-error (datetime->string (datetime) "~x"))) (test-group "Print syntax for datatypes" - (test-equal "Date writer" "#2020-01-02" (with-output-to-string (lambda () (write #2020-01-02)))) - (test-equal "Time writer" "#20:30:40" (with-output-to-string (lambda () (write #20:30:40)))) - (test-equal "Datetime writer" "#2020-01-02T20:30:40" (with-output-to-string (lambda () (write #2020-01-02T20:30:40)))) - (test-equal "Datetime writer (with tz)" "#2020-01-02T20:30:40Z" (with-output-to-string (lambda () (write #2020-01-02T20:30:40Z)))))) + (test-equal "Date writer" "#2020-01-02" (with-output-to-string (lambda () (write (date year: 2020 month: 01 day: 02))))) + (test-equal "Time writer" "#20:30:40" (with-output-to-string (lambda () (write (time hour: 20 minute: 30 second: 40))))) + (test-equal "Datetime writer" "#2020-01-02T20:30:40" (with-output-to-string (lambda () (write (datetime year: 2020 month: 01 day: 02 hour: 20 minute: 30 second: 40))))) + (test-equal "Datetime writer (with tz)" "#2020-01-02T20:30:40Z" (with-output-to-string (lambda () (write (datetime year: 2020 month: 01 day: 02 hour: 20 minute: 30 second: 40 tz: "UTC"))))))) ;; Really basic tests, since these are rather thin wrappers (test-equal "date->string" "0000-00-00" (date->string (date))) @@ -616,25 +616,25 @@ date-range (test-assert "Zero dates are all equal" (date=)) (test-assert "A single date is equal to itself" - (date=? #2020-10-20)) + (date=? (date year: 2020 month: 10 day: 20))) (test-assert "Two dates are equal to each other" - (date= #2020-10-20 #2020-10-20)) + (date= (date year: 2020 month: 10 day: 20) (date year: 2020 month: 10 day: 20))) (test-assert "Two dates which are NOT equal to each other" - (not (date= #2020-10-20 #2020-10-21))) + (not (date= (date year: 2020 month: 10 day: 20) (date year: 2020 month: 10 day: 21)))) (test-assert "More than two dates which are all equal" - (date=? #2020-10-20 #2020-10-20 #2020-10-20))) + (date=? (date year: 2020 month: 10 day: 20) (date year: 2020 month: 10 day: 20) (date year: 2020 month: 10 day: 20)))) (test-group "time" (test-assert "Zero times are all equal" (time=)) (test-assert "A single time is equal to itself" - (time=? #20:30:40)) + (time=? (time hour: 20 minute: 30 second: 40))) (test-assert "Two times are equal to each other" - (time= #20:30:40 #20:30:40)) + (time= (time hour: 20 minute: 30 second: 40) (time hour: 20 minute: 30 second: 40))) (test-assert "Two times which are NOT equal to each other" - (not (time= #20:30:40 #10:30:40))) + (not (time= (time hour: 20 minute: 30 second: 40) (time hour: 10 minute: 30 second: 40)))) (test-assert "More than two times which are all equal" - (time=? #20:30:40 #20:30:40 #20:30:40))) + (time=? (time hour: 20 minute: 30 second: 40) (time hour: 20 minute: 30 second: 40) (time hour: 20 minute: 30 second: 40)))) (test-group "Datetime" (test-assert "Zero datetimes \"all\" are equal" @@ -722,30 +722,30 @@ date/-time> date/-time>? date/-time>= date/-time>=? (test-group "Simple cases" (test-group "Days" - (test-equal "Add" #2020-01-06 (date+ #2020-01-01 (date day: 5))) - (test-equal "Remove" #2020-01-01 (date- #2020-01-06 (date day: 5)))) + (test-equal "Add" (date year: 2020 month: 01 day: 06) (date+ (date year: 2020 month: 01 day: 01) (date day: 5))) + (test-equal "Remove" (date year: 2020 month: 01 day: 01) (date- (date year: 2020 month: 01 day: 06) (date day: 5)))) (test-group "Months" - (test-equal "Add" #2020-06-01 (date+ #2020-01-01 (date month: 5))) - (test-equal "Remove" #2020-01-01 (date- #2020-06-01 (date month: 5)))) + (test-equal "Add" (date year: 2020 month: 06 day: 01) (date+ (date year: 2020 month: 01 day: 01) (date month: 5))) + (test-equal "Remove" (date year: 2020 month: 01 day: 01) (date- (date year: 2020 month: 06 day: 01) (date month: 5)))) (test-group "Years" - (test-equal "Add" #2022-01-01 (date+ #2020-01-01 (date year: 2))) - (test-equal "Remove" #2020-01-01 (date- #2022-01-01 (date year: 2))))) + (test-equal "Add" (date year: 2022 month: 01 day: 01) (date+ (date year: 2020 month: 01 day: 01) (date year: 2))) + (test-equal "Remove" (date year: 2020 month: 01 day: 01) (date- (date year: 2022 month: 01 day: 01) (date year: 2))))) (test-group "Many operands" - (test-equal #2021-02-02 - (date+ #2020-01-01 + (test-equal (date year: 2021 month: 02 day: 02) + (date+ (date year: 2020 month: 01 day: 01) (date day: 1) (date month: 1) (date year: 1)))) (test-group "Overflow" ;; Years don't overflow, so no need to test - (test-equal "Day overflow" #2022-02-01 (date+ #2022-01-31 (date day: 1))) - (test-equal "Month overflow" #2023-01-01 (date+ #2022-12-01 (date month: 1))) - (test-equal "Date+Month overflow" #2023-01-01 (date+ #2022-12-31 (date day: 1)))) + (test-equal "Day overflow" (date year: 2022 month: 02 day: 01) (date+ (date year: 2022 month: 01 day: 31) (date day: 1))) + (test-equal "Month overflow" (date year: 2023 month: 01 day: 01) (date+ (date year: 2022 month: 12 day: 01) (date month: 1))) + (test-equal "Date+Month overflow" (date year: 2023 month: 01 day: 01) (date+ (date year: 2022 month: 12 day: 31) (date day: 1)))) ;; NOTE - (test-equal #2020-02-31 (date+ #2020-01-31 (date month: 1))) + (test-equal (date year: 2020 month: 02 day: 31) (date+ (date year: 2020 month: 01 day: 31) (date month: 1))) ) (test-group "Time" @@ -755,31 +755,31 @@ date/-time> date/-time>? date/-time>= date/-time>=? (test-group "Simple cases" (test-group "Seconds" - (test-equal "Add" #20:00:40 (time+ #20:00:00 (time second: 40))) - (test-equal "Remove" #20:00:00 (time- #20:00:40 (time second: 40)))) + (test-equal "Add" (time hour: 20 minute: 00 second: 40) (time+ (time hour: 20 minute: 00 second: 00) (time second: 40))) + (test-equal "Remove" (time hour: 20 minute: 00 second: 00) (time- (time hour: 20 minute: 00 second: 40) (time second: 40)))) (test-group "Minutes" - (test-equal "Add" #20:10:00 (time+ #20:00:00 (time minute: 10))) - (test-equal "Remove" #20:00:00 (time- #20:10:00 (time minute: 10)))) + (test-equal "Add" (time hour: 20 minute: 10 second: 00) (time+ (time hour: 20 minute: 00 second: 00) (time minute: 10))) + (test-equal "Remove" (time hour: 20 minute: 00 second: 00) (time- (time hour: 20 minute: 10 second: 00) (time minute: 10)))) (test-group "Hours" - (test-equal "Add" #22:00:00 (time+ #20:00:00 (time hour: 2))) - (test-equal "Remove" #20:00:00 (time- #22:00:00 (time hour: 2))))) + (test-equal "Add" (time hour: 22 minute: 00 second: 00) (time+ (time hour: 20 minute: 00 second: 00) (time hour: 2))) + (test-equal "Remove" (time hour: 20 minute: 00 second: 00) (time- (time hour: 22 minute: 00 second: 00) (time hour: 2))))) (test-group "Overflowing cases" (test-group "Addition" (test-group "Single overflow" - (call-with-values (lambda () (time+ #20:00:00 (time hour: 5))) + (call-with-values (lambda () (time+ (time hour: 20 minute: 00 second: 00) (time hour: 5))) (lambda (result overflow) (test-equal "Time" (time hour: 1) result) (test-equal "Overflow" 1 overflow)))) (test-group "Mulitple overflows" - (call-with-values (lambda () (time+ #20:00:00 (time hour: 5) (time hour: 24))) + (call-with-values (lambda () (time+ (time hour: 20 minute: 00 second: 00) (time hour: 5) (time hour: 24))) (lambda (result overflow) (test-equal "Time" (time hour: 1) result) (test-equal "Overflow" 2 overflow))))) (test-group "Subtraction" (test-group "Single overflow" - (call-with-values (lambda () (time- #20:00:00 (time hour: 25))) + (call-with-values (lambda () (time- (time hour: 20 minute: 00 second: 00) (time hour: 25))) (lambda (result overflow) (test-equal "Time" (time hour: 19) result) (test-equal "Overflow" 1 overflow)))) @@ -794,10 +794,10 @@ datetime+ datetime- (test-group "Date difference" (test-assert "The differente between a date and itself is zero" - (date-zero? (date-difference #2022-02-02 #2022-02-02))) + (date-zero? (date-difference (date year: 2022 month: 02 day: 02) (date year: 2022 month: 02 day: 02)))) (test-error "Later date must be first" 'misc-error - (date-difference #2020-01-01 #2021-01-01)) + (date-difference (date year: 2020 month: 01 day: 01) (date year: 2021 month: 01 day: 01))) (test-error "Negative months are invalid" 'misc-error (date-difference (date) (date month: -1))) @@ -808,3 +808,5 @@ datetime+ datetime- ;; TODO datetime-difference + +'((datetime)) diff --git a/tests/test/tz.scm b/tests/unit/datetime/tz.scm index 00a611b3..d335ced3 100644 --- a/tests/test/tz.scm +++ b/tests/unit/datetime/tz.scm @@ -24,12 +24,12 @@ ((TZ "Europe/London")) (test-equal "London winter" - #2020-01-12T13:30:00 + (datetime year: 2020 month: 01 day: 12 hour: 13 minute: 30 second: 00) (get-datetime (parse-ics-datetime "20200112T133000Z"))) (test-equal "London summer" - #2020-06-12T14:30:00 + (datetime year: 2020 month: 06 day: 12 hour: 14 minute: 30 second: 00) (get-datetime (parse-ics-datetime "20200612T133000Z")))) @@ -38,12 +38,12 @@ ((TZ "Europe/Stockholm")) (test-equal "Stockholm winter" - #2020-01-12T14:30:00 + (datetime year: 2020 month: 01 day: 12 hour: 14 minute: 30 second: 00) (get-datetime (parse-ics-datetime "20200112T133000Z"))) (test-equal "Stockholm summer" - #2020-06-12T15:30:00 + (datetime year: 2020 month: 06 day: 12 hour: 15 minute: 30 second: 00) (get-datetime (parse-ics-datetime "20200612T133000Z")))) @@ -77,11 +77,12 @@ (test-equal (datetime date: - #1970-01-01 + (date year: 1970 month: 01 day: 01) time: - #00:00:00 + (time hour: 00 minute: 00 second: 00) tz: "UTC") (unix-time->datetime 0)) +'((datetime)) diff --git a/tests/test/zic.scm b/tests/unit/datetime/zic.scm index 99247cf1..19af169c 100644 --- a/tests/test/zic.scm +++ b/tests/unit/datetime/zic.scm @@ -37,8 +37,8 @@ Link Europe/Zurich Europe/Vaduz (test-equal "Basic Rule" (list ((@@ (datetime zic) make-rule) 'US 1967 1973 4 '(last 0) - ((@ (datetime zic) make-timespec) #02:00:00 '+ #\w) - ((@ (datetime zic) make-timespec) #01:00:00 '+ #\d) + ((@ (datetime zic) make-timespec) (time hour: 02 minute: 00 second: 00) '+ #\w) + ((@ (datetime zic) make-timespec) (time hour: 01 minute: 00 second: 00) '+ #\d) "D")) (call-with-input-string "Rule US 1967 1973 - Apr lastSun 2:00w 1:00d D" parse-zic-file)) @@ -47,7 +47,7 @@ Link Europe/Zurich Europe/Vaduz (test-equal "Basic Zone" (list ((@@ (datetime zic) make-zone) "Asia/Amman" (list ((@@ (datetime zic) make-zone-entry) - (make-timespec #02:00:00 '+ #\w) + (make-timespec (time hour: 02 minute: 00 second: 00) '+ #\w) 'Jordan "EE%sT" #f)))) (call-with-input-string @@ -58,10 +58,10 @@ Link Europe/Zurich Europe/Vaduz (test-equal "Basic Zone with continuation" (list ((@@ (datetime zic) make-zone) "America/Menominee" (list ((@@ (datetime zic) make-zone-entry) - (make-timespec #05:00:00 '- #\w) - #f "EST" #1973-04-29T02:00:00) + (make-timespec (time hour: 05 minute: 00 second: 00) '- #\w) + #f "EST" (datetime year: 1973 month: 04 day: 29 hour: 02 minute: 00 second: 00)) ((@@ (datetime zic) make-zone-entry) - (make-timespec #06:00:00 '- #\w) + (make-timespec (time hour: 06 minute: 00 second: 00) '- #\w) 'US "C%sT" #f)))) ;; Why can't I single read a zone with an until field? (call-with-input-string @@ -73,20 +73,20 @@ Link Europe/Zurich Europe/Vaduz (test-equal "Rules and Zone" (list ((@@ (datetime zic) make-zone) "America/Menominee" (list ((@@ (datetime zic) make-zone-entry) - (make-timespec #05:00:00 '- #\w) - #f "EST" #1973-04-29T02:00:00) + (make-timespec (time hour: 05 minute: 00 second: 00) '- #\w) + #f "EST" (datetime year: 1973 month: 04 day: 29 hour: 02 minute: 00 second: 00)) ((@@ (datetime zic) make-zone-entry) - (make-timespec #06:00:00 '- #\w) + (make-timespec (time hour: 06 minute: 00 second: 00) '- #\w) 'US "C%sT" #f))) ((@@ (datetime zic) make-rule) 'US 1967 1973 dec '(last 0) - (make-timespec #02:00:00 '+ #\w) - (make-timespec #01:00:00 '+ #\w) + (make-timespec (time hour: 02 minute: 00 second: 00) '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\w) "D") ((@@ (datetime zic) make-rule) 'US 1967 2006 nov '(last 0) - (make-timespec #02:00:00 '+ #\w) - (make-timespec #00:00:00 '+ #\w) + (make-timespec (time hour: 02 minute: 00 second: 00) '+ #\w) + (make-timespec (time hour: 00 minute: 00 second: 00) '+ #\w) "S")) (call-with-input-string "# Rule NAME FROM TO - IN ON AT SAVE LETTER/S @@ -119,79 +119,79 @@ Zone America/Menominee -5:00 - EST 1973 Apr 29 2:00 (list ((@@ (datetime zic) make-link) "Europe/Vaduz" "Europe/Zurich") ((@@ (datetime zic) make-zone) "Europe/Zurich" (list ((@@ (datetime zic) make-zone-entry) - (make-timespec #00:34:08 '+ #\w) - #f "LMT" #1853-07-16T00:00:00) + (make-timespec (time hour: 00 minute: 34 second: 08) '+ #\w) + #f "LMT" (datetime year: 1853 month: 07 day: 16 hour: 00 minute: 00 second: 00)) ((@@ (datetime zic) make-zone-entry) - (make-timespec #00:29:45 '+ #\w) ; NOTE that the .50 is discarded - #f "BMT" #1894-06-01T00:00:00) + (make-timespec (time hour: 00 minute: 29 second: 45) '+ #\w) ; NOTE that the .50 is discarded + #f "BMT" (datetime year: 1894 month: 06 day: 01 hour: 00 minute: 00 second: 00)) ((@@ (datetime zic) make-zone-entry) - (make-timespec #01:00:00 '+ #\w) - 'Swiss "CE%sT" #1981-01-01T00:00:00) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\w) + 'Swiss "CE%sT" (datetime year: 1981 month: 01 day: 01 hour: 00 minute: 00 second: 00)) ((@@ (datetime zic) make-zone-entry) - (make-timespec #01:00:00 '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\w) 'EU "CE%sT" #f))) ((@@ (datetime zic) make-rule) 'EU 1996 'maximum 10 '(last 0) - (make-timespec #01:00:00 '+ #\u) - (make-timespec #00:00:00 '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\u) + (make-timespec (time hour: 00 minute: 00 second: 00) '+ #\w) "") ((@@ (datetime zic) make-rule) 'EU 1981 'maximum 3 '(last 0) - (make-timespec #01:00:00 '+ #\u) - (make-timespec #01:00:00 '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\u) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\w) "S") ((@@ (datetime zic) make-rule) 'EU 1979 1995 9 `(last ,sun) - (make-timespec #01:00:00 '+ #\u) - (make-timespec #00:00:00 '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\u) + (make-timespec (time hour: 00 minute: 00 second: 00) '+ #\w) "") ((@@ (datetime zic) make-rule) 'EU 1978 'only 10 1 - (make-timespec #01:00:00 '+ #\u) - (make-timespec #00:00:00 '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\u) + (make-timespec (time hour: 00 minute: 00 second: 00) '+ #\w) "") ((@@ (datetime zic) make-rule) 'EU 1977 'only 9 `(last ,sun) - (make-timespec #01:00:00 '+ #\u) - (make-timespec #00:00:00 '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\u) + (make-timespec (time hour: 00 minute: 00 second: 00) '+ #\w) "") ((@@ (datetime zic) make-rule) 'EU 1977 1980 4 `(> ,sun 1) - (make-timespec #01:00:00 '+ #\u) - (make-timespec #01:00:00 '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\u) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\w) "S") ((@@ (datetime zic) make-rule) 'Swiss 1941 1942 10 `(> ,mon 1) - (make-timespec #02:00:00 '+ #\w) - (make-timespec #00:00:00 '+ #\w) + (make-timespec (time hour: 02 minute: 00 second: 00) '+ #\w) + (make-timespec (time hour: 00 minute: 00 second: 00) '+ #\w) "") ((@@ (datetime zic) make-rule) 'Swiss 1941 1942 5 `(> ,mon 1) - (make-timespec #01:00:00 '+ #\w) - (make-timespec #01:00:00 '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\w) "S")) (call-with-input-string big-sample parse-zic-file))) (test-group "rule->dtstart" (test-equal "last sunday" - #1967-04-30T02:00:00 + (datetime year: 1967 month: 04 day: 30 hour: 02 minute: 00 second: 00) (rule->dtstart ((@@ (datetime zic) make-rule) 'US 1967 1973 4 '(last 0) - ((@ (datetime zic) make-timespec) #02:00:00 '+ #\w) - ((@ (datetime zic) make-timespec) #01:00:00 '+ #\d) + ((@ (datetime zic) make-timespec) (time hour: 02 minute: 00 second: 00) '+ #\w) + ((@ (datetime zic) make-timespec) (time hour: 01 minute: 00 second: 00) '+ #\d) "D"))) (test-equal "sunday >= 1" - #1977-04-03T01:00:00Z + (datetime year: 1977 month: 04 day: 03 hour: 01 minute: 00 second: 00 tz: "UTC") (rule->dtstart ((@@ (datetime zic) make-rule) 'EU 1977 1980 4 `(> ,sun 1) - (make-timespec #01:00:00 '+ #\u) - (make-timespec #01:00:00 '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\u) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\w) "S"))) ;; Max and min uses dummy dates, which is slightly wrong ;; but shouldn't cause any real problems (test-equal "Minimum time" - #0000-10-30T01:00:00Z + (datetime year: 0000 month: 10 day: 30 hour: 01 minute: 00 second: 00 tz: "UTC") (rule->dtstart ((@@ (datetime zic) make-rule) 'EU 'minimum 2000 10 '(last 0) - (make-timespec #01:00:00 '+ #\u) - (make-timespec #00:00:00 '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\u) + (make-timespec (time hour: 00 minute: 00 second: 00) '+ #\w) ""))) (test-equal "Maximum time" @@ -199,8 +199,8 @@ Zone America/Menominee -5:00 - EST 1973 Apr 29 2:00 hour: 1 tz: "UTC") (rule->dtstart ((@@ (datetime zic) make-rule) 'EU 'maximum 2000 10 '(last 0) - (make-timespec #01:00:00 '+ #\u) - (make-timespec #00:00:00 '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\u) + (make-timespec (time hour: 00 minute: 00 second: 00) '+ #\w) "")))) (test-group "zone-format" @@ -228,12 +228,12 @@ Zone America/Menominee -5:00 - EST 1973 Apr 29 2:00 (test-equal "Get rules returns correctly, and in order" ;; Rules are sorted (list ((@@ (datetime zic) make-rule) 'Swiss 1941 1942 5 `(> ,mon 1) - (make-timespec #01:00:00 '+ #\w) - (make-timespec #01:00:00 '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\w) "S") ((@@ (datetime zic) make-rule) 'Swiss 1941 1942 10 `(> ,mon 1) - (make-timespec #02:00:00 '+ #\w) - (make-timespec #00:00:00 '+ #\w) + (make-timespec (time hour: 02 minute: 00 second: 00) '+ #\w) + (make-timespec (time hour: 00 minute: 00 second: 00) '+ #\w) "")) (get-rule zoneinfo 'Swiss)))) @@ -246,8 +246,8 @@ Zone America/Menominee -5:00 - EST 1973 Apr 29 2:00 bymonth: (list oct)) (rule->rrule ((@@ (datetime zic) make-rule) 'EU 1996 'maximum 10 '(last 0) - (make-timespec #01:00:00 '+ #\u) - (make-timespec #00:00:00 '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\u) + (make-timespec (time hour: 00 minute: 00 second: 00) '+ #\w) "") )) @@ -255,8 +255,8 @@ Zone America/Menominee -5:00 - EST 1973 Apr 29 2:00 #f (rule->rrule ((@@ (datetime zic) make-rule) 'EU 1996 'only 10 '(last 2) - (make-timespec #01:00:00 '+ #\u) - (make-timespec #00:00:00 '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\u) + (make-timespec (time hour: 00 minute: 00 second: 00) '+ #\w) ""))) (test-equal "with definitive to year" @@ -264,11 +264,11 @@ Zone America/Menominee -5:00 - EST 1973 Apr 29 2:00 freq: 'YEARLY interval: 1 wkst: mon byday: (list (cons -1 tue)) bymonth: (list oct) - until: #2000-01-01T00:00:00) + until: (datetime year: 2000 month: 01 day: 01 hour: 00 minute: 00 second: 00)) (rule->rrule ((@@ (datetime zic) make-rule) 'EU 1996 2000 10 '(last 2) - (make-timespec #01:00:00 '+ #\u) - (make-timespec #00:00:00 '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\u) + (make-timespec (time hour: 00 minute: 00 second: 00) '+ #\w) ""))) (test-equal "on being a month day" @@ -278,8 +278,8 @@ Zone America/Menominee -5:00 - EST 1973 Apr 29 2:00 bymonth: (list oct)) (rule->rrule ((@@ (datetime zic) make-rule) 'EU 1996 'maximum 10 2 - (make-timespec #01:00:00 '+ #\u) - (make-timespec #00:00:00 '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\u) + (make-timespec (time hour: 00 minute: 00 second: 00) '+ #\w) ""))) (test-equal "on being first day after date" @@ -289,8 +289,8 @@ Zone America/Menominee -5:00 - EST 1973 Apr 29 2:00 bymonth: (list oct)) (rule->rrule ((@@ (datetime zic) make-rule) 'EU 1996 'maximum 10 `(> ,mon 2) - (make-timespec #01:00:00 '+ #\u) - (make-timespec #00:00:00 '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\u) + (make-timespec (time hour: 00 minute: 00 second: 00) '+ #\w) ""))) (test-equal "Crash on counting backwards from date" @@ -299,8 +299,8 @@ Zone America/Menominee -5:00 - EST 1973 Apr 29 2:00 (lambda () (rule->rrule ((@@ (datetime zic) make-rule) 'EU 1996 'maximum 10 `(< ,mon 2) - (make-timespec #01:00:00 '+ #\u) - (make-timespec #00:00:00 '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\u) + (make-timespec (time hour: 00 minute: 00 second: 00) '+ #\w) ""))) list)) @@ -310,8 +310,10 @@ Zone America/Menominee -5:00 - EST 1973 Apr 29 2:00 (lambda () (rule->rrule ((@@ (datetime zic) make-rule) 'EU 1996 'minimum 10 `(< ,mon 2) - (make-timespec #01:00:00 '+ #\u) - (make-timespec #00:00:00 '+ #\w) + (make-timespec (time hour: 01 minute: 00 second: 00) '+ #\u) + (make-timespec (time hour: 00 minute: 00 second: 00) '+ #\w) ""))) list)) ) + +'((datetime zic)) diff --git a/tests/test/termios.scm b/tests/unit/termios/termios.scm index 7f607cc4..3e472d81 100644 --- a/tests/test/termios.scm +++ b/tests/unit/termios/termios.scm @@ -46,3 +46,4 @@ (test-equal 0 (tcsetattr! copy tty)) +'((vulgar termios)) diff --git a/tests/test/base64.scm b/tests/unit/util/base64.scm index b24d2e8b..7fac883c 100644 --- a/tests/test/base64.scm +++ b/tests/unit/util/base64.scm @@ -41,3 +41,5 @@ (test-equal "AAECAw==" (bytevector->base64-string #vu8(0 1 2 3))) (test-equal #vu8(0 1 2 3) (base64-string->bytevector "AAECAw==")) + +'((base64)) diff --git a/tests/test/crypto.scm b/tests/unit/util/crypto.scm index 0dbf8867..7be301a0 100644 --- a/tests/test/crypto.scm +++ b/tests/unit/util/crypto.scm @@ -20,3 +20,5 @@ (test-error 'wrong-type-arg (sha256 'something-which-is-not-a-string-or-bytevector)) + +'((crypto)) diff --git a/tests/test/hnh-util-env.scm b/tests/unit/util/hnh-util-env.scm index c1e0161f..74ab3b79 100644 --- a/tests/test/hnh-util-env.scm +++ b/tests/unit/util/hnh-util-env.scm @@ -45,3 +45,5 @@ (let-env ((TEST #f)) (test-assert (not (getenv "TEST")))) (test-equal "A" (getenv "TEST"))) + +'((hnh util env)) diff --git a/tests/test/hnh-util-lens.scm b/tests/unit/util/hnh-util-lens.scm index 0508553a..0f4af6cb 100644 --- a/tests/test/hnh-util-lens.scm +++ b/tests/unit/util/hnh-util-lens.scm @@ -57,3 +57,5 @@ ;; ref car* cdr* ;; each + +'((hnh util lens)) diff --git a/tests/test/hnh-util-path.scm b/tests/unit/util/hnh-util-path.scm index de4bf8e3..e5f65505 100644 --- a/tests/test/hnh-util-path.scm +++ b/tests/unit/util/hnh-util-path.scm @@ -122,3 +122,5 @@ (test-equal "Extension of hidden file without extension" "bashrc" (filename-extension ".bashrc")) + +'((hnh util path)) diff --git a/tests/test/hnh-util-state-monad.scm b/tests/unit/util/hnh-util-state-monad.scm index 353c47e9..4180a53f 100644 --- a/tests/test/hnh-util-state-monad.scm +++ b/tests/unit/util/hnh-util-state-monad.scm @@ -118,3 +118,4 @@ 0 1)) +'((hnh util state-monad)) diff --git a/tests/test/hnh-util.scm b/tests/unit/util/hnh-util.scm index c4a20443..8586b6d9 100644 --- a/tests/test/hnh-util.scm +++ b/tests/unit/util/hnh-util.scm @@ -8,7 +8,6 @@ :use-module (srfi srfi-88) :use-module (srfi srfi-1) :use-module (hnh util) - :use-module (hnh util env) ) (define (unreachable) @@ -45,18 +44,19 @@ ;; (test-group "define-syntax" ;; ) -(test-group "Conditionals" +(test-group "when" (test-equal "when" 1 (when #t 1)) (test-equal "'() when #f" - '() (when #f 1)) + '() (when #f 1))) +(test-group "unless" (test-equal "unless" 1 (unless #f 1)) (test-equal "'() unless #t" - '() (unless #t 1)) + '() (unless #t 1))) @@ -71,6 +71,7 @@ (unreachable) (test-assert #t))) +(test-group "awhen" (test-equal "awhen it" '(3 4 5) (awhen (memv 2 '(1 2 3 4 5)) @@ -100,26 +101,21 @@ (test-equal "for with longer improper list elements" '(1 2 4) (for (a b . c) in '((1 -1 . 1) (2 -2 . 2) (4 -4 . 4)) - (* c (+ 1 a b)))) - - (test-equal "for break" - 'x - (for x in (iota 10) - (break 'x) - (test-assert "This should never happen" #f))) - - (test-equal "for continue" - '(x #f 2) - (for x in (iota 3) - (case x - ((0) - (continue 'x) - (test-assert "Continue with value failed" #f)) - ((1) - (continue) - (test-assert "Continue without value failed" #f)) - (else x))))) - + (* c (+ 1 a b))))) + +(test-group "begin1" + (let ((value #f)) + (test-equal + "begin1 return value" + "Hello" + (begin1 "Hello" (set! value "World"))) + (test-equal "begin1 side effects" "World" value)) + + (let ((x 1)) + (test-eqv "begin1 set! after return" + 1 (begin1 x (set! x 10))) + (test-eqv "Updates value" + 10 x))) (test-group "print-and-return" (let ((p (open-output-string))) @@ -135,31 +131,82 @@ '(3 2 1) ((swap list) 1 2 3))) +(test-group "set/r!" + (test-equal + "set/r! = single" + #f + (let ((x #t)) (set/r! x = not))) + + (test-error + 'syntax-error + (test-read-eval-string "(set/r! x err not)"))) + +(test-group "label" + (test-equal "procedure label" + 120 + ((label factorial (lambda (n) + (if (zero? n) + 1 (* n (factorial (1- n)))))) + 5))) + +(test-group "sort*" + ;; we can't test if sort*! destroys the list, since its only /allowed/ to do it, + ;; not required. + (test-equal "sort*!" + '("a" "Hello" "Assparagus") + (sort*! '("Hello" "a" "Assparagus") + < string-length))) + + +(test-group "find-extreme" + (test-error 'wrong-type-arg (find-extreme '())) -(test-equal "procedure label" - 120 - ((label factorial (lambda (n) - (if (zero? n) - 1 (* n (factorial (1- n)))))) - 5)) - -;; we can't test if sort*! destroys the list, since its only /allowed/ to do it, -;; not required. -(test-equal "sort*!" - '("a" "Hello" "Assparagus") - (sort*! '("Hello" "a" "Assparagus") - < string-length)) - + (test-group "find-min" + (call-with-values + (lambda () (find-min (iota 10))) + (lambda (extreme rest) + (test-equal "Found correct minimum" 0 extreme) + (test-equal + "Removed \"something\" from the set" + 9 + (length rest))))) + (test-group "find-max" + (call-with-values + (lambda () + (find-max + '("Hello" "Test" "Something long") + string-length)) + (lambda (extreme rest) + (test-equal + "Found the longest string" + "Something long" + extreme) + (test-equal "Removed the string" 2 (length rest)) + (test-assert + "Other members left 1" + (member "Hello" rest)) + (test-assert + "Other members left 2" + (member "Test" rest)))))) +(test-group "filter-sorted" + (test-equal + "Filter sorted" + '(3 4 5) + (filter-sorted (lambda (x) (<= 3 x 5)) (iota 10)))) +(test-group "!=" + (test-assert "not equal" + (!= 1 2))) -(test-assert "not equal" - (!= 1 2)) +(test-group "init+last" + 'TODO) -(test-equal "Take to" - '() (take-to '() 5)) +(test-group "take-to" + (test-equal "Take to" + '() (take-to '() 5))) (test-group "string-take-to" (test-equal "Hello" @@ -178,20 +225,24 @@ '() (as-symb '()))) -(test-equal "Enumerate" - '((0 #\H) (1 #\e) (2 #\l) (3 #\l) (4 #\o) (5 #\,) (6 #\space) (7 #\W) (8 #\o) (9 #\r) (10 #\l) (11 #\d) (12 #\!)) - (enumerate (string->list "Hello, World!"))) +(test-group "enumerate" + (test-equal "Enumerate" + '((0 #\H) (1 #\e) (2 #\l) (3 #\l) (4 #\o) (5 #\,) (6 #\space) (7 #\W) (8 #\o) (9 #\r) (10 #\l) (11 #\d) (12 #\!)) + (enumerate (string->list "Hello, World!")))) + + +(test-group "unval" + (test-equal "unval first" + 1 + ((unval (lambda () (values 1 2 3))))) -(test-equal "unval first" - 1 - ((unval (lambda () (values 1 2 3))))) + (test-equal "unval other" + 2 + ((unval car+cdr 1) + (cons 1 2)))) -(test-equal "unval other" - 2 - ((unval car+cdr 1) - (cons 1 2))) -(test-group "Flatten" +(test-group "flatten" (test-equal "flatten already flat" (iota 10) (flatten (iota 10))) @@ -204,20 +255,38 @@ '(1 2 3 4 5) (flatten '((((((1(((((2((((3))))))4))))))))5)))) -;; TODO test let-lazy +(test-group "let-lazy" + 'TODO) (test-group "map/dotted" - (test-equal "map/dotted without dot" - '(1 2 3 4) - (map/dotted 1+ '(0 1 2 3))) + (test-equal "map/dotted without dot" + '(1 2 3 4) + (map/dotted 1+ '(0 1 2 3))) + + (test-equal "map/dotted with dot" + '(1 2 3 . 4) + (map/dotted 1+ '(0 1 2 . 3))) + + (test-equal "map/dotted direct value" + 1 (map/dotted 1+ 0))) - (test-equal "map/dotted with dot" - '(1 2 3 . 4) - (map/dotted 1+ '(0 1 2 . 3))) +(test-group "assq-merge" + (test-equal "assq merge" + '((k 2 1) (v 2)) + (assq-merge '((k 1) (v 2)) '((k 2))))) - (test-equal "map/dotted direct value" - 1 (map/dotted 1+ 0))) +(test-group "kvlist->assq" + (test-equal "kvlist->assq" + '((a . 1) (b . 2)) + (kvlist->assq '(a: 1 b: 2))) + + (test-equal "kvlist->assq repeated key" + '((a . 1) (b . 2) (a . 3)) + (kvlist->assq '(a: 1 b: 2 a: 3)))) + +(test-group "assq-limit" + 'TODO) (test-group "group-by" @@ -243,6 +312,28 @@ 'TODO) +(test-group "span-upto" + (test-group "Case 1" + (call-with-values + (lambda () + (span-upto + 2 + char-numeric? + (string->list "123456"))) + (lambda (head tail) + (test-equal '(#\1 #\2) head) + (test-equal '(#\3 #\4 #\5 #\6) tail)))) + + (test-group "Case 2" + (call-with-values + (lambda () + (span-upto + 2 + char-numeric? + (string->list "H123456"))) + (lambda (head tail) + (test-equal '() head) + (test-equal '(#\H #\1 #\2 #\3 #\4 #\5 #\6) tail))))) (test-group "cross-product" (test-equal "Basic case" @@ -273,136 +364,65 @@ '(3 4) '(5 6)))) -(test-group "Arrows" - (test-equal "->" 9 (-> 1 (+ 2) (* 3))) - (test-equal "-> order dependant" -1 (-> 1 (- 2))) - (test-equal "->> order dependant" 1 (->> 1 (- 2)))) - -;; TODO set and set-> - -;; TODO and=>> - -;; downcase-symbol - - - -;; TODO test failure when grouping isn't possible? -(test-equal "Group" - '((0 1) (2 3) (4 5) (6 7) (8 9)) - (group (iota 10) 2)) - -;; TODO test failure when grouping isn't possible? - -(test-group "Associations" - (test-equal "assoc-ref-all" '(1 3) (assoc-ref-all '((a . 1) (b . 2) (a . 3)) 'a)) - (test-equal "assq-ref-all" '(1 3) (assq-ref-all '((a . 1) (b . 2) (a . 3)) 'a)) - (test-equal "assv-ref-all" '(1 3) (assv-ref-all '((a . 1) (b . 2) (a . 3)) 'a)) - - ;; TODO assq-limit ? +(test-group "string-flatten" + 'TODO) - (test-equal "assq merge" - '((k 2 1) (v 2)) - (assq-merge '((k 1) (v 2)) '((k 2)))) +(test-group "intersperse" + 'TODO) - (test-equal "kvlist->assq" - '((a . 1) (b . 2)) - (kvlist->assq '(a: 1 b: 2))) +(test-group "insert-ordered" + 'TODO) +(test-group "-> (arrows)" + (test-equal "->" 9 (-> 1 (+ 2) (* 3))) + (test-equal "-> order dependant" -1 (-> 1 (- 2))) + (test-equal "->> order dependant" 1 (->> 1 (- 2)))) - (test-equal "kvlist->assq repeated key" - '((a . 1) (b . 2) (a . 3)) - (kvlist->assq '(a: 1 b: 2 a: 3)))) +(test-group "set" + 'TODO) -(test-equal "vector-last" - 1 (vector-last #(0 2 3 1))) +(test-group "set->" + 'TODO) -;; TODO test catch* +(test-group "and=>" + 'TODO) -(test-equal - "Filter sorted" - '(3 4 5) - (filter-sorted (lambda (x) (<= 3 x 5)) (iota 10))) +(test-group "downcase-symbol" + 'TODO) -(test-equal - "set/r! = single" - #f - (let ((x #t)) (set/r! x = not))) -(test-error - 'syntax-error - (test-read-eval-string "(set/r! x err not)")) +(test-group "group" + ;; TODO test failure when grouping isn't possible? + (test-equal "Group" + '((0 1) (2 3) (4 5) (6 7) (8 9)) + (group (iota 10) 2))) -(test-group "Find extremes" - (test-error 'wrong-type-arg (find-extreme '())) +(test-group "iterate" + (test-equal 0 (iterate 1- zero? 10))) - (test-group "find-min" - (call-with-values - (lambda () (find-min (iota 10))) - (lambda (extreme rest) - (test-equal "Found correct minimum" 0 extreme) - (test-equal - "Removed \"something\" from the set" - 9 - (length rest))))) - - (test-group "find-max" - (call-with-values - (lambda () - (find-max - '("Hello" "Test" "Something long") - string-length)) - (lambda (extreme rest) - (test-equal - "Found the longest string" - "Something long" - extreme) - (test-equal "Removed the string" 2 (length rest)) - (test-assert - "Other members left 1" - (member "Hello" rest)) - (test-assert - "Other members left 2" - (member "Test" rest)))))) - -(test-group "Span upto" - (test-group "Case 1" - (call-with-values - (lambda () - (span-upto - 2 - char-numeric? - (string->list "123456"))) - (lambda (head tail) - (test-equal '(#\1 #\2) head) - (test-equal '(#\3 #\4 #\5 #\6) tail)))) - - (test-group "Case 2" - (call-with-values - (lambda () - (span-upto - 2 - char-numeric? - (string->list "H123456"))) - (lambda (head tail) - (test-equal '() head) - (test-equal '(#\H #\1 #\2 #\3 #\4 #\5 #\6) tail))))) +(test-group "valued-map" + 'TODO) -(test-group "Begin1" - (let ((value #f)) - (test-equal - "begin1 return value" - "Hello" - (begin1 "Hello" (set! value "World"))) - (test-equal "begin1 side effects" "World" value)) +(test-group "assoc-ref-all" + (test-equal "assoc-ref-all" + '(1 3) (assoc-ref-all '((a . 1) (b . 2) (a . 3)) 'a)) + (test-equal "assq-ref-all" + '(1 3) (assq-ref-all '((a . 1) (b . 2) (a . 3)) 'a)) + (test-equal "assv-ref-all" + '(1 3) (assv-ref-all '((a . 1) (b . 2) (a . 3)) 'a))) - (let ((x 1)) - (test-eqv "begin1 set! after return" - 1 (begin1 x (set! x 10))) - (test-eqv "Updates value" - 10 x))) +(test-group "unique" + 'TODO) -(test-equal 0 (iterate 1- zero? 10)) +(test-group "vector-last" + (test-equal "vector-last" + 1 (vector-last #(0 2 3 1)))) (test-group "->string" (test-equal "5" (->string 5)) (test-equal "5" (->string "5"))) + +(test-group "catch*" + 'TODO) + +'((hnh util)) diff --git a/tests/test/object.scm b/tests/unit/util/object.scm index 701c45c0..4f3aeb4f 100644 --- a/tests/test/object.scm +++ b/tests/unit/util/object.scm @@ -78,3 +78,5 @@ ;; - printer: (define-type (f4 printer: (lambda (r p) (display "something" p)))) (test-equal "something" (with-output-to-string (lambda () (write (f4))))) + +'((hnh util object)) diff --git a/tests/test/srfi-41-util.scm b/tests/unit/util/srfi-41-util.scm index 9a753b03..79c607c5 100644 --- a/tests/test/srfi-41-util.scm +++ b/tests/unit/util/srfi-41-util.scm @@ -106,3 +106,5 @@ (stream-map list->string (stream-split-by (lambda (c) (char=? c #\space)) hello-chars-stream)))))) + +'((srfi srfi-41 util)) diff --git a/tests/test/sxml-namespaced.scm b/tests/unit/util/sxml-namespaced.scm index 55d52798..b2d55028 100644 --- a/tests/test/sxml-namespaced.scm +++ b/tests/unit/util/sxml-namespaced.scm @@ -168,3 +168,5 @@ (xml->namespaced-sxml "<x:a xmlns:y=\"http://example.com/1\"><x:b/></x:a>" ; `((x . ,(ns 1))) )) + +'((sxml namespaced)) diff --git a/tests/test/uuid.scm b/tests/unit/util/uuid.scm index 1cedb59e..7d68e38e 100644 --- a/tests/test/uuid.scm +++ b/tests/unit/util/uuid.scm @@ -9,3 +9,5 @@ "d19c9347-9a85-4432-a876-5fb9c0d24d2b" (parameterize ((seed (seed->random-state 0))) (uuid-v4))) + +'((hnh util uuid)) diff --git a/tests/test/xdg-basedir.scm b/tests/unit/util/xdg-basedir.scm index 682c1347..5731b581 100644 --- a/tests/test/xdg-basedir.scm +++ b/tests/unit/util/xdg-basedir.scm @@ -56,3 +56,4 @@ (test-assert "No error was emitted" (string-null? warning))))) +'((xdg basedir)) diff --git a/tests/test/xml-namespace.scm b/tests/unit/util/xml-namespace.scm index 09402ceb..2b6ea174 100644 --- a/tests/test/xml-namespace.scm +++ b/tests/unit/util/xml-namespace.scm @@ -34,3 +34,5 @@ "Remove specific namespace" '(a:a (b)) (move-to-namespace '(a:a (b:b)) '((b . #f)))) + +'((sxml namespace)) diff --git a/tests/test/annoying-events.scm b/tests/unit/vcomponent/annoying-events.scm index a6f5e946..0fa81adb 100644 --- a/tests/test/annoying-events.scm +++ b/tests/unit/vcomponent/annoying-events.scm @@ -8,8 +8,6 @@ stream->list stream-filter stream-take-while)) - :use-module ((vcomponent base) - :select (extract prop)) :use-module ((vcomponent datetime) :select (event-overlaps?)) :use-module ((datetime) :select (date date+ date<)) :use-module ((hnh util) :select (set!)) @@ -17,7 +15,7 @@ :use-module (vcomponent base)) -(define start #2021-11-01) +(define start (date year: 2021 month: 11 day: 01)) (define end (date+ start (date day: 8))) @@ -25,16 +23,16 @@ (stream (vevent ; should be part of the result summary: "A" - dtstart: #2021-10-01 - dtend: #2021-12-01) + dtstart: (date year: 2021 month: 10 day: 01) + dtend: (date year: 2021 month: 12 day: 01)) (vevent ; should NOT be part of the result summary: "B" - dtstart: #2021-10-10 - dtend: #2021-10-11) + dtstart: (date year: 2021 month: 10 day: 10) + dtend: (date year: 2021 month: 10 day: 11)) (vevent ; should also be part of the result summary: "C" - dtstart: #2021-11-02 - dtend: #2021-11-03))) + dtstart: (date year: 2021 month: 11 day: 02) + dtend: (date year: 2021 month: 11 day: 03)))) ;; (if (and (date< (prop ev 'DTSTART) start-date) ;; (date<= (prop ev 'DTEND) end-date)) @@ -65,3 +63,6 @@ ev-set))))) + +'((vcomponent base) + (vcomponent datetime)) diff --git a/tests/test/create.scm b/tests/unit/vcomponent/create.scm index 7cc00419..caf2d33c 100644 --- a/tests/test/create.scm +++ b/tests/unit/vcomponent/create.scm @@ -64,3 +64,6 @@ (test-assert (every vline? (prop* ev 'PROP))))) ;; (test-group "Parameters and lists" ) + + +'((vcomponent create)) diff --git a/tests/test/param.scm b/tests/unit/vcomponent/param.scm index 431a8f46..9611fd8a 100644 --- a/tests/test/param.scm +++ b/tests/unit/vcomponent/param.scm @@ -64,3 +64,6 @@ END:DUMMY" (test-error 'warning (vcomponent->sxcal component))) + +'((vcomponent base) + (vcomponent formats xcal output)) diff --git a/tests/test/recurrence-simple.scm b/tests/unit/vcomponent/recurrence-simple.scm index b0c3bdea..31a74989 100644 --- a/tests/test/recurrence-simple.scm +++ b/tests/unit/vcomponent/recurrence-simple.scm @@ -90,6 +90,8 @@ END:VEVENT" (stream->list (stream-take 5 (day-stream (prop ev 'DTSTART))))) +(test-assert "Test 1" #t) + (define ev (car (call-with-input-string @@ -99,6 +101,8 @@ RRULE:FREQ=DAILY END:VEVENT" parse-calendar))) +(test-assert "Test 2" #t) + (test-assert "daily 10:00" (stream-car (generate-recurrence-set ev))) @@ -311,3 +315,10 @@ END:VCALENDAR" ;; RRULE:FREQ=DAILY;BYDAY=MO,TU,WE,TH,FR
;; END:VEVENT
;; END:VCALENDAR
+ +;; TODO add remaining rules + + +'((vcomponent recurrence) + (vcomponent formats ical parse) + (vcomponent formats xcal parse)) diff --git a/tests/test/rrule-serialization.scm b/tests/unit/vcomponent/rrule-serialization.scm index e616c5a2..540c5bd2 100644 --- a/tests/test/rrule-serialization.scm +++ b/tests/unit/vcomponent/rrule-serialization.scm @@ -73,3 +73,5 @@ (recur-rule->rrule-sxml rule))))) +'((vcomponent recurrence internal) + (vcomponent recurrence parse)) diff --git a/tests/test/vcomponent-control.scm b/tests/unit/vcomponent/vcomponent-control.scm index cf6995bf..7ebafa3d 100644 --- a/tests/test/vcomponent-control.scm +++ b/tests/unit/vcomponent/vcomponent-control.scm @@ -33,4 +33,4 @@ (throw 'any))) (lambda _ (test-equal "value" (prop ev 'X-KEY))))) - +'((vcomponent util control)) diff --git a/tests/test/vcomponent-datetime.scm b/tests/unit/vcomponent/vcomponent-datetime.scm index 49d1711f..80fee259 100644 --- a/tests/test/vcomponent-datetime.scm +++ b/tests/unit/vcomponent/vcomponent-datetime.scm @@ -12,8 +12,8 @@ (define ev (vevent - dtstart: #2020-03-29T17:00:00 - dtend: #2020-04-01T10:00:00)) + dtstart: (datetime year: 2020 month: 03 day: 29 hour: 17 minute: 00 second: 00) + dtend: (datetime year: 2020 month: 04 day: 01 hour: 10 minute: 00 second: 00))) ;; |-----------------| test interval @@ -23,21 +23,22 @@ "Correct clamping" (datetime time: (time hour: 7)) ; 2020-03-29T17:00 - 2020-03-30T00:00 (event-length/clamped - #2020-03-23 ; a time way before the start of the event - #2020-03-29 ; a time slightly after the end of the event + (date year: 2020 month: 03 day: 23) ; a time way before the start of the event + (date year: 2020 month: 03 day: 29) ; a time slightly after the end of the event ev)) (define utc-ev (vevent - dtstart: #2020-03-29T15:00:00Z - dtend: #2020-04-01T08:00:00Z)) + dtstart: (datetime year: 2020 month: 03 day: 29 hour: 15 minute: 00 second: 00 tz: "UTC") + dtend: (datetime year: 2020 month: 04 day: 01 hour: 08 minute: 00 second: 00 tz: "UTC"))) (test-equal "Correct clamping UTC" (datetime time: (time hour: 7)) (event-length/clamped - #2020-03-23 - #2020-03-29 + (date year: 2020 month: 03 day: 23) + (date year: 2020 month: 03 day: 29) ev)) +'((vcomponent datetime)) diff --git a/tests/test/vcomponent-formats-common-types.scm b/tests/unit/vcomponent/vcomponent-formats-common-types.scm index 4c442461..1d7c77cf 100644 --- a/tests/test/vcomponent-formats-common-types.scm +++ b/tests/unit/vcomponent/vcomponent-formats-common-types.scm @@ -33,14 +33,14 @@ (define parse-date (get-parser 'DATE)) (test-equal - #2021-12-02 + (date year: 2021 month: 12 day: 02) (parse-date #f "20211202")) ;; TODO negative test here (define parse-datetime (get-parser 'DATE-TIME)) (test-equal - #2021-12-02T10:20:30 + (datetime year: 2021 month: 12 day: 02 hour: 10 minute: 20 second: 30) (parse-datetime (make-hash-table) "20211202T102030")) @@ -120,7 +120,7 @@ (define parse-time (get-parser 'TIME)) (test-equal - #10:20:30 + (time hour: 10 minute: 20 second: 30) (parse-time #f "102030")) ;; TODO negative test here @@ -136,3 +136,5 @@ (get-parser 'UTC-OFFSET)) ;; TODO + +'((vcomponent formats common types)) diff --git a/tests/test/vcomponent.scm b/tests/unit/vcomponent/vcomponent.scm index bdaefa95..ebd0b1ff 100644 --- a/tests/test/vcomponent.scm +++ b/tests/unit/vcomponent/vcomponent.scm @@ -40,7 +40,7 @@ (define vline* (vline key: 'DTSTART - vline-value: #2020-01-02 + vline-value: (date year: 2020 month: 01 day: 02) vline-parameters: (alist->table '((VALUE . "DATE"))) vline-source: "DTSTART;VALUE=DATE:2020-01-02")) @@ -101,3 +101,5 @@ ;; x-property? ;; internal-field? + +'((vcomponent base)) diff --git a/tests/test/server.scm b/tests/unit/web-util/server.scm index a6200cb8..c81abba3 100644 --- a/tests/test/server.scm +++ b/tests/unit/web-util/server.scm @@ -26,3 +26,6 @@ (let ((path args (parse-endpoint-string "/static/:filename{.*}.:ext"))) (test-equal "Path" "/static/(.*)\\.([^/.]+)" path) (test-equal "Parameters" '(filename ext) args))) + + +'((web http make-routes)) diff --git a/tests/test/web-query.scm b/tests/unit/web-util/web-query.scm index 0555258b..ec20b0c1 100644 --- a/tests/test/web-query.scm +++ b/tests/unit/web-util/web-query.scm @@ -32,3 +32,6 @@ ;; I don't know if HTTP allows this, but my code works like this (test-equal "Value with equal in it" '(key: "=") (parse-query "key==")) + + +'((web query)) diff --git a/tests/test/webdav-file.scm b/tests/unit/webdav/webdav-file.scm index 4096016b..85f4738d 100644 --- a/tests/test/webdav-file.scm +++ b/tests/unit/webdav/webdav-file.scm @@ -51,3 +51,6 @@ (test-group "Copy file" 'TODO) + +'((calp webdav resource) + (calp webdav resource file)) diff --git a/tests/test/webdav-server.scm b/tests/unit/webdav/webdav-server.scm index 67747de7..d5fa0e93 100644 --- a/tests/test/webdav-server.scm +++ b/tests/unit/webdav/webdav-server.scm @@ -349,3 +349,5 @@ ;;; Run REPORT + +'((calp server webdav)) diff --git a/tests/test/webdav-tree.scm b/tests/unit/webdav/webdav-tree.scm index 5c2a6a9b..da6073eb 100644 --- a/tests/test/webdav-tree.scm +++ b/tests/unit/webdav/webdav-tree.scm @@ -87,3 +87,6 @@ (test-equal "Hello, World!\n" (bytevector->string (content resource) (native-transcoder))) ) +'((calp webdav resource) + (calp webdav resource virtual) + (calp webdav resource file)) diff --git a/tests/test/webdav-util.scm b/tests/unit/webdav/webdav-util.scm index 5c89cf6c..c4e16536 100644 --- a/tests/test/webdav-util.scm +++ b/tests/unit/webdav/webdav-util.scm @@ -27,3 +27,5 @@ (test-error 'misc-error (href-relative '("c") '()))) + +'((calp webdav resource base)) diff --git a/tests/test/webdav.scm b/tests/unit/webdav/webdav.scm index 0962a89e..e86b5342 100644 --- a/tests/test/webdav.scm +++ b/tests/unit/webdav/webdav.scm @@ -351,3 +351,9 @@ (let ((root (make <virtual-resource> name: "*root*"))) (add-collection! root "child") (test-eqv "Child got added" 1 (length (children root))))) + + +'((calp webdav property) + (calp webdav propfind) + (calp webdav resource) + (calp webdav resource virtual)) diff --git a/tests/test/web-server.scm b/tests/web/web-server.scm index 69d18536..69d18536 100644 --- a/tests/test/web-server.scm +++ b/tests/web/web-server.scm |