Debian Codegraph @

test/r7rs-aux.scm

raw
1 ;;
2 ;; Additional R7RS tests that hasn't covered by other tests
3 ;; NB: Most R7RS-large libraries are tested via its srfi counterparts.
4 ;;
5 ;; This is called after ext/* are tested.
6 ;;
7
8 (use gauche.test)
9 (test-start "r7rs-aux")
10
11 (test-section "scheme.bytevector")
12
13 ;; scheme.bytevector exports a few conflicting symbols, so we isolate it.
14 (define-module bytevector-test
15 (use gauche.test)
16 (use scheme.bytevector)
17 (test-module 'scheme.bytevector)
18
19 (let1 lis '(big big-endian little little-endian arm-little-endian)
20 (test* "endianness" lis
21 (map (^x (eval `(endianness ,x) (current-module))) lis))
22 (test* "endianness" (test-error)
23 (eval '(endianness wha) (current-module)))
24 (test* "native-endianness" #t
25 (boolean (memq (native-endianness) lis))))
26
27 (test* "bytevector-[su8]-ref/set!" '#u8(5 255 0 3 4 5)
28 (rlet1 v (u8-list->bytevector '(0 1 2 3 4 5))
29 (bytevector-u8-set! v 0 (bytevector-u8-ref v 5))
30 (bytevector-s8-set! v 1 -1)
31 (bytevector-s8-set! v 2 (+ (bytevector-s8-ref v 1) 1))))
32 (test* "bytevector->u8-list" '(0 255 1 254 2 253)
33 (bytevector->u8-list '#u8(0 255 1 254 2 253)))
34 )
35
36 (test-end)