Updated VVhitespace's modulo function to always return positive values.
[vvhitespace] / tests / 2005_arithmetic_remainder.pvvs
CommitLineData
665e21b4
AT
1# This test verifies arithmetic IMP remainder.
2
9e28c156 3# First, verify basic function with two positive numbers.
665e21b4
AT
4SSSTTSSSSTSN | ST: Push +194
5SSSTSSSSSSTN | ST: Push +128
6TSTT | MA: Remainder
7TNSS | IO: Output character
9e28c156
AT
8
9# The VVS modulo function should always return a positive value.
10# C-derived languages (among others) do not share this convention.
11
12# This test verifies that -3 mod 2 = 1.
13SSTTTN | ST: Push -3
14SSSTSN | ST: Push +2
15TSTT | MA: Remainder
16TNST | IO: Output digit
17
18# This test verifies that -3 mod -2 = 1.
19SSTTTN | ST: Push -3
20SSTTSN | ST: Push -2
21TSTT | MA: Remainder
22TNST | IO: Output digit
23
24# This test verifies that -3 mod -(2^63) = 3.
25SSTTTN | ST: Push -3
26SSTTSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSN | PUSH -(2^63)
27TSTT | MA: Remainder
28TNST | IO: Output digit
29
30# All done
665e21b4 31NNN | FC: Terminate program