tests: make tests/vector.test compatible with guile

* tests/vector.test (make-vector): Don't rely in string comparison.
* mes/module/mes/type-0.mes (unspecified?): Add function.
This commit is contained in:
Ekaitz 2023-08-24 19:54:06 +02:00
parent 71934c9356
commit 1f14a62e0a
2 changed files with 8 additions and 1 deletions

View File

@ -76,6 +76,9 @@
(define (port? x)
(eq? (core:type x) <cell:port>))
(define (unspecified? x)
(eq? (if #f #f) x))
(define (procedure? p)
(and (or (builtin? p)
(and (pair? p) (eq? (car p) 'lambda))

View File

@ -39,7 +39,11 @@ exec ${MES-bin/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests
(pass-if "vector?" (vector? #(1 2 c)))
(pass-if "vector-length" (seq? (vector-length #(1)) 1))
(pass-if "make-vector" (sequal? (make-vector 3) #(*unspecified* *unspecified* *unspecified*)))
(pass-if "make-vector" (let ((v (make-vector 3)))
(and (= 3 (vector-length v))
(unspecified? (vector-ref v 0))
(unspecified? (vector-ref v 1))
(unspecified? (vector-ref v 2)))))
(pass-if "make-vector 1" (sequal? (make-vector 3 0) #(0 0 0)))
(pass-if "vector-ref" (seq? (vector-ref #(0 1) 1) 1))