comparison run/mini/with3.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 enum fields
2 {
3 FIELD1,
4 FIELD2
5 }
6
7 fields find_field(fields f) {
8 with(fields) {
9 switch(f) {
10 case FIELD1:
11 return FIELD1;
12 default:
13 return FIELD2;
14 }
15 }
16 }
17
18 void main() {
19 assert(find_field(fields.FIELD1) == fields.FIELD1);
20 assert(find_field(fields.FIELD2) == fields.FIELD2);
21 }