The (aux base) module

test/let1: pass

(define (test/let1 _) (let1 (a 1) (⊦= a 1)))
((eta 0.0) (memory #(25165824 2375528 1048576)) (stdout "") (stderr ""))

test/letcar&cdr: pass

(define (test/letcar&cdr _)
  (letcar&cdr
    (((a d) (cons 1 '())) ((aa dd) (cons 2 3)))
    (⊦= a 1)
    (⊦= d '())
    (⊦= aa 2)
    (⊦= dd 3)))
((eta 0.0) (memory #(25165824 2376584 1048576)) (stdout "") (stderr ""))

test/λ: pass

(define (test/λ _)
  (⊦= 5 ((λ (x) (+ x 2)) 3))
  (⊦= 5 ((λ (x) ((λ (y) (+ x y)) 2)) 3))
  (⊦= 5 ((λ (x y) (+ x y)) 2 3)))
((eta 0.0) (memory #(25165824 2377336 1048576)) (stdout "") (stderr ""))

test/letmaptensor: pass

(define (test/letmaptensor _)
  (⊦= '((((2 a #t) (2 a #t)) ((2 1 #t) (2 1 #f)))
          (((3 a #f) (3 a #t)) ((3 2 #f) (3 2 #f)))
          (((4 a #t) (4 a #t)) ((4 3 #t) (4 3 #f))))
        (letmaptensor
          ((x (list 1 2 3)) (y `(a ,x)) (z (list (odd? x) (symbol? y))))
          (list (add1 x) y z))))
((eta 0.0) (memory #(25165824 2377656 1048576)) (stdout "") (stderr ""))

test/letmap: pass

(define (test/letmap _)
  (⊦= '((2 a #t)
          (2 a #t)
          (2 1 #t)
          (2 1 #f)
          (3 a #f)
          (3 a #t)
          (3 2 #f)
          (3 2 #f)
          (4 a #t)
          (4 a #t)
          (4 3 #t)
          (4 3 #f))
        (letmap
          ((x (list 1 2 3)) (y `(a ,x)) (z (list (odd? x) (symbol? y))))
          (list (add1 x) y z))))
((eta 0.0) (memory #(25165824 2378288 1048576)) (stdout "") (stderr ""))

test/procc/λ-memo: pass

(define (test/procc/λ-memo _)
  (define count 0)
  (define fib
    (λ (n)
        (add1! count)
        (cond ((< n 2) n)
              (else
               (let1 (mrow (mi sub1) (mi n)) (+ (fib m) (fib (sub1 m))))))))
  (let1 (v (fib 10)) (⊦= 55 v) (⊦= 177 count))
  (set! count 0)
  (define fib-memo
    (λ-memo
      (n)
      (add1! count)
      (cond ((< n 2) n)
            (else
             (let1 (mrow (mi sub1) (mi n))
                   (+ (fib-memo m) (fib-memo (sub1 m))))))))
  (let1 (v (fib-memo 10)) (⊦= 55 v) (⊦= 11 count)))
((eta 0.001) (memory #(25165824 2378248 1048576)) (stdout "") (stderr ""))

test/load/string: pass

(define (test/load/string _) (⊦= '(+ 3 4) (load/string "(+ 3 4)")))
((eta 0.0) (memory #(25165824 2378952 1048576)) (stdout "") (stderr ""))

test/simdjson/version: pass

The current version of simdjson is 4.2.1.

(define (test/simdjson/version _) (⊦= "4.2.1" (simdjson-get-version)))
((eta 0.0) (memory #(25165824 2379648 1048576)) (stdout "") (stderr ""))

test/simdjson/load-twitter: pass

Loaded a testbed json file twitter.json[1] with the simdjson[2][3] library. The file contains a twitter search result with 100 tweets.

(define (test/simdjson/load-twitter _)
  (define twitter-json (simdjson-load/ondemand "twitter.json"))
  (⊦= 2 (length twitter-json))
  (⊦= '(search_metadata
           ((completed_in 0.087)
            (max_id 505874924095815700)
            (max_id_str "505874924095815681")
            (next_results
              "?max_id=505874847260352512&q=%E4%B8%80&count=100&include_entities=1")
            (query "%E4%B8%80")
            (refresh_url
              "?since_id=505874924095815681&q=%E4%B8%80&include_entities=1")
            (count 100)
            (since_id 0)
            (since_id_str "0")))
        (cadr twitter-json))
  (⊦= 100 (vector-length (cadar twitter-json))))
((eta 0.01) (memory #(25165824 3611784 1048576)) (stdout "") (stderr ""))

test/simdjson/load-twitter/ondemand: pass

Here we show the on demand parsing mode of simdjson[4], which yields equivalent Scheme objects with respect to the DOM parsing.

(define (test/simdjson/load-twitter/ondemand _)
  (⊦= (simdjson-load "twitter.json")
        (simdjson-load/ondemand "twitter.json")))
((eta 0.012) (memory #(25165824 4841592 1048576)) (stdout "") (stderr ""))

test/simdjson/->string: pass

Test for simdjson-load, which loads and parses a JSON file into a Scheme representation.

(define (test/simdjson/->string _)
  (⊦= test/simdjson/->string/expected
        (->string/json (simdjson-load "twitter.json"))))
((eta 0.017) (memory #(12582912 4137392 1048576)) (stdout "") (stderr ""))

test/simdjson/parse: pass

Test for simdjson-parse/ondemand, which parses a JSON string into a Scheme representation on demand.

(define (test/simdjson/parse _)
  (⊦= #(((a 1) (b #(2 5)) (c #t)) ((c 3) (d 4)))
        (simdjson-parse/ondemand
          "[{\"a\":1,\"b\":[2,5],\"c\":true},{\"c\":3,\"d\":4}]")))
((eta 0.0) (memory #(12582912 4138336 1048576)) (stdout "") (stderr ""))

test/libc/fma: pass

Taken from [5]

(define (test/libc/fma _)
  (⊦ fp= 0.0 (+ (* 0.1 10.0) -1.0))
  (⊦ fp= (fp*+ 0.1 10.0 -1.0) (libc-fma 0.1 10.0 -1.0)))
((eta 0.0) (memory #(12582912 4139688 1048576)) (stdout "") (stderr ""))

test/documentation: pass

An initial attempt to support our own documentation framework. The following tests check that documentation can be set and retrieved for functions.

(define (test/documentation _)
  (set! (documentation +) "Returns the sum of its arguments.")
  (define-documented
    (a (λ (x) (+ x 1)))
    (documentation (comment `(p " some comment here"))))
  (documentation! a 'comment "some other comment here.")
  (⊦= '(C_plus ("Returns the sum of its arguments.")) (documentation +))
  (⊦= '((a x)
          ((name a)
           (def (λ (x) (+ x 1)))
           (comment (p " some comment here"))
           (comment "some other comment here.")))
        (documentation a)))
((eta 0.001) (memory #(12582912 4141328 1048576)) (stdout "") (stderr ""))

test/documentation/documentation: pass

Test for documentation of the documentation function itself.

(define (test/documentation/documentation _)
  (documentation!
    documentation
    'comment
    "Test for documentation of the documentation function itself.")
  (⊦= '((aux.base#documentation func)
          ((sxml (p "This function is the fundamental documentation storage and retrieval mechanism."))
           (comment
             "Test for documentation of the documentation function itself.")))
        (documentation documentation)))
((eta 0.0) (memory #(12582912 4142296 1048576)) (stdout "") (stderr ""))

See also