annotate run/rehash_01.d @ 1630:d0efa3ae5522 default tip

run/mini/naked_asm5: New x86_64 ABI passes the arguments in reverse order.
author David Nadlinger <code@klickverbot.at>
date Sat, 23 Apr 2011 22:57:32 +0200
parents 9e0847cf535a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
227
e1af2a603ff4 added missing keywords
thomask
parents: 226
diff changeset
1 // $HeadURL$
e1af2a603ff4 added missing keywords
thomask
parents: 226
diff changeset
2 // $Date$
e1af2a603ff4 added missing keywords
thomask
parents: 226
diff changeset
3 // $Author$
e1af2a603ff4 added missing keywords
thomask
parents: 226
diff changeset
4
226
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
5 module dstress.run.rehash_01;
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
6
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
7 int main(){
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
8 int[char[]] array;
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
9 array["eins"]=1;
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
10 array["zwei"]=2;
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
11 array["drei"]=3;
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
12
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
13 assert(array.length==3);
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
14
457
0a38b9e8c56b rehash / inplace
thomask
parents: 227
diff changeset
15 int[char[]] rehashed=array.rehash;
528
9e0847cf535a pre DMD-0.123 review
thomask
parents: 457
diff changeset
16 assert(rehashed is array);
226
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
17
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
18 char[][] key = array.keys;
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
19 assert(key.length==3);
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
20
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
21 bool have[3];
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
22
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
23 assert(!have[0]);
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
24 assert(!have[1]);
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
25 assert(!have[2]);
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
26
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
27 foreach(char[] value; key){
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
28 switch(value){
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
29 case "eins":{
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
30 have[0]=true;
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
31 break;
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
32 }case "zwei":{
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
33 have[1]=true;
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
34 break;
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
35 }case "drei":{
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
36 have[2]=true;
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
37 break;
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
38 }default:{
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
39 assert(0);
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
40 }
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
41 }
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
42 }
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
43
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
44 assert(have[0]);
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
45 assert(have[1]);
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
46 assert(have[2]);
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
47
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
48 return 0;
7b556b911877 extended associative array tests
thomask
parents:
diff changeset
49 }