14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
extern void testing(OFString*, OFString*);
extern void success(OFString*, OFString*);
extern void failed(OFString*, OFString*);
#define TEST(test, cond) \
{ \
testing(module, test); \
if (cond) \
success(module, test); \
else \
failed(module, test); \
}
#define EXPECT_EXCEPTION(test, exception, code) \
{ \
BOOL caught = NO; \
\
@try { \
code; \
} @catch (exception *e) { \
caught = YES; \
[e dealloc]; \
} \
\
TEST(test, caught) \
}
|
>
>
>
|
>
>
>
|
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
extern void testing(OFString*, OFString*);
extern void success(OFString*, OFString*);
extern void failed(OFString*, OFString*);
#define TEST(test, cond) \
{ \
testing(module, test); \
\
if (cond) \
success(module, test); \
else \
failed(module, test); \
}
#define EXPECT_EXCEPTION(test, exception, code) \
{ \
BOOL caught = NO; \
\
testing(module, test); \
\
@try { \
code; \
} @catch (exception *e) { \
caught = YES; \
[e dealloc]; \
} \
\
if (caught) \
success(module, test); \
else \
failed(module, test); \
}
|