ObjFW  Diff

Differences From Artifact [abc8b39d7c]:

To Artifact [f0c02f400c]:


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
45
46
47
48
49
#endif
#include <stdlib.h>

#import <OFString.h>
#import <OFAutoreleasePool.h>

extern void object_tests();




static void
output(OFString *str, int color)
{
#ifdef STDOUT
	switch (color) {
	case 0:
		fputs("\r\033[K\033[1;33m", stdout);
		break;
	case 1:
		fputs("\r\033[K\033[1;32m", stdout);
		break;
	case 2:
		fputs("\r\033[K\033[1;31m", stdout);
		break;
	}

	fputs([str cString], stdout);

	fputs("\033[m", stdout);

#else
#error No output method!
#endif
}

void
testing(OFString *module, OFString *test)







>
>
>


















<

>







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
45
46
47
48
49
50
51
52
#endif
#include <stdlib.h>

#import <OFString.h>
#import <OFAutoreleasePool.h>

extern void object_tests();
extern void string_tests();

static int fails = 0;

static void
output(OFString *str, int color)
{
#ifdef STDOUT
	switch (color) {
	case 0:
		fputs("\r\033[K\033[1;33m", stdout);
		break;
	case 1:
		fputs("\r\033[K\033[1;32m", stdout);
		break;
	case 2:
		fputs("\r\033[K\033[1;31m", stdout);
		break;
	}

	fputs([str cString], stdout);

	fputs("\033[m", stdout);
	fflush(stdout);
#else
#error No output method!
#endif
}

void
testing(OFString *module, OFString *test)
71
72
73
74
75
76
77

78
79
80
81
82
83
84
85

86
87
88
failed(OFString *module, OFString *test)
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFString *str = [OFString stringWithFormat: @"[%s] %s: failed\n",
						    [module cString],
						    [test cString]];
	output(str, 2);

	[pool release];
	exit(1);
}

int
main()
{
	object_tests();


	return 0;
}







>

<






>

|

74
75
76
77
78
79
80
81
82

83
84
85
86
87
88
89
90
91
92
failed(OFString *module, OFString *test)
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFString *str = [OFString stringWithFormat: @"[%s] %s: failed\n",
						    [module cString],
						    [test cString]];
	output(str, 2);
	fails++;
	[pool release];

}

int
main()
{
	object_tests();
	string_tests();

	return fails;
}