374
|
1 // $HeadURL$
|
|
2 // $Date$
|
|
3 // $Author$
|
|
4
|
|
5 module dstress.run.keys_01;
|
|
6
|
4
|
7 int main(){
|
|
8 int[char[]] array;
|
|
9 array["eins"]=1;
|
|
10 array["zwei"]=2;
|
|
11 array["drei"]=3;
|
|
12
|
|
13 char[][] key = array.keys;
|
|
14 assert(key.length==3);
|
|
15
|
|
16 bool have[3];
|
|
17
|
|
18 assert(!have[0]);
|
|
19 assert(!have[1]);
|
|
20 assert(!have[2]);
|
|
21
|
|
22 foreach(char[] value; key){
|
|
23 switch(value){
|
|
24 case "eins":{
|
|
25 have[0]=true;
|
|
26 break;
|
|
27 }case "zwei":{
|
|
28 have[1]=true;
|
|
29 break;
|
|
30 }case "drei":{
|
|
31 have[2]=true;
|
|
32 break;
|
|
33 }default:{
|
|
34 assert(0);
|
|
35 }
|
|
36 }
|
|
37 }
|
|
38
|
|
39 assert(have[0]);
|
|
40 assert(have[1]);
|
|
41 assert(have[2]);
|
|
42
|
|
43 return 0;
|
|
44 }
|