Mercurial > projects > ldc
comparison tests/mini/aa4.d @ 341:1bb99290e03a trunk
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
author | lindquist |
---|---|
date | Sun, 13 Jul 2008 02:51:19 +0200 |
parents | test/aa4.d@5ab8e92611f9 |
children |
comparison
equal
deleted
inserted
replaced
340:351c0077d0b3 | 341:1bb99290e03a |
---|---|
1 module aa4; | |
2 | |
3 void main() | |
4 { | |
5 int[int] aa; | |
6 aa = addkey(aa,42,12); | |
7 int* p = haskey(aa,42); | |
8 assert(p && *p == 12); | |
9 } | |
10 | |
11 int[int] addkey(int[int] aa, int key, int val) | |
12 { | |
13 aa[key] = val; | |
14 return aa; | |
15 } | |
16 | |
17 int* haskey(int[int] aa, int key) | |
18 { | |
19 return key in aa; | |
20 } |