diff tangotests/arrays2.d @ 291:068cb3c60afb trunk

[svn r312] Changed assert codegen to insert an unreachable terminator after the call to the assert function, which currently calls abort(). Changed array comparison runtime support to pass the array typeinfo instead of the element typeinfo. This allows a cleaner and faster implementation.
author lindquist
date Sat, 21 Jun 2008 21:16:26 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tangotests/arrays2.d	Sat Jun 21 21:16:26 2008 +0200
@@ -0,0 +1,30 @@
+module tangotests.arrays2;
+
+void main()
+{
+    intarrays!(byte)();
+    intarrays!(ubyte)();
+    intarrays!(short)();
+    intarrays!(ushort)();
+    intarrays!(int)();
+    intarrays!(uint)();
+    intarrays!(long)();
+    intarrays!(ulong)();
+}
+
+void intarrays(T)()
+{
+    T[] ia = [cast(T)1,2,3,4];
+    T[] ib = [cast(T)1,2,3,4];
+    T[] ic = [cast(T)1,2,3];
+    T[] id = [cast(T)1,2,3,4,5];
+
+    assert(ia == ia);
+    assert(ia == ib);
+    assert(ia != ic);
+    assert(ia != id);
+    assert(ia > ic);
+    assert(ia !< ic);
+    assert(ia < id);
+    assert(ia !> id);
+}