Mercurial > projects > dstress
comparison run/mini/foreach8.d @ 1628:c6ef09dfba4d
add mini test set from ldc project
author | Moritz Warning <moritzwarning@web.de> |
---|---|
date | Mon, 10 Jan 2011 19:47:18 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1627:e1b954780837 | 1628:c6ef09dfba4d |
---|---|
1 module mini.foreach8; | |
2 | |
3 extern(C) int printf(char*, ...); | |
4 | |
5 int main(){ | |
6 dchar[] array="\u2260"; | |
7 printf("array[0] == %u\n", array[0]); | |
8 int test=0; | |
9 int count=0; | |
10 assert(count==0); | |
11 foreach(int index, char obj; array){ | |
12 printf("%d\n", obj); | |
13 test+=obj; | |
14 count++; | |
15 } | |
16 assert(count==3); | |
17 assert(test==0x20b); | |
18 return 0; | |
19 } |