Add sqrt instruction
This commit is contained in:
@@ -519,3 +519,27 @@ functions:
|
||||
|
||||
expectGlobalMemory(t, state, 0, 7)
|
||||
}
|
||||
|
||||
func TestSqrt(t *testing.T) {
|
||||
state := assembleAndExecute(t, `
|
||||
global_memory_size: 4
|
||||
function_memory_size: 4
|
||||
functions:
|
||||
- - [mov, g0, 1]
|
||||
- [sqrt, g0]
|
||||
|
||||
- [mov, g1, 4]
|
||||
- [sqrt, g1]
|
||||
|
||||
- [mov, g2, 144]
|
||||
- [sqrt, g2]
|
||||
|
||||
- [mov, g3, 175]
|
||||
- [sqrt, g3]
|
||||
`)
|
||||
|
||||
expectGlobalMemory(t, state, 0, 1)
|
||||
expectGlobalMemory(t, state, 1, 2)
|
||||
expectGlobalMemory(t, state, 2, 12)
|
||||
expectGlobalMemory(t, state, 3, 13)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user