ObjFW  Diff

Differences From Artifact [95b616ccee]:

To Artifact [7639c23356]:


19
20
21
22
23
24
25
26

27
28
29
30
31
32
33
19
20
21
22
23
24
25

26
27
28
29
30
31
32
33







-
+








#ifndef _WIN32
#define ZD "%zd"
#else
#define ZD "%u"
#endif

#define NUM_TESTS 14
#define NUM_TESTS 23
#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								\
51
52
53
54
55
56
57
58
59


60
61
62
63
64
65
66
51
52
53
54
55
56
57


58
59
60
61
62
63
64
65
66







-
-
+
+







	@"Third String Object"
};

int
main()
{
	size_t i, j;
	OFList *list, *list2;
	of_list_object_t *iter;
	OFList *list, *list2, *list3;
	of_list_object_t *iter, *iter2;

	list = [OFList list];

	[list append: strings[0]];
	[list append: strings[1]];
	[list append: strings[2]];

95
96
97
98
99
100
101




102

103
104












105
106
107
108
95
96
97
98
99
100
101
102
103
104
105

106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124







+
+
+
+
-
+


+
+
+
+
+
+
+
+
+
+
+
+




	[list2 append: strings[1]];
	[list2 append: strings[2]];
	CHECK([list2 isEqual: list]);

	[list2 remove: [list2 last]];
	CHECK(![list2 isEqual: list]);

	/*
	 * Only mutableCopy is guaranteed to return a real copy instead of just
	 * increasing the reference counter.
	 */
	[list2 append: @"foo"];
	[list2 append: [@"foo" mutableCopy]];
	CHECK(![list2 isEqual: list]);

	list3 = [list2 copy];
	CHECK([list2 isEqual: list3]);

	for (iter = [list2 first], iter2 = [list3 first];
	    iter != NULL && iter2 != NULL;
	    iter = iter->next, iter2 = iter2->next) {
		CHECK(iter != iter2)
		CHECK(iter->object == iter2->object)
	}
	CHECK(iter == NULL && iter2 == NULL)
	CHECK([[list2 last]->object retainCount] == 3)

	puts("");

	return 0;
}