summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/tests
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-06-14 23:14:16 +0000
committerKarl Berry <karl@freefriends.org>2010-06-14 23:14:16 +0000
commitc2175edc7aa44ca0b526f008d473d6f8a8ac4933 (patch)
treed6c491676b413ad1922481f8c3fc7b64c3afc0a5 /Build/source/utils/asymptote/tests
parent5d08e9ff4fe5fc836d237ea08e82c82b27d558a2 (diff)
asy 1.98
git-svn-id: svn://tug.org/texlive/trunk@18982 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/tests')
-rw-r--r--Build/source/utils/asymptote/tests/arith/integer.asy8
-rw-r--r--Build/source/utils/asymptote/tests/types/constructor.asy8
-rw-r--r--Build/source/utils/asymptote/tests/types/resolve.asy92
3 files changed, 108 insertions, 0 deletions
diff --git a/Build/source/utils/asymptote/tests/arith/integer.asy b/Build/source/utils/asymptote/tests/arith/integer.asy
index a402ca58955..b5c337d2733 100644
--- a/Build/source/utils/asymptote/tests/arith/integer.asy
+++ b/Build/source/utils/asymptote/tests/arith/integer.asy
@@ -12,4 +12,12 @@ 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();
diff --git a/Build/source/utils/asymptote/tests/types/constructor.asy b/Build/source/utils/asymptote/tests/types/constructor.asy
index 7dd13447cfd..754584edcdb 100644
--- a/Build/source/utils/asymptote/tests/types/constructor.asy
+++ b/Build/source/utils/asymptote/tests/types/constructor.asy
@@ -255,6 +255,14 @@ StartTest("constructor");
assert(Barr().x==89);
}
+{ // Function Comparison
+ struct A {
+ // Defines a function A A(int).
+ void operator init(int x) {}
+ }
+ assert(!(A == null));
+ assert(A != null);
+}
// File-level {{{1
// This assumes the file is named constructor.asy
diff --git a/Build/source/utils/asymptote/tests/types/resolve.asy b/Build/source/utils/asymptote/tests/types/resolve.asy
index e290ad58c48..83dd797e7cc 100644
--- a/Build/source/utils/asymptote/tests/types/resolve.asy
+++ b/Build/source/utils/asymptote/tests/types/resolve.asy
@@ -58,4 +58,96 @@ assert(g(y=4, 4.4) == 7);
assert(g(y=4.4, 4) == 8);
assert(g(y=4.4, 4.4) == 7);
+// Test exact matching over casting.
+{
+ void f(int x, real y=0.0, int z=0) {
+ assert(x==1);
+ assert(y==2.0);
+ assert(z==0);
+ }
+ f(1,2);
+}
+{
+ void f() {
+ assert(false);
+ }
+ void f(int x, real y=0.0, int z=0) {
+ assert(x==1);
+ assert(y==2.0);
+ assert(z==0);
+ }
+ f(1,2);
+}
+{
+ void f() {
+ assert(false);
+ }
+ void f(int x, int y) {
+ assert(x==1);
+ assert(y==2);
+ }
+ void f(int x, real y=0.0, int z=0) {
+ assert(false);
+ }
+ f(1,2);
+}
+{
+ struct A {}
+ struct B {}
+ struct C {}
+
+ void f(B);
+ void g(B);
+
+ // Should resolve to void (B).
+ assert(f == g);
+ assert(g == f);
+ assert(!(f != g));
+ assert(!(g != f));
+}
+{
+ struct A {}
+ struct B {}
+ struct C {}
+
+ void f(A), f(B);
+ void g(B), g(C);
+
+ // Should resolve to void (B).
+ assert(f == g);
+ assert(g == f);
+ assert(!(f != g));
+ assert(!(g != f));
+}
+{
+ struct A {}
+ struct B {}
+ struct C {}
+
+ void f(B);
+ void g(B), g(C);
+
+ // Should resolve to void (B).
+ assert(f == g);
+ assert(g == f);
+ assert(!(f != g));
+ assert(!(g != f));
+}
+{
+ struct A {}
+ struct B {}
+ struct C {}
+
+ void f(B);
+ void g(B), g(C);
+
+ // Should resolve to void (B).
+ assert(f == g);
+ assert(g == f);
+ assert(!(f != g));
+ assert(!(g != f));
+}
+
+// TODO: Add packing vs. casting tests.
+
EndTest();