Grid Community Toolkit
6.2.1653033972 (tag: v6.2.20220524)
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
gridftp
net_manager
test
globus_test_tap.h
Go to the documentation of this file.
1
#include <stdarg.h>
2
#include <stdio.h>
3
9
static
int
total = 0;
10
static
int
failed = 0;
11
static
int
skipped = 0;
12
static
void
ok(
int
predval,
const
char
*fmt, ...)
13
{
14
static
int
testno=1;
15
va_list ap;
16
printf(
"%s %d - "
, predval ?
"ok"
:
"not ok"
, testno++);
17
va_start(ap, fmt);
18
vprintf(fmt, ap);
19
va_end(ap);
20
printf(
"\n"
);
21
if
(!predval)
22
{
23
failed++;
24
}
25
total++;
26
}
27
28
#if __STDC_VERSION__ >= 199901L
29
#define get_explanationok(predval, ...) __VA_ARGS__
30
31
/* This only works if the second parameter is a call to the ok function */
32
#define skip(skip_predicate, ...) \
33
if (skip_predicate) \
34
{ \
35
ok(1, " # SKIP (" #skip_predicate ") " get_explanation ## __VA_ARGS__); \
36
skipped++; \
37
} \
38
else \
39
{ \
40
__VA_ARGS__; \
41
}
42
#else
43
#define skip(skip_predicate, okcall) \
44
if (skip_predicate) \
45
{ \
46
ok(1, " # SKIP (" #skip_predicate ") "); \
47
skipped++; \
48
} \
49
else \
50
{ \
51
okcall; \
52
}
53
#endif
54
55
#define TEST_EXIT_CODE (skipped == total) ? 77 : failed
56
#define TEST_ASSERT(assertion) if (!(assertion)) { fprintf(stderr, "%s:%d:%s %s\n", __FILE__, __LINE__, __func__, #assertion); return 1; }
57
#define TEST_ASSERT_RESULT_SUCCESS(result) \
58
if (result) { \
59
char * err = globus_error_print_friendly(globus_error_peek(result)); \
60
fprintf(stderr, "%s:%d:%s %s\n", __FILE__, __LINE__, __func__, err); \
61
free(err); \
62
return 1; \
63
}
Generated by
1.8.5