mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-10-11 09:07:01 +02:00
[svn r131] Fixed #11
All associative array properties now work as they should. Fixed problems with some cases of array.length and array.ptr. Fixed some problems with array properties. Fixed 'in' contracts.
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
module aa6;
|
||||
|
||||
void main()
|
||||
{
|
||||
int[int] aa;
|
||||
aa = [1:1, 2:4, 3:9, 4:16];
|
||||
printf("---\n");
|
||||
foreach(int k, int v; aa)
|
||||
printf("aa[%d] = %d\n", k, v);
|
||||
aa.rehash;
|
||||
printf("---\n");
|
||||
foreach(int k, int v; aa)
|
||||
printf("aa[%d] = %d\n", k, v);
|
||||
size_t n = aa.length;
|
||||
assert(n == 4);
|
||||
int[] keys = aa.keys;
|
||||
assert(keys[] == [1,2,3,4][]);
|
||||
int[] vals = aa.values;
|
||||
assert(vals[] == [1,4,9,16][]);
|
||||
aa.remove(3);
|
||||
printf("---\n");
|
||||
foreach(int k, int v; aa)
|
||||
printf("aa[%d] = %d\n", k, v);
|
||||
assert(aa.length == 3);
|
||||
}
|
||||
Reference in New Issue
Block a user