comparison tests/mini/aa3.d @ 341:1bb99290e03a trunk

[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
author lindquist
date Sun, 13 Jul 2008 02:51:19 +0200
parents test/aa3.d@d9d5d59873d8
children
comparison
equal deleted inserted replaced
340:351c0077d0b3 341:1bb99290e03a
1 module aa3;
2
3 extern(C) int printf(char*, ...);
4 alias char[] string;
5
6 void main()
7 {
8 int[string] aa;
9 {aa["hello"] = 1;}
10 {int* p = "" in aa;}
11 aa[" worl"] = 2;
12 aa["d"] = 3;
13 aa["thisisgreat"] = 10;
14 int sum;
15 string cat;
16 {
17 foreach(k,v;aa)
18 {
19 printf("int[%.*s] = %d\n", k.length, k.ptr, v);
20 sum += v;
21 cat ~= k;
22 }
23 }
24 assert(sum == 16);
25 printf("cat = %.*s\n", cat.length, cat.ptr);
26 assert(cat.length == 22);
27 }