From 80e6f95f9192d08ba60170ee98a6c7e93a46c32d Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Mon, 18 Jul 2016 22:59:33 +0200 Subject: [PATCH] fix some tests. --- mes.c | 5 +++++ scm.mes | 2 ++ test.mes | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mes.c b/mes.c index 3f2ea530..5c148d0c 100644 --- a/mes.c +++ b/mes.c @@ -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); diff --git a/scm.mes b/scm.mes index 2965d1b3..9ff570d8 100755 --- a/scm.mes +++ b/scm.mes @@ -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)) diff --git a/test.mes b/test.mes index c0e006de..787d56bc 100644 --- a/test.mes +++ b/test.mes @@ -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))