Mercurial > projects > ldc
annotate test/funcs.d @ 44:ea65e12b0dd0 trunk
[svn r48] fixed some storage problems
author | lindquist |
---|---|
date | Fri, 19 Oct 2007 16:05:06 +0200 |
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 } |