Add sqrt instruction

This commit is contained in:
Ian Gulliver
2021-11-21 17:04:58 -08:00
parent 05c62a92e1
commit 5ae34243b4
6 changed files with 61 additions and 0 deletions

View File

@@ -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)
}