Have sign-extend-complex deal correctly with bytes of size 0.
[movitz-ia-x86.git] / ia-x86-test.lisp
blob8cf327a7a07c7a92f315e4bcb70e843cc83d4406
1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ;;
3 ;; Copyright (C) 2003, Frode Vatvedt Fjeld <frodef@acm.org>
4 ;;
5 ;; Filename: ia-x86-test.lisp
6 ;; Description: Regression tests for the assembler
7 ;; Author: Nikodemus Siivola
8 ;; Created at: Wed Oct 20 23:13:46 1999
9 ;;
10 ;; $Id: ia-x86-test.lisp,v 1.2 2004/01/16 11:54:14 ffjeld Exp $
11 ;;
12 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14 (defpackage :ia-x86-test
15 (:use :cl :ia-x86 :rt))
17 (in-package :ia-x86-test)
19 (deftest asm.1
20 (asm :movl :eax :ebx)
21 #C(#x89C3 #x2))
23 (defvar *proglist-1* '((:movl 10 :eax) loop
24 (:decl :eax)
25 (:je 'exit)
26 (:jmp 'loop) exit))
28 (deftest read-proglist.1
29 ;; KLUDGE: it's just simpler to compare the printed version here...
30 (equal (with-output-to-string (s)
31 (prin1 (read-proglist *proglist-1*) s))
32 "(#<asm MOVL #xA => %EAX> LOOP #<asm DECL %EAX> #<asm JE 'EXIT> #<asm JMP 'LOOP>
33 EXIT)")
36 (deftest proglist-encode.1
37 (multiple-value-bind (a b)
38 (proglist-encode :octet-list :32-bit 0 (read-proglist *proglist-1*))
39 (and (equal a '(#xB8 #xA #x0 #x0 #x0 #x48 #x74 #x2 #xEB #xFB))
40 (equal b '((EXIT . #xA) (LOOP . #x5)))))