From 1e8171b95e146b18c2c173445bd34dc3cacee3af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 22 Oct 2023 14:52:08 +0200 Subject: Test work. --- tests/unit/util/hnh-util.scm | 10 +++++++++- tests/unit/util/srfi-41-util.scm | 12 +++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'tests/unit/util') diff --git a/tests/unit/util/hnh-util.scm b/tests/unit/util/hnh-util.scm index 8586b6d9..79b86b54 100644 --- a/tests/unit/util/hnh-util.scm +++ b/tests/unit/util/hnh-util.scm @@ -202,7 +202,11 @@ (!= 1 2))) (test-group "init+last" - 'TODO) + (call-with-values + (lambda () (init+last (iota 5))) + (lambda (init last) + (test-equal '(0 1 2 3) init) + (test-equal 4 last)))) (test-group "take-to" (test-equal "Take to" @@ -336,6 +340,10 @@ (test-equal '(#\H #\1 #\2 #\3 #\4 #\5 #\6) tail))))) (test-group "cross-product" + + (test-equal "null case" + '() (cross-product)) + (test-equal "Basic case" '((1 4) (1 5) diff --git a/tests/unit/util/srfi-41-util.scm b/tests/unit/util/srfi-41-util.scm index 79c607c5..8e1b79d8 100644 --- a/tests/unit/util/srfi-41-util.scm +++ b/tests/unit/util/srfi-41-util.scm @@ -4,13 +4,19 @@ ;;; Code: (define-module (test srfi-41-util) - :use-module (srfi srfi-64) - :use-module (srfi srfi-88) + :use-module ((srfi srfi-1) :select (circular-list)) :use-module (srfi srfi-41 util) :use-module (srfi srfi-41) - :use-module ((srfi srfi-1) :select (circular-list)) + :use-module (srfi srfi-64) + :use-module (srfi srfi-71) + :use-module (srfi srfi-88) :use-module ((ice-9 sandbox) :select (call-with-time-limit))) +(test-group "stream car+cdr" + (let ((a d (stream-car+cdr (stream 1 2 3)))) + (test-equal "car" 1 a) + (test-equal "cdr" '(2 3) (stream->list d)))) + (test-equal "Finite stream" '((0 1 2) (3 4 5) (6 7 8) (9)) (let ((strm (stream-paginate (stream 0 1 2 3 4 5 6 7 8 9) 3))) -- cgit v1.2.3