Mercurial > projects > ldc
annotate tests/mini/funcs.d @ 570:6d9cf3f74f93
Typo in runtime makefile.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Thu, 04 Sep 2008 16:14:07 +0200 |
parents | 1bb99290e03a |
children |
rev | line source |
---|---|
270
d9d5d59873d8
[svn r291] Fixed a bunch of the old Phobos tests to work with Tango.
lindquist
parents:
1
diff
changeset
|
1 extern(C) int printf(char*, ...); |
d9d5d59873d8
[svn r291] Fixed a bunch of the old Phobos tests to work with Tango.
lindquist
parents:
1
diff
changeset
|
2 |
1 | 3 void main() |
4 { | |
5 printf("Testing functions\n"); | |
6 int i = 5; | |
7 assert(a(i) == 110); | |
8 assert(i == 11); | |
9 | |
10 S s; | |
11 s.i = 5; | |
12 d(s); | |
13 assert(s.i == 5); | |
14 e(s); | |
15 assert(s.i == 6); | |
16 | |
17 printf(" SUCCESS\n"); | |
18 } | |
19 | |
20 int a(ref int i) | |
21 { | |
22 i*=2; | |
23 return b(i); | |
24 } | |
25 | |
26 int b(ref int i) | |
27 { | |
28 i++; | |
29 return c(i); | |
30 } | |
31 | |
32 int c(int i) | |
33 { | |
34 return i*10; | |
35 } | |
36 | |
37 struct S | |
38 { | |
39 int i; | |
40 } | |
41 | |
42 void d(S s) | |
43 { | |
44 s.i++; | |
45 } | |
46 | |
47 void e(ref S s) | |
48 { | |
49 s.i++; | |
50 } |