mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 09:23:44 +00:00
library/uint8.m:
library/uint16.m:
As above.
tests/hard_coded/Mmakefile:
tests/hard_coded/rotate_uint{8,16}.{m,ex}:
Add tests for the new functions.
89 lines
3.5 KiB
Plaintext
89 lines
3.5 KiB
Plaintext
*** Test 'rotate_left' ***
|
|
|
|
rotate_left(0000000000000001, 0) = 0000000000000001
|
|
unchecked_rotate_left(0000000000000001, 0) = 0000000000000001
|
|
|
|
rotate_left(0000000000000001, 1) = 0000000000000010
|
|
unchecked_rotate_left(0000000000000001, 1) = 0000000000000010
|
|
|
|
rotate_left(0000000000000001, 2) = 0000000000000100
|
|
unchecked_rotate_left(0000000000000001, 2) = 0000000000000100
|
|
|
|
rotate_left(0000000000000001, 15) = 1000000000000000
|
|
unchecked_rotate_left(0000000000000001, 15) = 1000000000000000
|
|
|
|
rotate_left(0000000000000001, 16) = <<exception>>
|
|
unchecked_rotate_left(0000000000000001, 16) = 0000000000000001
|
|
|
|
rotate_left(0000000000000001, 31) = <<exception>>
|
|
unchecked_rotate_left(0000000000000001, 31) = 1000000000000000
|
|
|
|
rotate_left(0000000000000001, 32) = <<exception>>
|
|
unchecked_rotate_left(0000000000000001, 32) = 0000000000000001
|
|
|
|
rotate_left(0000000011111111, 0) = 0000000011111111
|
|
unchecked_rotate_left(0000000011111111, 0) = 0000000011111111
|
|
|
|
rotate_left(0000000011111111, 1) = 0000000111111110
|
|
unchecked_rotate_left(0000000011111111, 1) = 0000000111111110
|
|
|
|
rotate_left(0000000011111111, 2) = 0000001111111100
|
|
unchecked_rotate_left(0000000011111111, 2) = 0000001111111100
|
|
|
|
rotate_left(0000000011111111, 15) = 1000000001111111
|
|
unchecked_rotate_left(0000000011111111, 15) = 1000000001111111
|
|
|
|
rotate_left(0000000011111111, 16) = <<exception>>
|
|
unchecked_rotate_left(0000000011111111, 16) = 0000000011111111
|
|
|
|
rotate_left(0000000011111111, 31) = <<exception>>
|
|
unchecked_rotate_left(0000000011111111, 31) = 1000000001111111
|
|
|
|
rotate_left(0000000011111111, 32) = <<exception>>
|
|
unchecked_rotate_left(0000000011111111, 32) = 0000000011111111
|
|
|
|
*** Test 'rotate_right' ***
|
|
|
|
rotate_right(0000000000000001, 0) = 0000000000000001
|
|
unchecked_rotate_right(0000000000000001, 0) = 0000000000000001
|
|
|
|
rotate_right(0000000000000001, 1) = 1000000000000000
|
|
unchecked_rotate_right(0000000000000001, 1) = 1000000000000000
|
|
|
|
rotate_right(0000000000000001, 2) = 0100000000000000
|
|
unchecked_rotate_right(0000000000000001, 2) = 0100000000000000
|
|
|
|
rotate_right(0000000000000001, 15) = 0000000000000010
|
|
unchecked_rotate_right(0000000000000001, 15) = 0000000000000010
|
|
|
|
rotate_right(0000000000000001, 16) = <<exception>>
|
|
unchecked_rotate_right(0000000000000001, 16) = 0000000000000001
|
|
|
|
rotate_right(0000000000000001, 31) = <<exception>>
|
|
unchecked_rotate_right(0000000000000001, 31) = 0000000000000010
|
|
|
|
rotate_right(0000000000000001, 32) = <<exception>>
|
|
unchecked_rotate_right(0000000000000001, 32) = 0000000000000001
|
|
|
|
rotate_right(0000000011111111, 0) = 0000000011111111
|
|
unchecked_rotate_right(0000000011111111, 0) = 0000000011111111
|
|
|
|
rotate_right(0000000011111111, 1) = 1000000001111111
|
|
unchecked_rotate_right(0000000011111111, 1) = 1000000001111111
|
|
|
|
rotate_right(0000000011111111, 2) = 1100000000111111
|
|
unchecked_rotate_right(0000000011111111, 2) = 1100000000111111
|
|
|
|
rotate_right(0000000011111111, 15) = 0000000111111110
|
|
unchecked_rotate_right(0000000011111111, 15) = 0000000111111110
|
|
|
|
rotate_right(0000000011111111, 16) = <<exception>>
|
|
unchecked_rotate_right(0000000011111111, 16) = 0000000011111111
|
|
|
|
rotate_right(0000000011111111, 31) = <<exception>>
|
|
unchecked_rotate_right(0000000011111111, 31) = 0000000111111110
|
|
|
|
rotate_right(0000000011111111, 32) = <<exception>>
|
|
unchecked_rotate_right(0000000011111111, 32) = 0000000011111111
|
|
|