1
0
Fork 0
lesson-lisp/tests/arcana/builtin.scm

36 lines
1.5 KiB
Scheme
Raw Normal View History

2023-05-07 10:11:11 -04:00
(assert-true (null? (arcana/builtin 'foobar)))
2023-05-07 08:06:16 -04:00
2023-05-07 10:11:11 -04:00
; 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))
2023-05-07 08:06:16 -04:00
2023-05-07 10:11:11 -04:00
; 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)))
; 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)))