root/trunk/src/tutorials/examples/in_tutorial/unittests/unittests.d

Revision 6, 0.8 kB (checked in by jcc7, 3 years ago)

Made more progress in developing convertToWiki and added some files.

Line 
1 module unittests;
2
3 void main()
4 {
5
6     printf("test\n\0");
7
8 }
9
10
11
12
13 class Whatever
14 {
15
16    
17     unittest
18    
19     {
20         /* unittests seem to be run in the order they appear in the code, i.e. since
21            the Whatever class appears before the module unittests, these are run first.
22
23            The -unittests flag has to be used to compile this program or else this code is ignored.
24         
25         */
26
27         printf("class Whatever UnitTest...\n\0");
28
29
30         /* If the expession of an assert doesn't evaluate to true, an exception is thrown. */
31
32         assert(true==1);
33         assert(true);
34         assert(false==false);
35         assert(!false);   
36    
37     }
38
39 }
40
41
42
43 unittest
44
45 {
46     printf("module UnitTest...\n\0");
47     assert(true==1);
48     assert(true);
49     assert(false==false);
50
51
52 }
Note: See TracBrowser for help on using the browser.