fix some tests.

This commit is contained in:
Jan Nieuwenhuizen 2016-07-18 22:59:33 +02:00
parent a7e6cb6720
commit 80e6f95f91
3 changed files with 9 additions and 2 deletions

5
mes.c
View file

@ -1241,6 +1241,11 @@ scm *
divide (scm *x/*...*/)
{
int n = 1;
if (x != &scm_nil) {
assert (x->car->type == NUMBER);
n = x->car->value;
x = cdr (x);
}
while (x != &scm_nil)
{
assert (x->car->type == NUMBER);

View file

@ -31,6 +31,8 @@
((and (pair? a) (pair? b))
(and (equal? (car a) (car b))
(equal? (cdr a) (cdr b))))
((and (vector? a) (vector? b))
(equal? (vector->list a) (vector->list b)))
(#t (eq? a b))))
(define (vector . rest) (list->vector rest))

View file

@ -111,7 +111,7 @@
24))
(pass-if "begin" (seq? (begin 'a 'b (+ 1 2)) 3))
(pass-if "string-append" (sequal? (string-append "a" "b" "c") "abc"))
(pass-if "eq?" (not (seq? (string-append "a" "b" "c") "abc")))
(pass-if "eq?" (not (eq? (string-append "a" "b" "c") "abc")))
(pass-if "string-length" (seq? (string-length (string-append "a" "b" "c")) 3))
(pass-if "char" (seq? (char->integer #\A) 65))
(pass-if "char 2" (seq? (char->integer #\101) (char->integer #\A)))
@ -128,7 +128,7 @@
;;(pass-if "vector-set" (sequal? (let ((v #(0 1))) (vector-set! v 1 'q) v) #(0 q)))
;;(pass-if "vector-set" (sequal? (let ((v #(0 1))) (vector-set! v 1 'q) v) #()))
(pass-if "equal?" (sequal? #(1) #(1)))
(pass-if "equal?" (not (sequal? #() #(1))))
(pass-if "equal?" (not (equal? #() #(1))))
(pass-if "memq" (sequal? (memq 'a '(a b c)) '(a b c)))
(pass-if "memq" (sequal? (memq 'b '(a b c)) '(b c)))
(pass-if "memq" (seq? (memq 'd '(a b c)) #f))