1
0
Fork 0
lesson-lisp/tests/arcana/builtin.scm
2023-05-07 20:58:55 +04:00

37 lines
1.6 KiB
Scheme

(assert-true (null? (arcana/builtin 'foobar)))
; Testing some builtin procedures for sanity
(assert-equal '(1 2 3) ((arcana/builtin 'list) 1 2 3))
(assert-equal "123456" ((arcana/builtin 'number->string) 123456))
(assert-equal 'foobar ((arcana/builtin 'string->symbol) "foobar"))
(assert-equal "foobar" ((arcana/builtin 'symbol->string) 'foobar))
; Assertions
(assert-true (procedure? (arcana/builtin 'assert-equal)))
(assert-true (procedure? (arcana/builtin 'assert-false)))
(assert-true (procedure? (arcana/builtin 'assert-true)))
; Arcana Lisp internals
(assert-true (procedure? (arcana/builtin 'arcana/builtin)))
(assert-true (procedure? (arcana/builtin 'arcana/parse)))
(assert-true (procedure? (arcana/builtin 'arcana/tokenize)))
(assert-true (procedure? (arcana/builtin 'arcana/typeof)))
; Basic data structures
(assert-true (procedure? (arcana/builtin 'car)))
(assert-true (procedure? (arcana/builtin 'cdr)))
(assert-true (procedure? (arcana/builtin 'cons)))
(assert-true (procedure? (arcana/builtin 'list)))
; Equivalence predicates
(assert-true (procedure? (arcana/builtin 'equal?)))
; Type conversion
(assert-true (procedure? (arcana/builtin 'number->string)))
(assert-true (procedure? (arcana/builtin 'string->symbol)))
(assert-true (procedure? (arcana/builtin 'symbol->string)))
; Logical operators
(assert-true (procedure? (arcana/builtin 'not)))
; Arithmetic operators
(assert-true (procedure? (arcana/builtin '=)))
(assert-true (procedure? (arcana/builtin '+)))
(assert-true (procedure? (arcana/builtin '-)))
; IO
(assert-true (procedure? (arcana/builtin 'display)))
(assert-true (procedure? (arcana/builtin 'newline)))