From f7716ac1a87649cad96242f2d5bf0a987d7f430c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 7 Mar 2022 15:31:00 +0100 Subject: Add new tests. --- tests/srfi-41-util.scm | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 tests/srfi-41-util.scm (limited to 'tests/srfi-41-util.scm') diff --git a/tests/srfi-41-util.scm b/tests/srfi-41-util.scm deleted file mode 100644 index 3c2c3f0f..00000000 --- a/tests/srfi-41-util.scm +++ /dev/null @@ -1,40 +0,0 @@ -;;; Commentary: -;; Tests (srfi srfi-41 util). -;; Currently only tests stream-paginate. -;;; Code: - -(((srfi srfi-41 util) stream-paginate) - ((srfi srfi-41) stream->list stream-ref stream-from - stream-filter stream-car stream) - ((ice-9 sandbox) call-with-time-limit) - ) - -(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))) - (map stream->list (stream->list strm)))) - - -(test-equal "slice of infinite" - '(1000 1001 1002 1003 1004 1005 1006 1007 1008 1009) - (let ((strm (stream-paginate (stream-from 0)))) - (stream->list (stream-ref strm 100)))) - - - -(define unique-symbol (gensym)) - -(test-equal "time out on infinite 'empty' stream" - unique-symbol - ;; defined outside time limit since creation should always - ;; succeed. Only reference is expected to fail. - (let ((strm (stream-paginate - ;; easy way to get stream which never finds - ;; any elements. - (stream-filter negative? (stream-from 0))))) - (call-with-time-limit - 0.1 - (lambda () (stream-car strm)) - (lambda _ unique-symbol)))) -- cgit v1.2.3