test/test-library.rkt
#lang racket

(require
  rackunit
  racket/sandbox
  racket/require
  (path-up "self/require.rkt")
  (path-up "self/module-path.rkt")
  (cce-in sandbox))

(provide test-library)

(define dracula
  (make-trusted-evaluator module-path:acl2))

(define-syntax (test-dracula stx)
  (syntax-case stx ()
    [(_ expr result)
     (syntax/loc stx
       (let* ([e 'expr])
         (test-case (format "~s" e)
                    (check-equal? (dracula e) result))))]))

(define-syntax (test-dracula-error stx)
  (syntax-case stx ()
    [(_ expr)
     (syntax/loc stx
       (let* ([e 'expr])
         (test-case (format "~s" e)
                    (check-exn exn:fail:contract?
                               (lambda () (dracula e))))))]))

(define-syntax (test-dracula-syntax-error stx)
  (syntax-case stx ()
    [(_ expr)
     (syntax/loc stx
       (let* ([e 'expr])
         (test-case (format "~s" e)
                    (check-exn exn:fail:syntax?
                               (lambda () (dracula e))))))]))

(define t 't)
(define nil '())

(define test-library
  (test-suite "Dracula Functions"
    (test-suite "Pairs"
      (test-suite "car, cdr and friends"
        (test-dracula (car '(1 2 4 6)) 1)
        (test-dracula (car nil) nil)
        (test-dracula-error (car "violates guard"))
        (test-dracula (caaaar '((((3 4) 6) 8) 10)) 3)
        (test-dracula (caaadr '(1 ((2 3 4) 5) 6)) 2)
        (test-dracula (caaar '(((3 4) 6) 8)) 3)
        (test-dracula (caadar '((6 ((8 4) 9) 10) 9)) '(8 4))
        (test-dracula (caaddr '(5 6 ((7 8) 9))) '(7 8))
        (test-dracula (caadr '(6 ((7 8) 9))) '(7 8))
        (test-dracula (caar '((7 8) 9)) 7)
        (test-dracula (cadaar '((((3 4) 6) 8) 10)) 6)
        (test-dracula (cadadr '(1 ((2) 3))) 3)
        (test-dracula (cadar '((2 4))) 4)
        (test-dracula (caddar '((2 4 6))) 6)
        (test-dracula (cadddr '(1 2 4 6)) 6)
        (test-dracula (caddr '(1 2 4 6)) 4)
        (test-dracula (cadr '(1 2 4 6)) 2)
        (test-dracula (cdaaar '((((1 2) 3) 4) 5)) '(2))
        (test-dracula (cdaadr '(0 (((1 2) 3) 4) 5)) '(3))
        (test-dracula (cdaar '((((1 2) 3) 4) 5)) '(3))
        (test-dracula (cdadar '((((1 2) 3) (4 5)) 6)) '(5))
        (test-dracula (cdaddr '(0 7 (((1 2) 3) 4) 6)) '(4))
        (test-dracula (cdadr '(1 (((2 3) 4) 5) 6)) '(5))
        (test-dracula (cdar '((1 2))) '(2))
        (test-dracula (cddaar '(((0 (1 2) 3)))) '(3))
        (test-dracula (cddadr '(0 (1 2 3))) '(3))
        (test-dracula (cddar '((1 2 3))) '(3))
        (test-dracula (cdddar '((1 2 3 4))) '(4))
        (test-dracula (cddddr '(1 2 3 4 5)) '(5))
        (test-dracula (cddr '(1 2 3 4 5)) '(3 4 5))
        (test-dracula (cdr (cons 1 (cons 2 nil))) '(2))
        (test-dracula (cdr nil) nil)
        (test-dracula-error (cdr "violates guard"))
        (test-dracula (rest (list 'w 'x 'y 'z)) '(x y z)))
      (test-suite "other"
        (test-dracula (consp nil) nil)
        (test-dracula (consp (cons 1 nil)) t)
        (test-dracula (cons 4 (cons 3 nil)) '(4 3))))
    (test-suite "Lists" 
      (test-suite "List Constructors"
        (test-dracula (append nil nil) nil)
        (test-dracula (append nil (list 1 2)) '(1 2))
        (test-dracula (append (list 1 2) (list 3 4)) '(1 2 3 4))
        (test-dracula (binary-append (list 1 2 3) (list 4 5 6)) (list 1 2 3 4 5 6))
        (test-dracula (binary-append (list 1 2 3) 4) '(1 2 3 . 4))
        (test-dracula-error (binary-append 5 "<-error"))
        (test-dracula (list) nil)
        (test-dracula (list 1 2 3) '(1 2 3))
        (test-dracula (list* 5 6 '(7 8 9)) '(5 6 7 8 9))
        (test-dracula (list* 1 2 3) '(1 2 . 3))
        (test-dracula-error (list*))
        (test-dracula (mv 1 2 3 4) '(1 2 3 4))
        (test-dracula (quote a) 'a)
        (test-dracula (quote (1 2 3 4)) '(1 2 3 4))
        (test-dracula (quasiquote a) `a)
        (test-dracula '(list (unquote a) b c d) '(list ,a b c d))
        (test-dracula (revappend nil nil) nil)
        (test-dracula (revappend nil (list 1 2)) '(1 2))
        (test-dracula (revappend (list 1 2) (list 3 4)) '(2 1 3 4))
        (test-dracula (revappend (list 1 2) 3) '(2 1 . 3))
        (test-dracula-error (revappend "not a list" nil)))
      (test-suite "List Recognizers & Predicates"
        (test-dracula (atom-listp  (list 2 3 4)) t)
        (test-dracula (atom-listp (list (list 23 24) 45)) nil)
        (test-dracula (character-listp (list #\a #\b)) t)
        (test-dracula (character-listp (list #\a "b")) nil)
        (test-dracula (endp nil) t)
        (test-dracula (endp (cons 2 nil)) nil)
        (test-dracula-error (endp "violates guard"))
        (test-dracula (eqlable-listp nil) t)
        (test-dracula (eqlable-listp (cons 4 nil)) t)
        (test-dracula (eqlable-listp t) nil)
        (test-dracula (integer-listp nil) t)
        (test-dracula (integer-listp (list 24 -21 95)) t)
        (test-dracula (integer-listp (list 53 44 "number")) nil)
        (test-dracula (keyword-value-listp (list :a 1 :b 2 :c 3)) t)
        (test-dracula (keyword-value-listp (list 'a 1 'b 'c 3)) nil)
        (test-dracula (listp nil) t)
        (test-dracula (listp (cons 4 nil)) t)
        (test-dracula (listp t) nil)
        (test-dracula (member 1 '(1 2 3)) '(1 2 3))
        (test-dracula (member 1 '(2 4 6)) nil)
        (test-dracula (member 3 '(1 2 3 4 5)) '(3 4 5))
        (test-dracula (member 3 '(2 4 6 8 10)) nil)
        (test-dracula (member "abc" '(1 2 3)) nil)
        (test-dracula-error (member "abc" (list "a" "b" "abc")))
        (test-dracula (member-eq 'a '(a b c)) '(a b c))
        (test-dracula (member-eq 'a '(x y z)) nil)
        (test-dracula-error (member-eq 3 '(1 2 3 4 5)))
        (test-dracula-error (member-eq 3 '(2 4 6 8 10)))
        (test-dracula-error (member-eq "abc" '(1 2 3)))
        (test-dracula-error (member-eq "abc" (list "a" "b" "abc")))
        (test-dracula (member-equal "a" '("a" "b" "c")) '("a" "b" "c"))
        (test-dracula (member-equal "a" '("x" "y" "z")) nil)
        (test-dracula (member-equal 3 '(1 2 3 4 5)) '(3 4 5))
        (test-dracula (member-equal 3 '(2 4 6 8 10)) nil)
        (test-dracula (member-equal "abc" '(1 2 3)) nil)
        (test-dracula (member-equal "abc" (list "a" "b" "abc")) (list "abc"))
        (test-dracula (no-duplicatesp (list 1 2 3)) t)
        (test-dracula (no-duplicatesp (list 1 2 1)) nil)
        (test-dracula-error (no-duplicatesp (list "a" "b" "c")))
        (test-dracula (no-duplicatesp-equal (list "a" "b" "c")) t)
        (test-dracula (no-duplicatesp-equal (list "a" "b" "a")) nil)
        (test-dracula (null nil) t)
        (test-dracula (null (list 1 2 3)) nil)
        (test-dracula (proper-consp (list 1 2 3)) t)
        (test-dracula (proper-consp (cons 1 2)) nil)
        (test-dracula (rational-listp (list 1 2/5 3)) t)
        (test-dracula (rational-listp (list 1 2/5 "number")) nil)
        (test-dracula (standard-char-listp (list #\a #\b #\c)) t)
        (test-dracula (standard-char-listp (list 1 2 3)) nil)
        (test-dracula (string-listp (list "ab" "cd" "ef")) t)
        (test-dracula (string-listp (list 1 2 3)) nil)
        (test-dracula (symbol-listp (list 'ab 'cd 'ef)) t)
        (test-dracula (symbol-listp (list 1 2 3)) nil)
        (test-dracula (true-list-listp (list 1 2 3 4 5)) nil)
        (test-dracula (true-list-listp '((1) (2) (3) (4) (5))) t)
        (test-dracula (true-listp (list 1 2 3 4 5)) t)
        (test-dracula (true-listp "list") nil))
      (test-suite "List Misc."
        (test-dracula (butlast (list 1 2 3) 1) '(1 2))
        (test-dracula (butlast (list 1 2 3) 3) nil)
        (test-dracula (butlast (list 1 2 3) 10) nil)
        (test-dracula-error (butlast (list 1 2 3) -1))
        (test-dracula (fix-true-list (list 1 2 3)) '(1 2 3))
        (test-dracula (fix-true-list (cons 1 (cons 2 3))) '(1 2))
        (test-dracula (len nil) 0)
        (test-dracula (len "string") 0)
        (test-dracula (len t) 0)
        (test-dracula (len (list 1 2 3 4 5)) 5)
        (test-dracula (nth 2 (list 1 2 3)) 3)
        (test-dracula (nth 4 (list 1 2 1)) nil)
        (test-dracula (nth 0 nil) nil)
        (test-dracula (nth 0 (list 1 2 3)) 1)
        (test-dracula (make-list 3) '(() () ()))
        (test-dracula-error (make-list -1))
        (test-dracula-error (nth "string" (list 1 2 3)))
        (test-dracula-error (nth -1 (list 1 2 3)))
        (test-dracula-error (nth 2 "string"))
        (test-dracula (nthcdr 2 (list 1 2 3)) '(3))
        (test-dracula (nthcdr 3 (list 1 2 1)) '())
        (test-dracula (pairlis$ (list 'a 'b 'c) (list 1 2 3)) '((a . 1) (b . 2) (c . 3)))
        (test-dracula (pairlis$ nil nil) nil)
        (test-dracula (remove 3 (list 1 2 3 4)) '(1 2 4))
        (test-dracula (remove 3 (list 5 6 7 8)) '(5 6 7 8))
        (test-dracula (remove "abc" (list 1 2 3 4)) '(1 2 3 4))
        (test-dracula (remove 2 (list 1 2 "abc" 4)) (list 1 "abc" 4))
        (test-dracula-error (remove "abc" (list 1 2 "abc" 4)))
        (test-dracula (remove1 3 (list 1 2 3 3 4)) '(1 2 3 4))
        (test-dracula (remove1 3 (list 5 6 7 8)) '(5 6 7 8))
        (test-dracula (remove1 "abc" (list 1 2 3 4)) '(1 2 3 4))
        (test-dracula (remove1 2 (list 1 2 "abc" 4)) (list 1 "abc" 4))
        (test-dracula-error (remove1 "abc" (list 1 2 "abc" 4)))
        (test-dracula (remove-duplicates (list 1 2 2 3 2 4)) '(1 3 2 4))
        (test-dracula (remove-duplicates "abCdCeCfFgh") "abdeCfFgh")
        (test-dracula-error (remove-duplicates (list "a" "b" "c" "a" "d" "e")))
        (test-dracula (remove-duplicates-equal (list "a" "b" "b" "c" "d" "b")) '("a" "c" "d" "b"))
        (test-dracula-error (remove-duplicates-equal "abCdCeCfFgh"))
        (test-dracula (remove-eq 'x (list 'w 'x 'y 'z)) '(w y z))
        (test-dracula-error (remove-eq 'x "wxyz"))
        (test-dracula-error (remove-eq 2 (list 1 2 3 4)))
        (test-dracula (remove-equal "x" (list "w" "x" "y" "z")) '("w" "y" "z"))
        (test-dracula (remove1 2 (list 1 2 2 3 2 4)) '(1 2 3 2 4))
        (test-dracula (remove1-eq 'x (list 'w 'x 'x 'y 'x 'z)) '(w x y x z))
        (test-dracula (remove1-equal "x" (list "w" "x" "x" "y" "x" "z")) '("w" "x" "y" "x" "z"))
        (test-dracula (reverse (list 1 2 3 4)) '(4 3 2 1))
        (test-dracula (reverse "abcd") "dcba")
        (test-dracula-error (reverse 12345))
        (test-dracula (subst 2 1 (list 1 1 1 3 1 1 1)) '(2 2 2 3 2 2 2))
        (test-dracula (take 3 (list 1 2 3 4 5)) '(1 2 3))
        (test-dracula (take 0 (list 1 2 3 4 5)) nil)
        (test-dracula-error (take -1 (list 1 2 3 4 5)))
        (test-dracula-error (take 2 (cons 1 2)))
        (test-dracula (update-nth 3 'z '(a b c d e)) '(a b c z e))
        (test-dracula (update-nth 8 'z '(a b c d e)) '(a b c d e () () () z))
        (test-dracula-error (update-nth -1 'z '(a b c d e)))
        (test-dracula-error (update-nth 1 'z "not a list"))
        (test-dracula (first (list 1 2 3 4 5 6 7 8)) 1)
        (test-dracula (second (list 1 2 3 4 5)) 2)
        (test-dracula (third (list 1 2 3 4 5 6 7 8 9 10)) 3)
        (test-dracula (fourth (list 1 2 3 4 5 6 7 8)) 4)
        (test-dracula (fifth (list 1 2 3 4 5 6 7 8)) 5)
        (test-dracula (sixth (list 1 2 3 4 5 6 7 8 9 10)) 6)
        (test-dracula (seventh (list 1 2 3 4 5 6 7 8 9 10)) 7)
        (test-dracula (eighth (list 1 2 3 4 5 6 7 8)) 8)
        (test-dracula (ninth (list 1 2 3 4 5 6 7 8 9 10)) 9)
        (test-dracula (tenth (list 1 2 3 4 5 6 7 8 9 10)) 10)
        (test-dracula (last (list 1 2 3 4 5)) '(5))))
    (test-suite "Association lists"
      (test-dracula (acons "hello" 5 nil) '(("hello" . 5)))
      (test-dracula (acons "hello" 5 (list (cons "bye" 6))) (list (cons "hello" 5) (cons "bye" 6)))
      (test-dracula-error (acons 'key "datum" (list 1 2 "not an alistp")))
      (test-dracula (alistp nil) t)
      (test-dracula (alistp (acons "four" 4 nil)) t)
      (test-dracula (alistp t) nil)
      (test-dracula (eqlable-alistp nil) t)
      (test-dracula (eqlable-alistp (list (cons 4 6) (cons 7 8))) t)
      (test-dracula (eqlable-alistp t) nil)
      (test-dracula (assoc 'a (list (cons 'a 'b) (cons 'c 'd))) '(a . b))
      (test-dracula (assoc 'z (list (cons 'a 'b) (cons 'c 'd))) nil)
      (test-dracula (assoc-eq 'a (list (cons 'a 'b) (cons 'c 'd))) '(a . b))
      (test-dracula (assoc-eq 'z (list (cons 'a 'b) (cons 'c 'd))) nil)
      (test-dracula (assoc-equal "c" (list (cons "a" "b") (cons "c" "d"))) '("c" . "d"))
      (test-dracula (assoc-equal "z" (list (cons "a" "b") (cons "c" "d"))) nil)
      (test-dracula (assoc-keyword :b '(:a 1 :b 2 :c 3)) '(:b 2 :c 3))
      (test-dracula (assoc-keyword :d '(:a 1 :b 2 :c 3)) nil)
      (test-dracula (assoc-string-equal "c" (list (cons "a" "b") (cons "c" "d"))) '("c" . "d"))
      (test-dracula (assoc-string-equal "z" (list (cons "a" "b") (cons "c" "d"))) nil)
      (test-dracula (rassoc 'd (list (cons 'a 'b) (cons 'c 'd))) '(c . d))
      (test-dracula (rassoc 'z (list (cons 'a 'b) (cons 'c 'd))) nil)
      (test-dracula (rassoc-eq 'd (list (cons 'a 'b) (cons 'c 'd))) '(c . d))
      (test-dracula (rassoc-eq 'z (list (cons 'a 'b) (cons 'c 'd))) nil)
      (test-dracula (rassoc-equal "d" (list (cons "a" "b") (cons "c" "d"))) '("c" . "d"))
      (test-dracula (rassoc-equal "z" (list (cons "a" "b") (cons "c" "d"))) nil)
      (test-dracula (strip-cars (list (cons 'a 'b) (cons 'c 'd))) '(a c))
      (test-dracula-error (strip-cars (list 1 2 3)))
      (test-dracula (strip-cdrs (list (cons 'a 'b) (cons 'c 'd))) '(b d))
      (test-dracula-error (strip-cdrs (list 1 2 3)))
      (test-dracula (standard-string-alistp (list (cons "abc" 1) (cons "def" 2))) t)
      (test-dracula (symbol-alistp (list (cons 'a 'b) (cons 'c 'd))) t)
      (test-dracula (symbol-alistp (list 'ab 'cd 'ef)) nil)
      (test-dracula (put-assoc-eq 'a 5 nil) '((a . 5)))
      (test-dracula (put-assoc-eq 'a 5 (list (cons 'a 4) (cons 'b 6))) '((a . 5) (b . 6)))
      (test-dracula-error (put-assoc-eq "string" 5 (list 1 2 3)))
      (test-dracula (put-assoc-eql 'a 5 nil) '((a . 5)))
      (test-dracula (put-assoc-eql 'a 5 (list (cons 'a 4) (cons 'b 6))) '((a . 5) (b . 6)))
      (test-dracula-error (put-assoc-eql "string" 5 (list (cons "string2" 'a))))
      (test-dracula (put-assoc-equal "a" 5 nil) '(("a" . 5)))
      (test-dracula (put-assoc-equal "a" 5 (list (cons "a" 4) (cons "b" 6))) '(("a" . 5) ("b" . 6)))
      (test-dracula-error (put-assoc-equal 1 'a (list "not an alist"))))
    (test-suite "Sets"
      (test-dracula (add-to-set-eq 'hello nil) '(hello))
      (test-dracula (add-to-set-eq 'hello (list 'hello)) '(hello))
      (test-dracula (add-to-set-eq "string" (list 'hello 'goodbye)) (list "string" 'hello 'goodbye))
      (test-dracula-error (add-to-set-eq "string1" (list "string2")))
      (test-dracula (add-to-set-eql 'hello nil) '(hello))
      (test-dracula (add-to-set-eql 'hello (list 'hello)) '(hello))
      (test-dracula (add-to-set-eql 1 (list 'hello 1 'bye 2)) (list 'hello 1 'bye 2))
      (test-dracula-error (add-to-set-eql "string1" (list "string2")))
      (test-dracula (add-to-set-equal "hello" nil) '("hello"))
      (test-dracula (add-to-set-equal "hello" (list "hello")) '("hello"))
      (test-dracula (add-to-set-equal "string1" (list "string2")) (list "string1" "string2"))
      (test-dracula-error (add-to-set-equal 1 "string"))
      (test-dracula (intersectp-eq (list 'a 'b 'c) (list 'x 'y 'z)) nil)
      (test-dracula (intersectp-eq (list 'a 'b 'c) (list 'a 'y 'z)) t)
      (test-dracula-error (intersectp-eq (list 'a "b" 'c) (list 'a 'y 'z)))
      (test-dracula (intersectp-equal (list "a" "b" "c") (list "x" "y" "z")) nil)
      (test-dracula (intersectp-equal (list "a" "b" "c") (list "a" "y" "z")) t)
      (test-dracula (set-difference-eq (list 'a 'b 'c) (list 'a 'c)) '(b))
      (test-dracula (set-difference-eq (list "string") (list 'a 'c)) (list "string"))
      (test-dracula (set-difference-eq (list 'a 'c) (list "string")) (list 'a 'c))
      (test-dracula-error (set-difference-eq (list "string1") (list "string2")))
      (test-dracula (set-difference-equal (list "a" "b" "c") (list "a" "c")) '("b"))
      (test-dracula-error (set-difference-equal "abc" "bc"))
      (test-dracula (subsetp (list 1 2 3) (list 2 3)) nil)
      (test-dracula (subsetp (list 1 2 3) (list 1 2 3 4 5)) t)
      (test-dracula (subsetp (list "a" "b" "c") (list 1 2 3 4 5)) nil)
      (test-dracula (subsetp (list 1 2) (list 1 "1" 2 "2")) t)
      (test-dracula-error (subsetp (list "a" "b") (list "a" "b" "c")))
      (test-dracula (subsetp-equal (list "a" "b" "c") (list "b" "c")) nil)
      (test-dracula (subsetp-equal (list "a" "b" "c") (list "a" "b" "c" "d" "e")) t)
      (test-dracula (union-eq (list 'a 'b 'c) (list 'c 'd 'e)) '(a b c d e))
      (test-dracula-error (union-eq (list 1 2 3) (list 'a 'b 'c)))
      (test-dracula-error (union-eq (list 'a 'b 'c) "not a list"))
      (test-dracula (union-equal (list "a" "b" "c") (list "c" "d" "e")) '("a" "b" "c" "d" "e"))
      (test-dracula-error (union-equal "not a list" (list 1 2 3))))
    (test-suite "Text"
      (test-suite "Strings"
        (test-dracula (make-character-list "hello") nil)
        (test-dracula (string "abc") "abc")
        (test-dracula (string 'abc) "ABC")
        (test-dracula (string #\a) "a")
        (test-dracula (string-append "ab" "cd") "abcd")
        (test-dracula (string-downcase "ABCdef") "abcdef")
        (test-dracula (string-equal "ab" "cd") nil)
        (test-dracula (string-equal "ab" "ab") t)
        (test-dracula (string-upcase "ABCdef") "ABCDEF")
        (test-dracula (string< "ab" "cd") 0)
        (test-dracula (string< "ab" "abc") 2)
        (test-dracula (string<= "ab" "cd") 0)
        (test-dracula (string<= "ab" "ab") 2)
        (test-dracula (string> "ab" "cd") nil)
        (test-dracula (string> "ab" "ab") nil)
        (test-dracula (string> "ba" "ab") 0)
        (test-dracula (string>= "ab" "cd") nil)
        (test-dracula (string>= "ab" "ab") 2)
        (test-dracula (string>= "ba" "ab") 0)
        (test-dracula (stringp "abcd") t)
        (test-dracula (stringp nil) nil))
      (test-suite "Characters"
        (test-dracula (alpha-char-p #\a) t)
        (test-dracula (alpha-char-p #\3) nil)
        (test-dracula (char "hello" 0) #\h)
        (test-dracula (char "hello" 4) #\o)
        (test-dracula-error (char "hello" 100))
        (test-dracula-error (char 'symbol 3))
        (test-dracula-error (char "hello" -1))
        (test-dracula (char< #\a #\b) t)
        (test-dracula (char< #\b #\a) nil)
        (test-dracula (char< #\b #\b) nil)
        (test-dracula (char< #\A #\a) t)
        (test-dracula-error (char< 5 10))
        (test-dracula (char<= #\a #\b) t)
        (test-dracula (char<= #\b #\a) nil)
        (test-dracula (char<= #\b #\b) t)
        (test-dracula (char<= #\A #\a) t)
        (test-dracula-error (char<= 5 10))
        (test-dracula (char> #\a #\b) nil)
        (test-dracula (char> #\b #\a) t)
        (test-dracula (char> #\b #\b) nil)
        (test-dracula (char> #\A #\a) nil)
        (test-dracula-error (char> 5 10))
        (test-dracula (char>= #\a #\b) nil)
        (test-dracula (char>= #\b #\a) t)
        (test-dracula (char>= #\b #\b) t)
        (test-dracula (char>= #\A #\a) nil)
        (test-dracula-error (char>= 5 10))
        (test-dracula (char-code #\a) 97)
        (test-dracula-error (char-code 'symbol))
        (test-dracula (char-downcase #\A) #\a)
        (test-dracula-error (char-downcase 'symbol))
        (test-dracula (char-equal #\a #\a) t)
        (test-dracula (char-equal #\A #\a) t)
        (test-dracula-error (char-equal 'a #\a))
        (test-dracula (char-upcase #\a) #\A)
        (test-dracula-error (char-upcase 'symbol))
        (test-dracula (characterp #\a) t)
        (test-dracula (characterp "a") nil)
        (test-dracula (code-char 97) #\a)
        (test-dracula (digit-char-p #\3) 3)
        (test-dracula (digit-char-p #\a) nil)
        (test-dracula (digit-to-char 7) #\7)
        (test-dracula (lower-case-p #\a) t)
        (test-dracula (lower-case-p #\A) nil)
        (test-dracula (upper-case-p #\A) t)
        (test-dracula (upper-case-p #\a) nil)
        (test-dracula-error (upper-case-p 5))
        (test-dracula-error (upper-case-p 'a))))
    (test-suite "Symbols"
      (test-dracula (intern "a" "ACL2") 'a)
      (test-dracula (intern "b" "KEYWORD") ':b)
      (test-dracula (intern$ "c" "ACL2") 'c)
      (test-dracula (intern$ "d" "KEYWORD") ':d)
      (test-dracula (intern-in-package-of-symbol "e" 'symbol) 'e)
      (test-dracula (intern-in-package-of-symbol "f" ':keyword) ':f)
      (test-dracula (keywordp :hints) t)
      (test-dracula (keywordp 'hints) nil)
      (test-dracula (symbol-< 'ab 'cd) t)
      (test-dracula (symbol-< 'ab 'ab) nil)
      (test-dracula (symbol-< 'ba 'ab) nil)
      (test-dracula-error (symbol-< "string" 'ab))
      (test-dracula (symbol-name 'hello) "HELLO")
      (test-dracula-error (symbol-name "uh-oh"))
      (test-dracula (symbol-package-name 'hello) "COMMON-LISP")
      (test-dracula-error (symbol-package-name "string"))
      (test-dracula (symbolp 'hello) t)
      (test-dracula (symbolp "world") nil))
    (test-suite "Numbers"
      (test-dracula (*) 1)
      (test-dracula (* 2) 2)
      (test-dracula (* 5 2) 10)
      (test-dracula (* 1 2 3) 6)
      (test-dracula-error (* "5"))
      (test-dracula (+) 0)
      (test-dracula (+ 2) 2)
      (test-dracula (+ 1 2 3) 6)
      (test-dracula-error (+ "5"))
      (test-dracula (- 5 3) 2)
      (test-dracula (- 5) -5)
      (test-dracula-syntax-error (-))
      (test-dracula-syntax-error (- 10 5 2))
      (test-dracula (/ 16 4) 4)
      (test-dracula-syntax-error (/))
      (test-dracula-syntax-error (/ 100 5 2))
      (test-dracula (/= 2 2) nil)
      (test-dracula (/= 3 2) t)
      (test-dracula (1+ 1) 2)
      (test-dracula (1- 1) 0)
      (test-dracula (< 1 2) t)
      (test-dracula (< 2 1) nil)
      (test-dracula (< 2 2) nil)
      (test-dracula (<= 1 2) t)
      (test-dracula (<= 2 1) nil)
      (test-dracula (<= 2 2) t)
      (test-dracula (= 1 2) nil)
      (test-dracula (= 2 1) nil)
      (test-dracula (= 2 2) t)
      (test-dracula (> 1 2) nil)
      (test-dracula (> 2 1) t)
      (test-dracula (> 2 2) nil)
      (test-dracula (>= 1 2) nil)
      (test-dracula (>= 2 1) t)
      (test-dracula (>= 2 2) t)
      (test-dracula (ash 2 2) 8)
      (test-dracula (abs 1) 1)
      (test-dracula (abs -1) 1)
      (test-dracula-error (abs (complex 1 1)))
      (test-dracula (acl2-numberp 1) t)
      (test-dracula (acl2-numberp 12/5) t)
      (test-dracula (acl2-numberp "yes") nil)
      (test-dracula (binary-* 9 8) 72)
      (test-dracula-syntax-error (binary-*))
      (test-dracula-syntax-error (binary-* 1))
      (test-dracula-syntax-error (binary-* 1 2 3))
      (test-dracula (binary-+ 9 8) 17)
      (test-dracula-syntax-error (binary-+))
      (test-dracula-syntax-error (binary-+ 1))
      (test-dracula-syntax-error (binary-+ 1 2 3))
      (test-dracula (ceiling 14 3) 5)
      (test-dracula (ceiling 15 3) 5)
      (test-dracula (complex 2 1) '2+1i)
      (test-dracula (complex 2 0) 2)
      (test-dracula (complex 0 2) '0+2i)
      (test-dracula-error (complex (complex 2 3) 5))
      (test-dracula (complex-rationalp 3) nil)
      (test-dracula (complex-rationalp (complex 3 0)) nil)
      (test-dracula (complex-rationalp t) nil)
      (test-dracula (complex-rationalp (complex 3 1)) t)
      (test-dracula (complex/complex-rationalp 3) nil)
      (test-dracula (complex/complex-rationalp (complex 3 0)) nil)
      (test-dracula (complex/complex-rationalp t) nil)
      (test-dracula (complex/complex-rationalp (complex 3 1)) t)
      (test-dracula (conjugate (complex 3 1)) '3-1i)
      (test-dracula (denominator 5) 1)
      (test-dracula (denominator 5/3) 3)
      (test-dracula (evenp 1) nil)
      (test-dracula (evenp 2) t)
      (test-dracula (explode-nonnegative-integer 925 10 nil) '(#\9 #\2 #\5))
      (test-dracula (explode-nonnegative-integer 325 16 nil) '(#\1 #\4 #\5))
      (test-dracula (explode-nonnegative-integer 325 16 (list 'a 'b 'c)) '(#\1 #\4 #\5 a b c))
      (test-dracula-error (explode-nonnegative-integer -325 16 nil))
      (test-dracula (expt 10 2) 100)
      (test-dracula (expt 10 -2) 1/100)
      (test-dracula-error (expt 0 -2))
      (test-dracula-error (expt 10 (/ 1 2)))
      (test-dracula (fix 20) 20)
      (test-dracula (fix 2/3) 2/3)
      (test-dracula (fix "hello") 0)
      (test-dracula (fix nil) 0)
      (test-dracula (floor 4 2) 2)
      (test-dracula (floor 4 3) 1)
      (test-dracula-error (floor "5" 3))
      (test-dracula (ifix 16) 16)
      (test-dracula (ifix 22/3) 0)
      (test-dracula (ifix "hello") 0)
      (test-dracula (imagpart (complex 3 2)) 2)
      (test-dracula (imagpart 5) 0)
      (test-dracula-error (imagpart "5"))
      (test-dracula (implies (< 2 3) (< 2 4)) t)
      (test-dracula (int= 1 2) nil)
      (test-dracula (int= 2 1) nil)
      (test-dracula (int= 2 2) t)
      (test-dracula-error (int= 1/2 2))
      (test-dracula (integer-length 12) 4)
      (test-dracula (integer-length 1234) 11)
      (test-dracula (integerp 12) t)
      (test-dracula (integerp '12) t)
      (test-dracula (integerp nil) nil)
      (test-dracula (logand) -1)
      (test-dracula (logand 4) 4)
      (test-dracula (logand "5") "5")
      (test-dracula (logand 10 6) 2)
      (test-dracula (logior) 0)
      (test-dracula (logior 4) 4)
      (test-dracula (logior 10 5) 15)
      (test-dracula (logior "5") "5")
      (test-dracula (logxor) 0)
      (test-dracula (logxor 4) 4)
      (test-dracula (logxor 15 9) 6)
      (test-dracula (logxor "5") "5")
      (test-dracula (logeqv) -1)
      (test-dracula (logeqv 4) 4)
      (test-dracula (logeqv 5 6) -4)
      (test-dracula (logeqv "5") "5")
      (test-dracula (logbitp 3 15) t)
      (test-dracula (logbitp 3 16) nil)
      (test-dracula (logbitp 0 1) t)
      (test-dracula-error (logbitp -1 3))
      (test-dracula (logcount -1) 0)
      (test-dracula (logcount 4) 1)
      (test-dracula (logcount 7) 3)
      (test-dracula-error (logcount 1/2))
      (test-dracula (logtest 4 15) t)
      (test-dracula (logtest 4 16) nil)
      (test-dracula (max 1 2) 2)
      (test-dracula (max 4 3) 4)
      (test-dracula-syntax-error (max 4))
      (test-dracula-error (max (complex 1 2) 2))
      (test-dracula (min 1 2) 1)
      (test-dracula (min 4 3) 3)
      (test-dracula-syntax-error (min 4))
      (test-dracula-error (min (complex 1 2) 2))
      (test-dracula (minusp 1) nil)
      (test-dracula (minusp -1/2) t)
      (test-dracula (minusp -1) t)
      (test-dracula-error (minusp (complex 1 2)))
      (test-dracula (mod 4 2) 0)
      (test-dracula (mod 8 3) 2)
      (test-dracula-error (mod 8 0))
      (test-dracula-error (mod (complex 1 2) 2))
      (test-dracula (numerator 4) 4)
      (test-dracula (numerator 6/7) 6)
      (test-dracula (numerator 4/6) 2)
      (test-dracula (oddp 3) t)
      (test-dracula (oddp 2) nil)
      (test-dracula (plusp 1) t)
      (test-dracula (plusp -1) nil)
      (test-dracula (posp 1) t)
      (test-dracula (posp -1) nil)
      (test-dracula (natp 1) t)
      (test-dracula (natp 0) t)
      (test-dracula (natp -1) nil)
      (test-dracula (nfix 1) 1)
      (test-dracula (nfix -1) 0)
      (test-dracula (nfix (complex 1 2)) 0)
      (test-dracula (nonnegative-integer-quotient 14 3) 4)
      (test-dracula (nonnegative-integer-quotient 15 3) 5)
      (test-dracula (rationalp 2/5) t)
      (test-dracula (rationalp "number") nil)
      (test-dracula (real/rationalp 2/5) t)
      (test-dracula (real/rationalp "number") nil)
      (test-dracula (realfix 2/5) 2/5)
      (test-dracula (realfix (complex 3 2)) 0)
      (test-dracula (realfix "asdf") 0)
      (test-dracula (realpart (complex 3 2)) 3)
      (test-dracula (realpart 5) 5)
      (test-dracula-error (realpart "5"))
      (test-dracula (rem 4 2) 0)
      (test-dracula (rem 8 3) 2)
      (test-dracula-error (rem (complex 1 2) 3))
      (test-dracula (rfix 2/5) 2/5)
      (test-dracula (rfix (complex 3 2)) 0)
      (test-dracula (rfix "5") 0)
      (test-dracula (round 4 2) 2)
      (test-dracula (round 3 2) 2)
      (test-dracula (round 4 3) 1)
      (test-dracula (round 5 2) 2)
      (test-dracula-error (round (complex 1 2) 3))
      (test-dracula (signum 5) 1)
      (test-dracula (signum 0) 0)
      (test-dracula (signum -5) -1)
      (test-dracula-error (signum "5"))
      (test-dracula (truncate 5 2) 2)
      (test-dracula (truncate 4 2) 2)
      (test-dracula (truncate 19 10) 1)
      (test-dracula (truncate 11 10) 1)
      (test-dracula-error (truncate (complex 1 2) 3))
      (test-dracula (unary-- 5) -5)
      (test-dracula (unary-- -5) 5)
      (test-dracula (unary-- (complex 1 -2)) '-1+2i)
      (test-dracula-error (unary-- "5"))
      (test-dracula (unary-/ 5) 1/5)
      (test-dracula (unary-/ 1/5) 5)
      (test-dracula (unary-/ (complex 1 -2)) '1/5+2/5i)
      (test-dracula (zerop 0) t)
      (test-dracula (zerop 1) nil)
      (test-dracula (zerop (complex 0 1)) nil)
      (test-dracula-error (zerop "5"))
      (test-dracula (zip -1) nil)
      (test-dracula (zip 0) t)
      (test-dracula (zip 1) nil)
      (test-dracula (zp 0) t)
      (test-dracula (zp 1) nil)
      (test-dracula (zpf 0) t)
      (test-dracula (zpf 1) nil))
    (test-suite "Booleans"
      (test-dracula (and) t)
      (test-dracula (and t t t) t)
      (test-dracula (and t nil t) nil)
      (test-dracula (and nil nil) nil)
      (test-dracula (and 1 2 3 4 5) 5)
      (test-dracula (booleanp t) t)
      (test-dracula (booleanp nil) t)
      (test-dracula (booleanp 'yes) nil)
      (test-dracula (iff (< 0 3) (< 0 3)) t)
      (test-dracula (iff (< 0 3) (< 3 0)) nil)
      (test-dracula (iff (< 3 0) (< 3 0)) t)
      (test-dracula (iff 5 6) t)
      (test-dracula (iff nil 6) nil)
      (test-dracula (not t) nil)
      (test-dracula (not nil) t)
      (test-dracula (not 5) nil)
      (test-dracula (not 0) nil)
      (test-dracula (or nil nil t) t)
      (test-dracula (or nil nil nil) nil)
      (test-dracula (or) nil)
      (test-dracula (or nil nil 5 6) 5))
    (test-suite "Sequences"
      (test-dracula (coerce "hello" 'list) '(#\h #\e #\l #\l #\o))
      (test-dracula (coerce '(#\h #\e #\l #\l #\o) 'string) "hello")
      (test-dracula (concatenate 'string "ab" "cd" "ef") "abcdef")
      (test-dracula (concatenate 'string "ab") "ab")
      (test-dracula (concatenate 'list '(a b) '(c d) '(e f)) '(a b c d e f))
      (test-dracula (concatenate 'list) nil)
      (test-dracula (length (list 1 2 3 4 5)) 5)
      (test-dracula (length "hello") 5)
      (test-dracula (position 1 (list 3 2 1)) 2)
      (test-dracula (position #\o "lion") 2)
      (test-dracula (position 5 (list 1 2 3)) nil)
      (test-dracula-error (position "5" (list "1" "3" "5")))
      (test-dracula (position-eq 'a (list 'c 'b 'a)) 2)
      (test-dracula (position-eq 'a (list 'b 'c 'd)) nil)
      (test-dracula-error (position-eq 5 (list 1 2 3 4 5)))
      (test-dracula (position-equal 'a (list 'c 'b 'a)) 2)
      (test-dracula (position-equal #\o "lion") 2)
      (test-dracula (position-equal "5" (list "1" "3" "5")) 2)
      (test-dracula-error (position-equal 5 12345))
      (test-dracula (subseq "0123456789" 2 6) "2345")
      (test-dracula (subseq (list 1 2 3 4 5 6) 2 4) '(3 4))
      (test-dracula (subseq (list 1 2 3 4 5 6) 2 nil) '(3 4 5 6))
      (test-dracula-error (subseq 'abcd 2 4))
      (test-dracula-error (subseq "abcdefgh" -1 4))
      (test-dracula-error (subseq "abcdefgh" 4 1))
      (test-dracula-error (subseq "abcdefgh" -5 -1))
      (test-dracula (substitute 2 1 (list 1 1 1 3 1 1 1)) '(2 2 2 3 2 2 2)))
    (test-suite "Syntactic Forms"
      (test-dracula (assert$ (< 0 1) t) t)
      (test-dracula (case (+ 6 4)
                      (11 10)
                      (10 7)
                      (otherwise 'error))
                    7)
      (test-dracula (cond
                     ((< -5 0) (* -1 -5))
                     (t -5))
                    5)
      (test-dracula (if (< 0 3) 'yes 'no) 'yes)
      (test-dracula (if (< 3 0) 'yes 'no) 'no)
      (test-dracula (let ((x 4)) (+ x 6)) 10)
      (test-dracula (let ((a 1) (b 2)) (+ a b)) 3)
      (test-dracula-syntax-error (let ((a 1) (b (1+ a))) b))
      (test-dracula (let* ((x 4)) (+ x 6)) 10)
      (test-dracula (let* ((a 1) (b 2)) (+ a b)) 3)
      (test-dracula (let* ((a 1) (b (1+ a))) b) 2)
      (test-dracula (mv-let (x y z)
                            (mv 1 2 3)
                            (list x y z))
                    '(1 2 3)))
    (test-suite "S-Expressions"
      (test-dracula (alphorder 6 4) nil)
      (test-dracula (alphorder 4 6) t)
      (test-dracula (alphorder "abc" "bcd") t)
      (test-dracula (alphorder "bcd" "abc") nil)
      (test-dracula-error (alphorder '(1 2 3) '(4 5 6)))
      (test-dracula (atom 4) t)
      (test-dracula (atom 'hello) t)
      (test-dracula (atom (cons 4 nil)) nil)
      (test-dracula (eq 'yes 'yes) t)
      (test-dracula (eq 'yes 'no) nil)
      (test-dracula (eql 'yes 'yes) t)
      (test-dracula (eql 'yes 'no) nil)
      (test-dracula (eqlablep nil) t)
      (test-dracula (eqlablep 4) t)
      (test-dracula (eqlablep 'symbol) t)
      (test-dracula (eqlablep "string") nil)
      (test-dracula (equal "yes" "yes") t)
      (test-dracula (equal "yes" "no") nil)
      (test-dracula (identity 'x) 'x)
      (test-dracula (lexorder 6 4) nil)
      (test-dracula (lexorder 4 6) t)
      (test-dracula (lexorder "abc" "bcd") t)
      (test-dracula (lexorder "bcd" "abc") nil))))