Added more tests

This commit is contained in:
Eduard Urbach 2024-07-18 08:47:08 +02:00
parent 77ccb8778f
commit c19ad24428
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0

View File

@ -7,7 +7,7 @@ import (
"git.akyoto.dev/go/assert" "git.akyoto.dev/go/assert"
) )
func TestJump8(t *testing.T) { func TestJump(t *testing.T) {
usagePatterns := []struct { usagePatterns := []struct {
Offset int8 Offset int8
Code []byte Code []byte
@ -29,3 +29,12 @@ func TestJump8(t *testing.T) {
assert.DeepEqual(t, code, pattern.Code) assert.DeepEqual(t, code, pattern.Code)
} }
} }
func TestConditionalJump(t *testing.T) {
assert.DeepEqual(t, x64.Jump8IfEqual(nil, 1), []byte{0x74, 0x01})
assert.DeepEqual(t, x64.Jump8IfNotEqual(nil, 1), []byte{0x75, 0x01})
assert.DeepEqual(t, x64.Jump8IfLess(nil, 1), []byte{0x7C, 0x01})
assert.DeepEqual(t, x64.Jump8IfGreaterOrEqual(nil, 1), []byte{0x7D, 0x01})
assert.DeepEqual(t, x64.Jump8IfLessOrEqual(nil, 1), []byte{0x7E, 0x01})
assert.DeepEqual(t, x64.Jump8IfGreater(nil, 1), []byte{0x7F, 0x01})
}