1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2011. |
---|
3 | * On-Line Applications Research Corporation (OAR). |
---|
4 | * |
---|
5 | * The license and distribution terms for this file may be |
---|
6 | * found in the file LICENSE in this distribution or at |
---|
7 | * http://www.rtems.com/license/LICENSE. |
---|
8 | * |
---|
9 | * $Id$ |
---|
10 | */ |
---|
11 | |
---|
12 | #ifndef __FSTEST_H |
---|
13 | #define __FSTEST_H |
---|
14 | |
---|
15 | #define TIME_PRECISION (2) |
---|
16 | #define TIME_EQUAL(x,y) (abs((x)-(y))<TIME_PRECISION) |
---|
17 | |
---|
18 | |
---|
19 | #define FS_PASS() do {puts("PASS");} while (0) |
---|
20 | #define FS_FAIL() do {\ |
---|
21 | printf( "FAIL %s: %d \n", __FILE__, __LINE__ );\ |
---|
22 | } while (0) |
---|
23 | |
---|
24 | |
---|
25 | #define SHOW_MESSAGE(e, func, ...) printf(\ |
---|
26 | "Testing %-10s with arguments: %-20s EXPECT %s\n",\ |
---|
27 | #func,#__VA_ARGS__,#e) |
---|
28 | |
---|
29 | #define EXPECT_EQUAL(expect, function, ...) do { \ |
---|
30 | SHOW_MESSAGE(#expect,function,__VA_ARGS__);\ |
---|
31 | if (expect==function(__VA_ARGS__)) \ |
---|
32 | FS_PASS();\ |
---|
33 | else \ |
---|
34 | FS_FAIL();\ |
---|
35 | } while (0) |
---|
36 | |
---|
37 | #define EXPECT_UNEQUAL(expect, function, ...) do { \ |
---|
38 | SHOW_MESSAGE(#expect,function,__VA_ARGS__);\ |
---|
39 | if (expect!=function(__VA_ARGS__)) \ |
---|
40 | FS_PASS();\ |
---|
41 | else\ |
---|
42 | FS_FAIL();\ |
---|
43 | } while (0) |
---|
44 | |
---|
45 | #define EXPECT_ERROR(ERROR, function, ...) do { \ |
---|
46 | SHOW_MESSAGE(#ERROR,function,#__VA_ARGS__);\ |
---|
47 | if ((-1==function(__VA_ARGS__)) && (errno==ERROR)) \ |
---|
48 | FS_PASS();\ |
---|
49 | else \ |
---|
50 | FS_FAIL();\ |
---|
51 | } while (0) |
---|
52 | |
---|
53 | void test(void); |
---|
54 | |
---|
55 | #define BASE_FOR_TEST "/mnt" |
---|
56 | #endif |
---|