Changeset 478
- Timestamp:
- 01/06/11 07:30:35 (14 years ago)
- Files:
-
- trunk/src/rt/aaA.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/rt/aaA.d
r476 r478 543 543 assert(keys.length == 1); 544 544 assert(memcmp(keys[0].ptr, cast(char*)"hello", 5) == 0); 545 545 546 546 int[] values = aa.values; 547 547 assert(values.length == 1); 548 548 assert(values[0] == 4); 549 549 550 550 aa.rehash; 551 551 assert(aa.length == 1); 552 552 assert(aa["hello"] == 4); 553 554 aa["foo"] = 1; 555 aa["bar"] = 2; 556 aa["batz"] = 3; 557 558 assert(aa.keys.length == 4); 559 assert(aa.values.length == 4); 560 561 foreach(a; aa.keys) 562 { 563 assert(a.length != 0); 564 assert(a.ptr != null); 565 //printf("key: %.*s -> value: %d\n", a.length, a.ptr, aa[a]); 566 } 567 568 foreach(v; aa.values) 569 { 570 assert(v != 0); 571 //printf("value: %d\n", v); 572 } 553 573 } 554 574 555 575 556 576 /********************************************** 557 577 * 'apply' for associative arrays - to support foreach 558 578 */ 559 579 560 580 // dg is D, but _aaApply() is C 561 581 extern (D) typedef int delegate(void *) dg_t; 562 582
