[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, srfi-41, updated. v2.0.7-216-ge062929
From: |
Chris K. Jester-Young |
Subject: |
[Guile-commits] GNU Guile branch, srfi-41, updated. v2.0.7-216-ge062929 |
Date: |
Mon, 25 Mar 2013 08:04:02 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=e062929f22b85b02744e29cc2503450e2b51e179
The branch, srfi-41 has been updated
via e062929f22b85b02744e29cc2503450e2b51e179 (commit)
from b6e0f7ab60cc7b9c8e15beb4778219b31aab0cc1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit e062929f22b85b02744e29cc2503450e2b51e179
Author: Chris K. Jester-Young <address@hidden>
Date: Mon Mar 25 04:03:01 2013 -0400
Use pass-if-equal instead of (pass-if (equal? ...)).
* test-suite/tests/srfi-41.test: Use pass-if-equal.
-----------------------------------------------------------------------
Summary of changes:
test-suite/tests/srfi-41.test | 135 ++++++++++++++++++++++++-----------------
1 files changed, 79 insertions(+), 56 deletions(-)
diff --git a/test-suite/tests/srfi-41.test b/test-suite/tests/srfi-41.test
index f7420a9..f2e0864 100644
--- a/test-suite/tests/srfi-41.test
+++ b/test-suite/tests/srfi-41.test
@@ -197,17 +197,20 @@
(port->stream "four"))
(call-with-input-string "Hello, world!"
(lambda (p)
- (pass-if "reads input string correctly"
- (equal? (list->string (stream->list (port->stream p)))
- "Hello, world!")))))
+ (pass-if-equal "reads input string correctly"
+ "Hello, world!"
+ (list->string (stream->list (port->stream p)))))))
(with-test-prefix "stream"
- (pass-if "with empty stream"
- (equal? (stream->list (stream)) '()))
- (pass-if "with one-element stream"
- (equal? (stream->list (stream 1)) '(1)))
- (pass-if "with three-element stream"
- (equal? (stream->list (stream 1 2 3)) '(1 2 3))))
+ (pass-if-equal "with empty stream"
+ '()
+ (stream->list (stream)))
+ (pass-if-equal "with one-element stream"
+ '(1)
+ (stream->list (stream 1)))
+ (pass-if-equal "with three-element stream"
+ '(1 2 3)
+ (stream->list strm123)))
(with-test-prefix "stream->list"
(pass-if-exception "throws for non-stream"
@@ -219,14 +222,18 @@
(pass-if-exception "throws for negative count"
'(wrong-type-arg . "negative count")
(stream->list -1 strm123))
- (pass-if "returns empty list for empty stream"
- (eq? (stream->list (stream)) '()))
- (pass-if "without count"
- (equal? (stream->list strm123) '(1 2 3)))
- (pass-if "with count longer than stream"
- (equal? (stream->list 5 strm123) '(1 2 3)))
- (pass-if "with count shorter than stream"
- (equal? (stream->list 3 (stream-from 1)) '(1 2 3))))
+ (pass-if-equal "returns empty list for empty stream"
+ '()
+ (stream->list (stream)))
+ (pass-if-equal "without count"
+ '(1 2 3)
+ (stream->list strm123))
+ (pass-if-equal "with count longer than stream"
+ '(1 2 3)
+ (stream->list 5 strm123))
+ (pass-if-equal "with count shorter than stream"
+ '(1 2 3)
+ (stream->list 3 (stream-from 1))))
(with-test-prefix "stream-append"
(pass-if-exception "throws for non-stream"
@@ -424,33 +431,45 @@
(pass-if-exception "throws when no pattern matches"
'(match-error . "no matching pattern")
(stream-match strm123 (() 42)))
- (pass-if "matches empty stream correctly"
- (eq? (stream-match stream-null (() 'ok)) 'ok))
- (pass-if "matches non-empty stream correctly"
- (eq? (stream-match strm123 (() 'no) (else 'ok)) 'ok))
- (pass-if "matches stream of one element"
- (eqv? (stream-match (stream 1) (() 'no) ((a) a)) 1))
- (pass-if "matches wildcard"
- (eq? (stream-match (stream 1) (() 'no) ((_) 'ok)) 'ok))
- (pass-if "matches stream of three elements"
- (equal? (stream-match strm123 ((a b c) (list a b c))) '(1 2 3)))
- (pass-if "matches first element with wildcard rest"
- (eqv? (stream-match strm123 ((a . _) a)) 1))
- (pass-if "matches first two elements with wildcard rest"
- (equal? (stream-match strm123 ((a b . _) (list a b))) '(1 2)))
- (pass-if "rest variable matches as stream"
- (equal? (stream-match strm123 ((a b . c) (list a b (stream-car c))))
- '(1 2 3)))
- (pass-if "rest variable can match whole stream"
- (equal? (stream-match strm123 (s (stream->list s))) '(1 2 3)))
- (pass-if "successful guard match"
- (eq? (stream-match strm123 ((a . _) (= a 1) 'ok)) 'ok))
- (pass-if "unsuccessful guard match"
- (eq? (stream-match strm123 ((a . _) (= a 2) 'yes) (_ 'no)) 'no))
- (pass-if "unsuccessful guard match with two variables"
- (eq? (stream-match strm123 ((a b c) (= a b) 'yes) (_ 'no)) 'no))
- (pass-if "successful guard match with two variables"
- (eq? (stream-match (stream 1 1 2) ((a b c) (= a b) 'yes) (_ 'no))
'yes)))
+ (pass-if-equal "matches empty stream correctly"
+ 'ok
+ (stream-match stream-null (() 'ok)))
+ (pass-if-equal "matches non-empty stream correctly"
+ 'ok
+ (stream-match strm123 (() 'no) (else 'ok)))
+ (pass-if-equal "matches stream of one element"
+ 1
+ (stream-match (stream 1) (() 'no) ((a) a)))
+ (pass-if-equal "matches wildcard"
+ 'ok
+ (stream-match (stream 1) (() 'no) ((_) 'ok)))
+ (pass-if-equal "matches stream of three elements"
+ '(1 2 3)
+ (stream-match strm123 ((a b c) (list a b c))))
+ (pass-if-equal "matches first element with wildcard rest"
+ 1
+ (stream-match strm123 ((a . _) a)))
+ (pass-if-equal "matches first two elements with wildcard rest"
+ '(1 2)
+ (stream-match strm123 ((a b . _) (list a b))))
+ (pass-if-equal "rest variable matches as stream"
+ '(1 2 3)
+ (stream-match strm123 ((a b . c) (list a b (stream-car c)))))
+ (pass-if-equal "rest variable can match whole stream"
+ '(1 2 3)
+ (stream-match strm123 (s (stream->list s))))
+ (pass-if-equal "successful guard match"
+ 'ok
+ (stream-match strm123 ((a . _) (= a 1) 'ok)))
+ (pass-if-equal "unsuccessful guard match"
+ 'no
+ (stream-match strm123 ((a . _) (= a 2) 'yes) (_ 'no)))
+ (pass-if-equal "unsuccessful guard match with two variables"
+ 'no
+ (stream-match strm123 ((a b c) (= a b) 'yes) (_ 'no)))
+ (pass-if-equal "successful guard match with two variables"
+ 'yes
+ (stream-match (stream 1 1 2) ((a b c) (= a b) 'yes) (_ 'no))))
(with-test-prefix "stream-of"
(pass-if "all 3 clause types work"
@@ -501,12 +520,15 @@
(pass-if-exception "throws if index goes past end of stream"
'(wrong-type-arg . "beyond end of stream")
(stream-ref strm123 5))
- (pass-if "returns first element when index = 0"
- (eqv? (stream-ref nats 0) 1))
- (pass-if "returns second element when index = 1"
- (eqv? (stream-ref nats 1) 2))
- (pass-if "returns third element when index = 2"
- (eqv? (stream-ref nats 2) 3)))
+ (pass-if-equal "returns first element when index = 0"
+ 1
+ (stream-ref nats 0))
+ (pass-if-equal "returns second element when index = 1"
+ 2
+ (stream-ref nats 1))
+ (pass-if-equal "returns third element when index = 2"
+ 3
+ (stream-ref nats 2)))
(with-test-prefix "stream-reverse"
(pass-if-exception "throws for non-stream"
@@ -639,10 +661,10 @@
(stream '(1 1 1) '(2 2 2) '(3 3 3)))))
(with-test-prefix "other tests"
- (pass-if "returns biggest prime under 1000"
- (eqv? (stream-car
- (stream-reverse (stream-take-while (cut < <> 1000) primes)))
- 997))
+ (pass-if-equal "returns biggest prime under 1000"
+ 997
+ (stream-car
+ (stream-reverse (stream-take-while (cut < <> 1000) primes))))
(pass-if "quicksort returns same result as insertion sort"
(stream-equal? (qsort < (stream 3 1 5 2 4))
@@ -653,5 +675,6 @@
(isort < (stream 2 5 1 4 3))))
;; http://www.research.att.com/~njas/sequences/A051037
- (pass-if "returns 1000th Hamming number"
- (eqv? (stream-ref hamming 999) 51200000)))
+ (pass-if-equal "returns 1000th Hamming number"
+ 51200000
+ (stream-ref hamming 999)))
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, srfi-41, updated. v2.0.7-216-ge062929,
Chris K. Jester-Young <=