1
2
3
4
5
6
7
8
9
10
11
12
13
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
|
/*
* Copyright (c) 2008
* Jonathan Schleifer <js@webkeks.org>
*
* All rights reserved.
*
* This file is part of libobjfw. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE included in
* the packaging of this file.
*/
#import "config.h"
#import <stdlib.h>
#import <string.h>
#import "OFXMLFactory.h"
#define NUM_TESTS 10
static int i;
inline void
check_result(char *result, const char *should)
{
i++;
if (!strcmp(result, should)) {
printf("\r\033[1;%dmTests successful: %2d/%d\033[0m",
(i == NUM_TESTS ? 32 : 33), i, NUM_TESTS);
fflush(stdout);
} else {
printf("\r\033[K\033[1;31mTest %d/%d failed!\033[0m\n",
i, NUM_TESTS);
printf("%s is NOT expected result!\n", result);
exit(1);
}
free(result);
}
|
>
|
|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
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
|
/*
* Copyright (c) 2008
* Jonathan Schleifer <js@webkeks.org>
*
* All rights reserved.
*
* This file is part of libobjfw. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE included in
* the packaging of this file.
*/
#import "config.h"
#import <stdio.h>
#import <stdlib.h>
#import <string.h>
#import "OFXMLFactory.h"
#define NUM_TESTS 10
static size_t i;
inline void
check_result(char *result, const char *should)
{
i++;
if (!strcmp(result, should)) {
printf("\r\033[1;%dmTests successful: %2zd/%d\033[0m",
(i == NUM_TESTS ? 32 : 33), i, NUM_TESTS);
fflush(stdout);
} else {
printf("\r\033[K\033[1;31mTest %zd/%d failed!\033[0m\n",
i, NUM_TESTS);
printf("%s is NOT expected result!\n", result);
exit(1);
}
free(result);
}
|