From c19ad2442807b61fd7268817c3ba150628bfd012 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Thu, 18 Jul 2024 08:47:08 +0200 Subject: [PATCH] Added more tests --- src/build/arch/x64/Jump_test.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/build/arch/x64/Jump_test.go b/src/build/arch/x64/Jump_test.go index ba48db0..5c12133 100644 --- a/src/build/arch/x64/Jump_test.go +++ b/src/build/arch/x64/Jump_test.go @@ -7,7 +7,7 @@ import ( "git.akyoto.dev/go/assert" ) -func TestJump8(t *testing.T) { +func TestJump(t *testing.T) { usagePatterns := []struct { Offset int8 Code []byte @@ -29,3 +29,12 @@ func TestJump8(t *testing.T) { 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}) +}