Mercurial > projects > dstress
view run/a/associative_array_19_R.d @ 1599:d37b19f7e8bb
Move run/c/case_01 to nocompile.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Tue, 09 Sep 2008 17:28:31 +0200 |
parents | b8c0195059d9 |
children |
line wrap: on
line source
// $HeadURL$ // $Date$ // $Author$ // @author@ Sebastian Beschke <s.beschke@gmx.de> // @date@ 2005-03-25 // @uri@ http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.bugs&artnum=6821 // @WARNING@ direct access to Phobos' GC module dstress.run.a.associative_array_19_R; import std.gc; union Key{ char x; } class Payload { this(Key value) { value.x += 1; this.value = value; } Key value; ubyte[1] dummy; } int main(){ Payload[Key] aa; Key[] allKeys; static Key a = { 'a' }; static Key b = { 'b' }; static Key c = { 'c' }; allKeys ~= a; allKeys ~= b; allKeys ~= c; foreach(Key key; allKeys) { aa[key] = new Payload(key); } for(size_t step = 0; step < 10000; step++){ foreach(Key key; allKeys) { if(!(key in aa)){ assert(0); } Payload p = aa[key]; if(p.value.x != key.x + 1){ assert(0); } } std.gc.fullCollect(); } return 0; }