Mercurial > projects > ldc
annotate test/funcs.d @ 78:2332006e1fa4 trunk
[svn r82] Fixed: Fall-through switch cases were broken.
author | lindquist |
---|---|
date | Wed, 31 Oct 2007 20:50:21 +0100 |
parents | c53b6e3fe49a |
children | d9d5d59873d8 |
rev | line source |
---|---|
1 | 1 void main() |
2 { | |
3 printf("Testing functions\n"); | |
4 int i = 5; | |
5 assert(a(i) == 110); | |
6 assert(i == 11); | |
7 | |
8 S s; | |
9 s.i = 5; | |
10 d(s); | |
11 assert(s.i == 5); | |
12 e(s); | |
13 assert(s.i == 6); | |
14 | |
15 printf(" SUCCESS\n"); | |
16 } | |
17 | |
18 int a(ref int i) | |
19 { | |
20 i*=2; | |
21 return b(i); | |
22 } | |
23 | |
24 int b(ref int i) | |
25 { | |
26 i++; | |
27 return c(i); | |
28 } | |
29 | |
30 int c(int i) | |
31 { | |
32 return i*10; | |
33 } | |
34 | |
35 struct S | |
36 { | |
37 int i; | |
38 } | |
39 | |
40 void d(S s) | |
41 { | |
42 s.i++; | |
43 } | |
44 | |
45 void e(ref S s) | |
46 { | |
47 s.i++; | |
48 } |