2008-03-09 00:25:03 -05:00
|
|
|
|
|
|
|
(library (tests fasl)
|
|
|
|
(export test-fasl)
|
|
|
|
(import (ikarus) (tests framework))
|
|
|
|
|
|
|
|
(define (test x)
|
|
|
|
(printf "test-fasl ~s\n" x)
|
|
|
|
(let-values ([(p e) (open-bytevector-output-port)])
|
|
|
|
(fasl-write x p)
|
|
|
|
(let ([bv (e)])
|
|
|
|
(let ([y (fasl-read (open-bytevector-input-port bv))])
|
|
|
|
(unless (equal? x y)
|
|
|
|
(error 'test-fasl "failed/expected" y x))))))
|
|
|
|
|
|
|
|
(define (test-fasl)
|
|
|
|
(test 12)
|
|
|
|
(test -12)
|
|
|
|
(test 0)
|
|
|
|
(test #t)
|
|
|
|
(test #f)
|
|
|
|
(test '())
|
|
|
|
(test 'hello)
|
|
|
|
(test "Hello")
|
|
|
|
(test '(Hello There))
|
|
|
|
(test 3498798327498723894789237489324)
|
|
|
|
(test -3498798327498723894789237489324)
|
|
|
|
(test 2389478923749872389723894/23498739874892379482374)
|
2008-05-21 03:40:42 -04:00
|
|
|
(test -2389478923749872389723894/23498739874892379482374)
|
|
|
|
(test 127487384734.4)
|
2008-05-24 13:13:01 -04:00
|
|
|
(test (make-rectangular 12 13))
|
|
|
|
(test (make-rectangular 12.0 13.0)))
|
2008-03-09 00:25:03 -05:00
|
|
|
|
2008-05-21 03:40:42 -04:00
|
|
|
)
|
2008-03-09 00:25:03 -05:00
|
|
|
|
|
|
|
|