sbral-suite

Fri Aug 29 13:43:42Z 2025

Creative Commons LicenseCreative Commons LicenseCreative Commons License

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License

Table of contents
  1. test-cons: pass
  2. test-ref: pass
  3. test-list->sbral: pass
  4. test-length: pass
  5. test-update: pass
  6. test-identity: pass

Tests summary

scheme code
((ran 6) (failed 0))

1. test-cons: pass

scheme code
(define (test-cons _)
  (let1 (q empty/sbral)
        (set! q (cons/sbral 'a q))
        (⊦= '((1 a)) q)
        (⊦= 'a (car/sbral q))
        (⊦= '() (cdr/sbral q))
        (set! q (cons/sbral 'b q))
        (⊦= '((1 b) (1 a)) q)
        (⊦= 'b (car/sbral q))
        (⊦= '((1 a)) (cdr/sbral q))
        (set! q (cons/sbral 'c q))
        (⊦= '((3 c (b) (a))) q)
        (⊦= 'c (car/sbral q))
        (⊦= '((1 b) (1 a)) (cdr/sbral q))
        (set! q (cons/sbral 'd q))
        (⊦= '((1 d) (3 c (b) (a))) q)
        (⊦= 'd (car/sbral q))
        (⊦= '((3 c (b) (a))) (cdr/sbral q))
        (set! q (cons/sbral 'e q))
        (⊦= '((1 e) (1 d) (3 c (b) (a))) q)
        (⊦= 'e (car/sbral q))
        (⊦= '((1 d) (3 c (b) (a))) (cdr/sbral q))
        (set! q (cons/sbral 'f q))
        (⊦= '((3 f (e) (d)) (3 c (b) (a))) q)
        (⊦= 'f (car/sbral q))
        (⊦= '((1 e) (1 d) (3 c (b) (a))) (cdr/sbral q))
        (set! q (cons/sbral 'g q))
        (⊦= '((7 g (f (e) (d)) (c (b) (a)))) q)
        (⊦= 'g (car/sbral q))
        (⊦= '((3 f (e) (d)) (3 c (b) (a))) (cdr/sbral q))))
scheme code
((eta 0.0) (memory #(6291456 965056 1048576)) (stdout "") (stderr ""))

2. test-ref: pass

scheme code
(define (test-ref _)
  (let1 (q (list->sbral '(a b c d e f g)))
        (⊦= 'a (sbral-ref q 0))
        (⊦= 'b (sbral-ref q 1))
        (⊦= 'c (sbral-ref q 2))
        (⊦= 'd (sbral-ref q 3))
        (⊦= 'e (sbral-ref q 4))
        (⊦= 'f (sbral-ref q 5))
        (⊦= 'g (sbral-ref q 6))))
scheme code
((eta 0.0) (memory #(6291456 966160 1048576)) (stdout "") (stderr ""))

3. test-list->sbral: pass

scheme code
(define (test-list->sbral _)
  (let* ((l '(a b c d e f g)) (ll (iota 100)))
    (⊦= '((7 a (b (c) (d)) (e (f) (g)))) (list->sbral l))
    (⊦= '((3 0 (1) (2))
            (3 3 (4) (5))
            (31
             6
             (7
              (8 (9 (10) (11)) (12 (13) (14)))
              (15 (16 (17) (18)) (19 (20) (21))))
             (22
              (23 (24 (25) (26)) (27 (28) (29)))
              (30 (31 (32) (33)) (34 (35) (36)))))
            (63
             37
             (38
              (39
               (40 (41 (42) (43)) (44 (45) (46)))
               (47 (48 (49) (50)) (51 (52) (53))))
              (54
               (55 (56 (57) (58)) (59 (60) (61)))
               (62 (63 (64) (65)) (66 (67) (68)))))
             (69
              (70
               (71 (72 (73) (74)) (75 (76) (77)))
               (78 (79 (80) (81)) (82 (83) (84))))
              (85
               (86 (87 (88) (89)) (90 (91) (92)))
               (93 (94 (95) (96)) (97 (98) (99)))))))
          (list->sbral ll))))
scheme code
((eta 0.0) (memory #(6291456 970624 1048576)) (stdout "") (stderr ""))

4. test-length: pass

scheme code
(define (test-length _)
  (let* ((l '(a b c d e f g)) (q (list->sbral l)))
    (⊦= (length l) (length/sbral q))))
scheme code
((eta 0.0) (memory #(6291456 971872 1048576)) (stdout "") (stderr ""))

5. test-update: pass

scheme code
(define (test-update _)
  (let1 (q (list->sbral '(a b c d e f g)))
        (⊦= '((7 a (b (c) (d)) (e (f) (g)))) q)
        (⊦= '((7 a (b (c) (d)) (hello (f) (g)))) (update/sbral 4 'hello q))))
scheme code
((eta 0.0) (memory #(6291456 973000 1048576)) (stdout "") (stderr ""))

6. test-identity: pass

scheme code
(define (test-identity _)
  (let1 (l '(a b c d e f g)) (⊦= l (sbral->list (list->sbral l)))))
scheme code
((eta 0.0) (memory #(6291456 973296 1048576)) (stdout "") (stderr ""))