ObjFW  Check-in [b023058e08]

Overview
Comment:Fix printf in tests.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b023058e085a8b87b8a56447f0771ddad83a2251b4f0da0d3a085c27494084b9
User & Date: js on 2008-12-20 14:26:16
Other Links: manifest | tags
Context
2008-12-20
14:41
Don't put void* in lists, but objects. check-in: b2c9f574cb user: js tags: trunk
14:26
Fix printf in tests. check-in: b023058e08 user: js tags: trunk
14:19
Remove wchar_t stuff, as that's not portable anyway. check-in: 4360177618 user: js tags: trunk
Changes

Modified tests/OFList/OFList.m from [2042f99cd4] to [74e719b9d6].

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

#import "OFString.h"
#import "OFList.h"

#define NUM_TESTS 5
#define SUCCESS								\
{									\
	printf("\r\033[1;%dmTests successful: %d/%d\033[0m",		\
	    (i == NUM_TESTS - 1 ? 32 : 33), i + 1, NUM_TESTS);		\
	fflush(stdout);							\
}
#define FAIL								\
{									\
	printf("\r\033[K\033[1;31mTest %d/%d failed!\033[m\n",		\
	    i + 1, NUM_TESTS);						\
	return 1;							\
}
#define CHECK(cond)							\
	if (cond)							\
		SUCCESS							\
	else								\







|





|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

#import "OFString.h"
#import "OFList.h"

#define NUM_TESTS 5
#define SUCCESS								\
{									\
	printf("\r\033[1;%dmTests successful: %zd/%d\033[0m",		\
	    (i == NUM_TESTS - 1 ? 32 : 33), i + 1, NUM_TESTS);		\
	fflush(stdout);							\
}
#define FAIL								\
{									\
	printf("\r\033[K\033[1;31mTest %zd/%d failed!\033[m\n",		\
	    i + 1, NUM_TESTS);						\
	return 1;							\
}
#define CHECK(cond)							\
	if (cond)							\
		SUCCESS							\
	else								\

Modified tests/OFXMLFactory/OFXMLFactory.m from [38666c43a6] to [308bb2e261].

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);
}