comparison 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
comparison
equal deleted inserted replaced
290:ebaf65fc4726 291:068cb3c60afb
1 module tangotests.arrays2;
2
3 void main()
4 {
5 intarrays!(byte)();
6 intarrays!(ubyte)();
7 intarrays!(short)();
8 intarrays!(ushort)();
9 intarrays!(int)();
10 intarrays!(uint)();
11 intarrays!(long)();
12 intarrays!(ulong)();
13 }
14
15 void intarrays(T)()
16 {
17 T[] ia = [cast(T)1,2,3,4];
18 T[] ib = [cast(T)1,2,3,4];
19 T[] ic = [cast(T)1,2,3];
20 T[] id = [cast(T)1,2,3,4,5];
21
22 assert(ia == ia);
23 assert(ia == ib);
24 assert(ia != ic);
25 assert(ia != id);
26 assert(ia > ic);
27 assert(ia !< ic);
28 assert(ia < id);
29 assert(ia !> id);
30 }