Fixed the new lexer.
[m68k-assembler.git] / system-tests.lisp
blob002762e134db450ddb5c7a2ee1feea39c2ebd48e
1 ;;; Test things externally.
3 (in-package :m68k-assembler-tests)
5 (defparameter *base-path* "/home/julian/projects/m68k-assembler/")
7 ;; XXX this doesn't actually work, because the symbol table outputs
8 ;; differ between compilers.
9 (deftest ymamoto.regress.1
10 (let ((orig-filename (merge-pathnames "tests/ymamoto.o.test" *base-path*))
11 (our-filename (merge-pathnames "tests/ymamoto.o" *base-path*)))
12 (m68k-assembler:assemble (merge-pathnames "tests/ymamoto.s" *base-path*)
13 :object-name our-filename)
14 (with-open-file (original orig-filename :direction :input
15 :element-type 'unsigned-byte)
16 (with-open-file (new our-filename :direction :input
17 :element-type 'unsigned-byte)
18 (unless (= (file-length original) (file-length new))
19 (error "Lengths differ in output."))
20 (loop for a = (read-byte original nil nil)
21 and b = (read-byte new nil nil)
22 when (not (equal a b))
23 do (error "a (~S) and b (~S) differ." a b)
24 while (and a b))
25 (unless (and (equal (read-byte new nil nil) nil)
26 (equal (read-byte original nil nil) nil))
27 (error "Outputs not the same at EOF"))))