Signed comparison tests
This commit is contained in:
@@ -154,6 +154,24 @@ functions:
|
|||||||
expectGlobalMemory(t, state, 1, 3)
|
expectGlobalMemory(t, state, 1, 3)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLTS(t *testing.T) {
|
||||||
|
state := assembleAndExecute(t, `
|
||||||
|
functions:
|
||||||
|
- - [mov, g0, 0]
|
||||||
|
- [lts, g0, -1]
|
||||||
|
- [jmpt, +2]
|
||||||
|
- [add, g1, 1]
|
||||||
|
- [lts, g0, 0]
|
||||||
|
- [jmpt, +2]
|
||||||
|
- [add, g1, 2]
|
||||||
|
- [lts, g0, 1]
|
||||||
|
- [jmpt, +2]
|
||||||
|
- [add, g1, 4]
|
||||||
|
`)
|
||||||
|
|
||||||
|
expectGlobalMemory(t, state, 1, 3)
|
||||||
|
}
|
||||||
|
|
||||||
func TestGTU(t *testing.T) {
|
func TestGTU(t *testing.T) {
|
||||||
state := assembleAndExecute(t, `
|
state := assembleAndExecute(t, `
|
||||||
functions:
|
functions:
|
||||||
@@ -172,6 +190,24 @@ functions:
|
|||||||
expectGlobalMemory(t, state, 1, 6)
|
expectGlobalMemory(t, state, 1, 6)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGTS(t *testing.T) {
|
||||||
|
state := assembleAndExecute(t, `
|
||||||
|
functions:
|
||||||
|
- - [mov, g0, 0]
|
||||||
|
- [gts, g0, -1]
|
||||||
|
- [jmpt, +2]
|
||||||
|
- [add, g1, 1]
|
||||||
|
- [gts, g0, 0]
|
||||||
|
- [jmpt, +2]
|
||||||
|
- [add, g1, 2]
|
||||||
|
- [gts, g0, 1]
|
||||||
|
- [jmpt, +2]
|
||||||
|
- [add, g1, 4]
|
||||||
|
`)
|
||||||
|
|
||||||
|
expectGlobalMemory(t, state, 1, 6)
|
||||||
|
}
|
||||||
|
|
||||||
func TestLTEU(t *testing.T) {
|
func TestLTEU(t *testing.T) {
|
||||||
state := assembleAndExecute(t, `
|
state := assembleAndExecute(t, `
|
||||||
functions:
|
functions:
|
||||||
@@ -190,6 +226,24 @@ functions:
|
|||||||
expectGlobalMemory(t, state, 1, 1)
|
expectGlobalMemory(t, state, 1, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLTES(t *testing.T) {
|
||||||
|
state := assembleAndExecute(t, `
|
||||||
|
functions:
|
||||||
|
- - [mov, g0, 0]
|
||||||
|
- [ltes, g0, -1]
|
||||||
|
- [jmpt, +2]
|
||||||
|
- [add, g1, 1]
|
||||||
|
- [ltes, g0, 0]
|
||||||
|
- [jmpt, +2]
|
||||||
|
- [add, g1, 2]
|
||||||
|
- [ltes, g0, 1]
|
||||||
|
- [jmpt, +2]
|
||||||
|
- [add, g1, 4]
|
||||||
|
`)
|
||||||
|
|
||||||
|
expectGlobalMemory(t, state, 1, 1)
|
||||||
|
}
|
||||||
|
|
||||||
func TestGTEU(t *testing.T) {
|
func TestGTEU(t *testing.T) {
|
||||||
state := assembleAndExecute(t, `
|
state := assembleAndExecute(t, `
|
||||||
functions:
|
functions:
|
||||||
@@ -207,3 +261,21 @@ functions:
|
|||||||
|
|
||||||
expectGlobalMemory(t, state, 1, 4)
|
expectGlobalMemory(t, state, 1, 4)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGTES(t *testing.T) {
|
||||||
|
state := assembleAndExecute(t, `
|
||||||
|
functions:
|
||||||
|
- - [mov, g0, 0]
|
||||||
|
- [gtes, g0, -1]
|
||||||
|
- [jmpt, +2]
|
||||||
|
- [add, g1, 1]
|
||||||
|
- [gtes, g0, 0]
|
||||||
|
- [jmpt, +2]
|
||||||
|
- [add, g1, 2]
|
||||||
|
- [gtes, g0, 1]
|
||||||
|
- [jmpt, +2]
|
||||||
|
- [add, g1, 4]
|
||||||
|
`)
|
||||||
|
|
||||||
|
expectGlobalMemory(t, state, 1, 4)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user