root/trunk/src/tests/sample.c

Revision 918, 0.5 kB (checked in by takkaria, 4 months ago)

Use consistent newlines everywhere, and also set the svn:eol-style property to native on all text files.

  • Property svn:eol-style set to native
Line 
1 /*
2  * Sample tests.
3  * Generally you'll want to test your own code in here. =)
4  */
5 #include "../z-tests.h"
6
7 /* basic test setup */
8 TEST(addition)
9 {
10         int x = 2;
11         int y = 2;
12         CHECK(x + y == 4);
13 }
14 TEST_END
15
16 /*
17  * If CHECK doesn't make sense somewhere, you can
18  * use FAIL instead. Note that a FAILure will
19  * immediately abort execution.
20  */
21 TEST(less_than)
22 {
23         int x = 4;
24         int y = 2;
25         if(x < y) FAIL;
26 }
27 TEST_END
28
29 /* typical 'main' block */
30 int main(void)
31 {
32         TEST_PLAN(t, 2);
33
34         TEST_RUN(&t, addition);
35         TEST_RUN(&t, less_than);
36
37         TESTS_COMPLETE(t);
38 }
39
Note: See TracBrowser for help on using the browser.