diff options
author | Karl Berry <karl@freefriends.org> | 2010-06-14 23:14:16 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-06-14 23:14:16 +0000 |
commit | c2175edc7aa44ca0b526f008d473d6f8a8ac4933 (patch) | |
tree | d6c491676b413ad1922481f8c3fc7b64c3afc0a5 /Build/source/utils/asymptote/tests/types | |
parent | 5d08e9ff4fe5fc836d237ea08e82c82b27d558a2 (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/types')
-rw-r--r-- | Build/source/utils/asymptote/tests/types/constructor.asy | 8 | ||||
-rw-r--r-- | Build/source/utils/asymptote/tests/types/resolve.asy | 92 |
2 files changed, 100 insertions, 0 deletions
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(); |