mirror of
https://github.com/open-simh/simtools.git
synced 2026-01-13 15:27:18 +00:00
Add some tests for things I have fixed while the last weeks.
This commit is contained in:
parent
d38f4009c4
commit
bc450511d8
25
tests/RunTests
Executable file
25
tests/RunTests
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Run some regression test cases.
|
||||
#
|
||||
# If there is a .lst.ok file, it compares the listing.
|
||||
# If there is a .objd.ok file, it compares the result of dumpobj.
|
||||
#
|
||||
|
||||
TESTS="test-asciz test-backpatch test-bsl-mac-arg test-complex-reloc test-endm test-include test-locals test-macro-comma test-undef test-word-comma"
|
||||
|
||||
for t in $TESTS
|
||||
do
|
||||
../macro11 -l "$t".lst -o "$t".obj "$t".mac 2>/dev/null
|
||||
|
||||
if [ -e "$t".lst.ok ]
|
||||
then
|
||||
diff -u "$t".lst.ok "$t".lst
|
||||
fi
|
||||
|
||||
if [ -e "$t".objd.ok ]
|
||||
then
|
||||
../dumpobj "$t".obj >"$t".objd
|
||||
diff -u "$t".objd.ok "$t".objd
|
||||
fi
|
||||
done
|
||||
5
tests/incl.mac
Normal file
5
tests/incl.mac
Normal file
@ -0,0 +1,5 @@
|
||||
;;;;;
|
||||
;
|
||||
; file to be included
|
||||
|
||||
.word 1 ; to show it is included
|
||||
12
tests/test-asciz.mac
Normal file
12
tests/test-asciz.mac
Normal file
@ -0,0 +1,12 @@
|
||||
;;;;;
|
||||
;
|
||||
; Test delimiters of .ASCII and .ASCIZ
|
||||
|
||||
CR = 13.
|
||||
LF = 10.
|
||||
SOH = 1
|
||||
|
||||
.asciz <cr><lf>/<SOH>/ ; 2 bytes and a string
|
||||
.asciz /<cr><lf><SOH>/ ; only a string
|
||||
.asciz |<cr><lf><SOH>| ; the same string
|
||||
.asciz <cr><lf><SOH> ; 3 bytes
|
||||
17
tests/test-backpatch.mac
Normal file
17
tests/test-backpatch.mac
Normal file
@ -0,0 +1,17 @@
|
||||
;;;;
|
||||
;
|
||||
; Test backpatching (seen in Kermit sources).
|
||||
|
||||
.psect modinf ,ro,d,lcl,rel,con
|
||||
|
||||
label = .
|
||||
.blkb 50 ; create some data
|
||||
|
||||
.byte 50,51,52 ; and some more
|
||||
.save ; we're at 53 now
|
||||
.psect modinf
|
||||
. = label + 6
|
||||
.word 6 ; stored at 6
|
||||
.restore ; . gets restored to 53
|
||||
.byte 53
|
||||
|
||||
24
tests/test-bsl-mac-arg.mac
Normal file
24
tests/test-bsl-mac-arg.mac
Normal file
@ -0,0 +1,24 @@
|
||||
.list me
|
||||
.macro test x
|
||||
.blkb x ; test some directive that wants an expression
|
||||
.endm
|
||||
|
||||
size = 10
|
||||
foo = 2
|
||||
|
||||
; likes:
|
||||
|
||||
test size ; not replaced by "10"
|
||||
test \size ; replaced by "10"
|
||||
test \<size> ; ditto
|
||||
test \<size + foo> ; replaced by "12"
|
||||
test ^/size + foo/ ; arg is "size + foo", not "12"
|
||||
|
||||
; dislikes:
|
||||
|
||||
test <\size> ; parameter is \size, which might be ok for
|
||||
; macros where the argument is used differently.
|
||||
test size + foo ; gets split at the space
|
||||
test /size + foo/ ; gets split at the space
|
||||
test \/size + foo/ ; invalid expression with division operator
|
||||
test \^/size + foo/ ; original dislikes this, but we accept it.
|
||||
14
tests/test-complex-reloc.mac
Normal file
14
tests/test-complex-reloc.mac
Normal file
@ -0,0 +1,14 @@
|
||||
; test complex relocations
|
||||
|
||||
; .globl IE.ITS,IE.MON ; implicit
|
||||
mov #-IE.ITS, space
|
||||
|
||||
space: .word IE.ITS ; the only simple relocation
|
||||
.word -IE.ITS ; all others are complex relocations
|
||||
.word ^C<IE.ITS>
|
||||
.word IE.ITS + IE.MON
|
||||
.word IE.ITS - IE.MON
|
||||
.word IE.ITS * IE.MON
|
||||
.word IE.ITS / IE.MON
|
||||
.word IE.ITS & IE.MON
|
||||
.word IE.ITS ! IE.MON
|
||||
41
tests/test-endm.mac
Normal file
41
tests/test-endm.mac
Normal file
@ -0,0 +1,41 @@
|
||||
;;;;;
|
||||
;
|
||||
; Test nested macros and name on .ENDM
|
||||
;
|
||||
|
||||
.macro M1
|
||||
.word 1
|
||||
.endm M1 ; ok
|
||||
|
||||
M1
|
||||
|
||||
.macro M2
|
||||
.word 2
|
||||
.macro M3
|
||||
.word 3
|
||||
.endm M3 ; ok
|
||||
.endm M2 ; ok
|
||||
|
||||
M2
|
||||
M3
|
||||
|
||||
.macro M4
|
||||
.word 4
|
||||
.macro M4
|
||||
.endm M4 ; ok
|
||||
.endm M4 ; ok
|
||||
|
||||
M4
|
||||
M4 ; should be empty now
|
||||
|
||||
.macro M5
|
||||
.word 5
|
||||
.macro M5
|
||||
.endm notM5 ; wrong; detected when M5 is expanded
|
||||
.endm M5 ; ok
|
||||
|
||||
M5
|
||||
M5
|
||||
|
||||
.macro M6
|
||||
.endm notM6 ; wrong
|
||||
17
tests/test-include.mac
Normal file
17
tests/test-include.mac
Normal file
@ -0,0 +1,17 @@
|
||||
;;;;;
|
||||
;
|
||||
; Test some delimiters for the .INCLUDE directive
|
||||
;
|
||||
|
||||
.include "incl.mac"
|
||||
.include /incl.mac/
|
||||
.include \incl.mac\
|
||||
.include ?incl.mac?
|
||||
.include >incl.mac>
|
||||
|
||||
; these are errors: (in MACRO V05.05, some terminate the assembler)
|
||||
|
||||
.include <incl.mac>
|
||||
.include <incl.mac<
|
||||
.include =incl.mac=
|
||||
.include :incl.mac:
|
||||
33
tests/test-locals.mac
Normal file
33
tests/test-locals.mac
Normal file
@ -0,0 +1,33 @@
|
||||
;;;;;
|
||||
;
|
||||
; Test long local labels
|
||||
;
|
||||
|
||||
lab1: beq 1$
|
||||
1$: bne lab1
|
||||
|
||||
; -- new scope
|
||||
|
||||
lab2a: beq 12345$
|
||||
12345$: bne lab2a
|
||||
|
||||
; -- new scope
|
||||
|
||||
lab2b: beq 12345$
|
||||
12345$: bne lab2b
|
||||
|
||||
; -- new scope
|
||||
|
||||
lab3: beq 1$
|
||||
1$: bne 2$
|
||||
2$: beq 3$
|
||||
3$: beq 4$
|
||||
4$: beq lab3
|
||||
|
||||
; -- new scope
|
||||
|
||||
lab4: beq 1$
|
||||
1$: bne 2$
|
||||
2$: beq 3$
|
||||
3$: beq 4$
|
||||
4$: beq lab4
|
||||
14
tests/test-macro-comma.mac
Normal file
14
tests/test-macro-comma.mac
Normal file
@ -0,0 +1,14 @@
|
||||
.macro tstarg a1,a2,a3,a4
|
||||
.narg label
|
||||
.endm
|
||||
|
||||
start: tstarg ; 0 args
|
||||
tstarg 123 ; 1 arg
|
||||
tstarg 1, ; 2 args
|
||||
tstarg ,2 ; 2 args
|
||||
tstarg , ; 2 args
|
||||
tstarg ,, ; 3 args
|
||||
tstarg 1,, ; 3 args
|
||||
tstarg ,,3 ; 3 args
|
||||
tstarg 1,,3 ; 3 args
|
||||
tstarg 1,2,3 ; 3 args
|
||||
12
tests/test-word-comma.mac
Normal file
12
tests/test-word-comma.mac
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
start: .word 123 ; 1 word
|
||||
.word ; 1 word
|
||||
.word 1, ; 2 words
|
||||
.word ,2 ; 2 words
|
||||
.word , ; 2 words
|
||||
.word ,, ; 3 words
|
||||
.word 1,, ; 3 words
|
||||
.word ,,3 ; 3 words
|
||||
.word 1,,3 ; 3 words
|
||||
.word 1,2,3 ; 3 words
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user