comparison tests/mini/structs8.d @ 345:5320fe65a65d trunk

[svn r366] Fixed identity exprs for structs was comparing addresses, not content!
author lindquist
date Sun, 13 Jul 2008 04:27:02 +0200
parents
children
comparison
equal deleted inserted replaced
344:e20ce6d8d374 345:5320fe65a65d
1 module test.structs8;
2
3 struct S
4 {
5 int a,b;
6 }
7
8 void main()
9 {
10 S a = S(1,2);
11 S b = S(2,3);
12 S c = S(3,4);
13 S d = S(2,3);
14
15 assert(a == a);
16 assert(a != b);
17 assert(a != c);
18 assert(a != d);
19
20 assert(b != a);
21 assert(b == b);
22 assert(b != c);
23 assert(b == d);
24
25 assert(c != a);
26 assert(c != b);
27 assert(c == c);
28 assert(c != d);
29
30 assert(d != a);
31 assert(d == b);
32 assert(d != c);
33 assert(d == d);
34
35 assert(a is a);
36 assert(a !is b);
37 assert(a !is c);
38 assert(a !is d);
39
40 assert(b !is a);
41 assert(b is b);
42 assert(b !is c);
43 assert(b is d);
44
45 assert(c !is a);
46 assert(c !is b);
47 assert(c is c);
48 assert(c !is d);
49
50 assert(d !is a);
51 assert(d is b);
52 assert(d !is c);
53 assert(d is d);
54 }