added tests
This commit is contained in:
parent
49e4911238
commit
4cc117fdd4
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,4 +4,3 @@ njvm
|
||||
njvm.dSYM
|
||||
njvm.exe
|
||||
njvm2
|
||||
test
|
||||
|
||||
BIN
test/.DS_Store
vendored
Normal file
BIN
test/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
test/tests/1.bin
Normal file
BIN
test/tests/1.bin
Normal file
Binary file not shown.
BIN
test/tests/10.bin
Normal file
BIN
test/tests/10.bin
Normal file
Binary file not shown.
BIN
test/tests/11.bin
Normal file
BIN
test/tests/11.bin
Normal file
Binary file not shown.
BIN
test/tests/12.bin
Normal file
BIN
test/tests/12.bin
Normal file
Binary file not shown.
BIN
test/tests/13.bin
Normal file
BIN
test/tests/13.bin
Normal file
Binary file not shown.
BIN
test/tests/2.bin
Normal file
BIN
test/tests/2.bin
Normal file
Binary file not shown.
BIN
test/tests/3.bin
Normal file
BIN
test/tests/3.bin
Normal file
Binary file not shown.
BIN
test/tests/4.bin
Normal file
BIN
test/tests/4.bin
Normal file
Binary file not shown.
BIN
test/tests/5.bin
Normal file
BIN
test/tests/5.bin
Normal file
Binary file not shown.
BIN
test/tests/6.bin
Normal file
BIN
test/tests/6.bin
Normal file
Binary file not shown.
BIN
test/tests/7.bin
Normal file
BIN
test/tests/7.bin
Normal file
Binary file not shown.
BIN
test/tests/8.bin
Normal file
BIN
test/tests/8.bin
Normal file
Binary file not shown.
BIN
test/tests/9.bin
Normal file
BIN
test/tests/9.bin
Normal file
Binary file not shown.
13
test/tests/asf_rsfTest.asm
Normal file
13
test/tests/asf_rsfTest.asm
Normal file
@ -0,0 +1,13 @@
|
||||
asf 5
|
||||
pushc 11
|
||||
call x
|
||||
wrint
|
||||
rsf
|
||||
halt
|
||||
|
||||
x:
|
||||
asf 3
|
||||
pushc 22
|
||||
wrint
|
||||
rsf
|
||||
|
||||
125
test/tests/bigMultiplication.asm
Normal file
125
test/tests/bigMultiplication.asm
Normal file
@ -0,0 +1,125 @@
|
||||
//
|
||||
// version
|
||||
//
|
||||
.vers 7
|
||||
|
||||
//
|
||||
// execution framework
|
||||
//
|
||||
__start:
|
||||
call _main
|
||||
call _exit
|
||||
__stop:
|
||||
jmp __stop
|
||||
|
||||
//
|
||||
// Integer readInteger()
|
||||
//
|
||||
_readInteger:
|
||||
asf 0
|
||||
rdint
|
||||
popr
|
||||
rsf
|
||||
ret
|
||||
|
||||
//
|
||||
// void writeInteger(Integer)
|
||||
//
|
||||
_writeInteger:
|
||||
asf 0
|
||||
pushl -3
|
||||
wrint
|
||||
rsf
|
||||
ret
|
||||
|
||||
//
|
||||
// Character readCharacter()
|
||||
//
|
||||
_readCharacter:
|
||||
asf 0
|
||||
rdchr
|
||||
popr
|
||||
rsf
|
||||
ret
|
||||
|
||||
//
|
||||
// void writeCharacter(Character)
|
||||
//
|
||||
_writeCharacter:
|
||||
asf 0
|
||||
pushl -3
|
||||
wrchr
|
||||
rsf
|
||||
ret
|
||||
|
||||
//
|
||||
// Integer char2int(Character)
|
||||
//
|
||||
_char2int:
|
||||
asf 0
|
||||
pushl -3
|
||||
popr
|
||||
rsf
|
||||
ret
|
||||
|
||||
//
|
||||
// Character int2char(Integer)
|
||||
//
|
||||
_int2char:
|
||||
asf 0
|
||||
pushl -3
|
||||
popr
|
||||
rsf
|
||||
ret
|
||||
|
||||
//
|
||||
// void exit()
|
||||
//
|
||||
_exit:
|
||||
asf 0
|
||||
halt
|
||||
rsf
|
||||
ret
|
||||
|
||||
//
|
||||
// void writeString(String)
|
||||
//
|
||||
_writeString:
|
||||
asf 1
|
||||
pushc 0
|
||||
popl 0
|
||||
jmp _writeString_L2
|
||||
_writeString_L1:
|
||||
pushl -3
|
||||
pushl 0
|
||||
getfa
|
||||
call _writeCharacter
|
||||
drop 1
|
||||
pushl 0
|
||||
pushc 1
|
||||
add
|
||||
popl 0
|
||||
_writeString_L2:
|
||||
pushl 0
|
||||
pushl -3
|
||||
getsz
|
||||
lt
|
||||
brt _writeString_L1
|
||||
rsf
|
||||
ret
|
||||
|
||||
//
|
||||
// void main()
|
||||
//
|
||||
_main:
|
||||
asf 0
|
||||
pushc 4421
|
||||
pushc 5743
|
||||
mul
|
||||
pushc 7699
|
||||
mul
|
||||
call _writeInteger
|
||||
drop 1
|
||||
__0:
|
||||
rsf
|
||||
ret
|
||||
5
test/tests/bigint/bigIntTestAdd.asm
Normal file
5
test/tests/bigint/bigIntTestAdd.asm
Normal file
@ -0,0 +1,5 @@
|
||||
pushc 5
|
||||
pushc 4
|
||||
add
|
||||
wrint
|
||||
halt
|
||||
5
test/tests/bigint/bigIntTestDiv.asm
Normal file
5
test/tests/bigint/bigIntTestDiv.asm
Normal file
@ -0,0 +1,5 @@
|
||||
pushc 5
|
||||
pushc 4
|
||||
div
|
||||
wrint
|
||||
halt
|
||||
5
test/tests/bigint/bigIntTestMod.asm
Normal file
5
test/tests/bigint/bigIntTestMod.asm
Normal file
@ -0,0 +1,5 @@
|
||||
pushc 5
|
||||
pushc 4
|
||||
mod
|
||||
wrint
|
||||
halt
|
||||
5
test/tests/bigint/bigIntTestMul.asm
Normal file
5
test/tests/bigint/bigIntTestMul.asm
Normal file
@ -0,0 +1,5 @@
|
||||
pushc 5
|
||||
pushc 4
|
||||
mul
|
||||
wrint
|
||||
halt
|
||||
5
test/tests/bigint/bigIntTestSub.asm
Normal file
5
test/tests/bigint/bigIntTestSub.asm
Normal file
@ -0,0 +1,5 @@
|
||||
pushc 5
|
||||
pushc 4
|
||||
sub
|
||||
wrint
|
||||
halt
|
||||
16
test/tests/brfTest1.asm
Normal file
16
test/tests/brfTest1.asm
Normal file
@ -0,0 +1,16 @@
|
||||
pushc 3
|
||||
pushc 4
|
||||
eq
|
||||
brf L1
|
||||
|
||||
pushc 4
|
||||
|
||||
L1:
|
||||
pushc 7
|
||||
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
|
||||
halt
|
||||
|
||||
17
test/tests/brfTest2.asm
Normal file
17
test/tests/brfTest2.asm
Normal file
@ -0,0 +1,17 @@
|
||||
pushc 4
|
||||
pushc 4
|
||||
eq
|
||||
brf L1
|
||||
|
||||
pushc 6
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
halt
|
||||
|
||||
L1:
|
||||
pushc 7
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
halt
|
||||
19
test/tests/brtTest1.asm
Normal file
19
test/tests/brtTest1.asm
Normal file
@ -0,0 +1,19 @@
|
||||
pushc 3
|
||||
pushc 4
|
||||
eq
|
||||
brt L1
|
||||
|
||||
pushc 5
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
halt
|
||||
|
||||
L1:
|
||||
pushc 7
|
||||
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
halt
|
||||
|
||||
17
test/tests/brtTest2.asm
Normal file
17
test/tests/brtTest2.asm
Normal file
@ -0,0 +1,17 @@
|
||||
pushc 4
|
||||
pushc 4
|
||||
eq
|
||||
brt L1
|
||||
|
||||
pushc 6
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
halt
|
||||
|
||||
L1:
|
||||
pushc 7
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
halt
|
||||
15
test/tests/equalsTest.asm
Normal file
15
test/tests/equalsTest.asm
Normal file
@ -0,0 +1,15 @@
|
||||
pushc 3
|
||||
pushc 4
|
||||
eq
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
|
||||
pushc 6
|
||||
pushc 6
|
||||
eq
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
halt
|
||||
|
||||
24
test/tests/greaterEqualsTest.asm
Normal file
24
test/tests/greaterEqualsTest.asm
Normal file
@ -0,0 +1,24 @@
|
||||
pushc 3
|
||||
pushc 4
|
||||
ge
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
|
||||
|
||||
pushc 8
|
||||
pushc 4
|
||||
ge
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
|
||||
|
||||
pushc 6
|
||||
pushc 6
|
||||
ge
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
halt
|
||||
|
||||
24
test/tests/greaterThanTest.asm
Normal file
24
test/tests/greaterThanTest.asm
Normal file
@ -0,0 +1,24 @@
|
||||
pushc 3
|
||||
pushc 4
|
||||
gt
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
|
||||
|
||||
pushc 8
|
||||
pushc 4
|
||||
gt
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
|
||||
|
||||
pushc 6
|
||||
pushc 6
|
||||
gt
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
halt
|
||||
|
||||
19
test/tests/jumpTest.asm
Normal file
19
test/tests/jumpTest.asm
Normal file
@ -0,0 +1,19 @@
|
||||
pushc 3
|
||||
pushc 4
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
|
||||
|
||||
pushc 3
|
||||
jmp L1
|
||||
|
||||
pushc 4
|
||||
|
||||
L1:
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
|
||||
halt
|
||||
|
||||
24
test/tests/lowerEqualsTest.asm
Normal file
24
test/tests/lowerEqualsTest.asm
Normal file
@ -0,0 +1,24 @@
|
||||
pushc 3
|
||||
pushc 4
|
||||
le
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
|
||||
|
||||
pushc 8
|
||||
pushc 4
|
||||
le
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
|
||||
|
||||
pushc 6
|
||||
pushc 6
|
||||
le
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
halt
|
||||
|
||||
24
test/tests/lowerThanTest.asm
Normal file
24
test/tests/lowerThanTest.asm
Normal file
@ -0,0 +1,24 @@
|
||||
pushc 3
|
||||
pushc 4
|
||||
lt
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
|
||||
|
||||
pushc 8
|
||||
pushc 4
|
||||
lt
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
|
||||
|
||||
pushc 6
|
||||
pushc 6
|
||||
lt
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
halt
|
||||
|
||||
BIN
test/tests/nja
Executable file
BIN
test/tests/nja
Executable file
Binary file not shown.
15
test/tests/notEqualsTest.asm
Normal file
15
test/tests/notEqualsTest.asm
Normal file
@ -0,0 +1,15 @@
|
||||
pushc 3
|
||||
pushc 4
|
||||
ne
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
|
||||
pushc 6
|
||||
pushc 6
|
||||
ne
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
halt
|
||||
|
||||
16
test/tests/prog1.asm
Normal file
16
test/tests/prog1.asm
Normal file
@ -0,0 +1,16 @@
|
||||
pushc 3
|
||||
pushc 4
|
||||
eq
|
||||
brf L1
|
||||
|
||||
pushc 4
|
||||
|
||||
L1:
|
||||
pushc 7
|
||||
|
||||
wrint
|
||||
pushc 10
|
||||
wrchr
|
||||
|
||||
halt
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user