summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/tests/arith/integer.asy
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/utils/asymptote/tests/arith/integer.asy')
-rw-r--r--Build/source/utils/asymptote/tests/arith/integer.asy23
1 files changed, 23 insertions, 0 deletions
diff --git a/Build/source/utils/asymptote/tests/arith/integer.asy b/Build/source/utils/asymptote/tests/arith/integer.asy
new file mode 100644
index 00000000000..b5c337d2733
--- /dev/null
+++ b/Build/source/utils/asymptote/tests/arith/integer.asy
@@ -0,0 +1,23 @@
+// Integer arithmetic.
+import TestLib;
+StartTest("integer addition");
+assert(1+1==2);
+EndTest();
+StartTest("integer subtraction");
+assert(2-1==1);
+EndTest();
+StartTest("integer multiplication");
+assert(2*2==4);
+EndTest();
+StartTest("integer division");
+assert(4/2==2);
+EndTest();
+StartTest("integer self ops");
+{ int x = 3; assert(++x==4); assert(x==4); }
+{ int x = 3; assert(--x==2); assert(x==2); }
+{ int x = 3; assert((x+=7) == 10); assert(x==10); }
+{ int x = 3; assert((x-=7) == -4); assert(x==-4); }
+{ int x = 3; assert((x*=7) == 21); assert(x==21); }
+{ int x = 10; assert((x%=4) == 2); assert(x==2); }
+EndTest();
+