diff options
| author | Marc Vertes <mvertes@free.fr> | 2023-11-21 16:05:13 +0100 |
|---|---|---|
| committer | Marc Vertes <mvertes@free.fr> | 2023-11-24 09:12:46 +0100 |
| commit | c548093d79edece3c1cbb7e4dc03d92fe45b1cc7 (patch) | |
| tree | 9262c8ef34a5d393cfb1ebe99558d70120c5d55d /vm/vm_test.go | |
| parent | ae58deb5da1fa2ae5e461783ce592a9b962da778 (diff) | |
vm: use only reflect.Values (WIP)
Diffstat (limited to 'vm/vm_test.go')
| -rw-r--r-- | vm/vm_test.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/vm/vm_test.go b/vm/vm_test.go index 08e8054..c9540d2 100644 --- a/vm/vm_test.go +++ b/vm/vm_test.go @@ -3,6 +3,7 @@ package vm import ( "fmt" "log" + "reflect" "testing" ) @@ -50,10 +51,11 @@ func BenchmarkVM(b *testing.B) { } var tests = []struct { - sym []any // initial memory values - code [][]int64 // bytecode to execute - start, end int // - mem string // expected memory content + //sym []any // initial memory values + sym []reflect.Value // initial memory values + code [][]int64 // bytecode to execute + start, end int // + mem string // expected memory content }{{ // #00 -- A simple addition. code: [][]int64{ {0, Push, 1}, @@ -63,7 +65,7 @@ var tests = []struct { }, start: 0, end: 1, mem: "[3]", }, { // #01 -- Calling a function defined outside the VM. - sym: []any{fmt.Println, "Hello"}, + sym: []reflect.Value{reflect.ValueOf(fmt.Println), reflect.ValueOf("Hello")}, code: [][]int64{ {0, Dup, 0}, {0, CallX, 1}, |
