aboutsummaryrefslogtreecommitdiff
path: root/eval_test.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2018-01-07 00:43:28 +0100
committerDimitri Sokolyuk <demon@dim13.org>2018-01-07 00:43:28 +0100
commit6fe6679b816cedbe1f007a1f036cc55ae9214492 (patch)
tree968241eaa55ef17f923d428ac26d7153bf392220 /eval_test.go
parente995ee3c0b77708aa2b6f04a7c86a4ed4684d96a (diff)
...
Diffstat (limited to 'eval_test.go')
-rw-r--r--eval_test.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/eval_test.go b/eval_test.go
index 9aacf09..1686287 100644
--- a/eval_test.go
+++ b/eval_test.go
@@ -46,7 +46,7 @@ func TestEval(t *testing.T) {
},
{
ins: []Instruction{Call(0xff)},
- end: J1{pc: 0xff, rstack: [0x20]uint16{0x00, 0x01}, rsp: 1},
+ end: J1{pc: 0xff, rstack: [0x20]uint16{0x00, 0x02}, rsp: 1},
},
{
ins: []Instruction{Lit(0xff)},
@@ -86,7 +86,7 @@ func TestEval(t *testing.T) {
},
{ // ;
ins: []Instruction{Call(10), Call(20), ALU{Opcode: opT, RtoPC: true, Rdir: -1}},
- end: J1{pc: 11, rsp: 1, rstack: [0x20]uint16{0, 1, 11}},
+ end: J1{pc: 11, rsp: 1, rstack: [0x20]uint16{0, 2, 22}},
},
{ // >r
ins: []Instruction{Lit(10), ALU{Opcode: opN, TtoR: true, Ddir: -1, Rdir: 1}},
@@ -94,7 +94,7 @@ func TestEval(t *testing.T) {
},
{ // r>
ins: []Instruction{Lit(10), Call(20), ALU{Opcode: opR, TtoN: true, TtoR: true, Ddir: 1, Rdir: -1}},
- end: J1{pc: 21, st0: 2, dsp: 2, dstack: [0x20]uint16{0, 0, 10}, rsp: 0, rstack: [0x20]uint16{10, 2}},
+ end: J1{pc: 21, st0: 4, dsp: 2, dstack: [0x20]uint16{0, 0, 10}, rsp: 0, rstack: [0x20]uint16{10, 4}},
},
{ // r@
ins: []Instruction{Lit(10), ALU{Opcode: opR, TtoN: true, TtoR: true, Ddir: 1}},
@@ -135,16 +135,16 @@ func TestNextST0(t *testing.T) {
{ins: ALU{Opcode: opTxorN}, st0: 0x44, state: J1{st0: 0xff, dstack: [0x20]uint16{0, 0xaa, 0xbb}, dsp: 2}},
{ins: ALU{Opcode: opNotT}, st0: 0xff55, state: J1{st0: 0xaa}},
{ins: ALU{Opcode: opNeqT}, st0: 0x00, state: J1{st0: 0xff, dstack: [0x20]uint16{0, 0xaa, 0xbb}, dsp: 2}},
- {ins: ALU{Opcode: opNeqT}, st0: 0x01, state: J1{st0: 0xff, dstack: [0x20]uint16{0, 0xaa, 0xff}, dsp: 2}},
- {ins: ALU{Opcode: opNleT}, st0: 0x01, state: J1{st0: 0xff, dstack: [0x20]uint16{0, 0xaa, 0xbb}, dsp: 2}},
+ {ins: ALU{Opcode: opNeqT}, st0: 0xffff, state: J1{st0: 0xff, dstack: [0x20]uint16{0, 0xaa, 0xff}, dsp: 2}},
+ {ins: ALU{Opcode: opNleT}, st0: 0xffff, state: J1{st0: 0xff, dstack: [0x20]uint16{0, 0xaa, 0xbb}, dsp: 2}},
{ins: ALU{Opcode: opNleT}, st0: 0x00, state: J1{st0: 0xff, dstack: [0x20]uint16{0, 0xaa, 0xff}, dsp: 2}},
{ins: ALU{Opcode: opNrshiftT}, st0: 0x3f, state: J1{st0: 0x02, dstack: [0x20]uint16{0, 0xaa, 0xff}, dsp: 2}},
{ins: ALU{Opcode: opTminus1}, st0: 0x54, state: J1{st0: 0x55}},
{ins: ALU{Opcode: opR}, st0: 0x5, state: J1{rstack: [0x20]uint16{0, 0x05}, rsp: 1}},
- {ins: ALU{Opcode: opAtT}, st0: 0x5, state: J1{st0: 0x01, memory: [0x4000]uint16{0, 5, 10}}},
+ {ins: ALU{Opcode: opAtT}, st0: 0x0, state: J1{st0: 0x01, memory: [0x4000]uint16{0, 5, 10}}},
{ins: ALU{Opcode: opNlshiftT}, st0: 0x3fc, state: J1{st0: 0x02, dstack: [0x20]uint16{0, 0xaa, 0xff}, dsp: 2}},
{ins: ALU{Opcode: opDepth}, st0: 0x305, state: J1{rsp: 3, dsp: 5}},
- {ins: ALU{Opcode: opNuleT}, st0: 0x01, state: J1{st0: 0xff, dstack: [0x20]uint16{0, 0xaa, 0xbb}, dsp: 2}},
+ {ins: ALU{Opcode: opNuleT}, st0: 0xffff, state: J1{st0: 0xff, dstack: [0x20]uint16{0, 0xaa, 0xbb}, dsp: 2}},
{ins: ALU{Opcode: opNuleT}, st0: 0x00, state: J1{st0: 0xff, dstack: [0x20]uint16{0, 0xaa, 0xff}, dsp: 2}},
}
for _, tc := range testCases {