From a7a4d837ea4076d8e6598875c206f4308e8a38ee Mon Sep 17 00:00:00 2001 From: Samuel Gomes <47574584+a740g@users.noreply.github.com> Date: Thu, 1 Sep 2022 17:28:12 +0530 Subject: [PATCH] Added test for `_ROL` & `_ROR` --- tests/compile_tests/rotations/test.bas | 28 +++++++++++++++++++++++ tests/compile_tests/rotations/test.output | 8 +++++++ 2 files changed, 36 insertions(+) create mode 100644 tests/compile_tests/rotations/test.bas create mode 100644 tests/compile_tests/rotations/test.output diff --git a/tests/compile_tests/rotations/test.bas b/tests/compile_tests/rotations/test.bas new file mode 100644 index 000000000..96240fd33 --- /dev/null +++ b/tests/compile_tests/rotations/test.bas @@ -0,0 +1,28 @@ +$CONSOLE:ONLY +OPTION _EXPLICIT + +DIM a AS _UNSIGNED _BYTE +DIM b AS _UNSIGNED INTEGER +DIM c AS _UNSIGNED LONG +DIM d AS _UNSIGNED _INTEGER64 + +a = &B11110000 +b = &B1111111100000000 +c = &B11111111111111110000000000000000 +d = &B1111111111111111111111111111111100000000000000000000000000000000 + +PRINT a, b, c, d +PRINT _BIN$(a), _BIN$(b), _BIN$(c), _BIN$(d) + +PRINT _ROL(a, 1), _ROL(b, 1), _ROL(c, 1), _ROL(d, 1) +PRINT _BIN$(_ROL(a, 1)), _BIN$(_ROL(b, 1)), _BIN$(_ROL(c, 1)), _BIN$(_ROL(d, 1)) + +PRINT _ROR(a, 1), _ROR(b, 1), _ROR(c, 1), _ROR(d, 1) +PRINT _BIN$(_ROR(a, 1)), _BIN$(_ROR(b, 1)), _BIN$(_ROR(c, 1)), _BIN$(_ROR(d, 1)) + +PRINT _BIN$(_ROL(240~%%, 5)), _BIN$(_ROL(65280~%, 5)), _BIN$(_ROL(4294901760~&, 5)), _BIN$(_ROL(18446744069414584320~&&, 5)) + +PRINT _BIN$(_ROR(240~%%, 5)), _BIN$(_ROR(65280~%, 5)), _BIN$(_ROR(4294901760~&, 5)), _BIN$(_ROR(18446744069414584320~&&, 5)) + +SYSTEM + diff --git a/tests/compile_tests/rotations/test.output b/tests/compile_tests/rotations/test.output new file mode 100644 index 000000000..1f6449e5d --- /dev/null +++ b/tests/compile_tests/rotations/test.output @@ -0,0 +1,8 @@ + 240 65280 4294901760 18446744069414584320 +11110000 1111111100000000 11111111111111110000000000000000 1111111111111111111111111111111100000000000000000000000000000000 + 225 65025 4294836225 18446744065119617025 +11100001 1111111000000001 11111111111111100000000000000001 1111111111111111111111111111111000000000000000000000000000000001 + 120 32640 2147450880 9223372034707292160 +1111000 111111110000000 1111111111111111000000000000000 111111111111111111111111111111110000000000000000000000000000000 +11110 1110000000011111 11111111111000000000000000011111 1111111111111111111111111110000000000000000000000000000000011111 +10000111 11111111000 111111111111111100000000000 11111111111111111111111111111111000000000000000000000000000