Mercurial > projects > dstress
view run/a/associative_array_23_A.d @ 1611:9f94be6a5ace
Fix typo in last commit.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 10 May 2009 10:56:43 +0200 |
parents | ca435c6f02c8 |
children |
line wrap: on
line source
// $HeadURL$ // $Date$ // $Author$ module dstress.run.a.associative_array_23_A; int main(){ char[][int] arr = [4:"vier", 0:"null", 2:"zwei"]; if(3 != arr.length){ assert(0); } char[][] master_e = ["vier", "null", "zwei"]; int[] master_i = [4, 0, 2]; foreach(index, element; arr){ bool found = false; foreach(pos, i; master_i){ if(index == i && element == master_e[pos]){ master_i = master_i[0 .. pos] ~ master_i[pos+1 .. $]; master_e = master_e[0 .. pos] ~ master_e[pos+1 .. $]; found = true; break; } } if(!found){ assert(0); } } if(master_i.length){ assert(0); } return 0; }