ObjFW  Diff

Differences From Artifact [147b8c86d0]:

To Artifact [61b6eedfea]:


55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
int
main()
{
	size_t i, j;
	OFList *list;
	of_list_object_t *iter;

	list = [OFList new];

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

	for (iter = [list first], i = 0; iter != NULL; iter = iter->next, i++)
		if (!strcmp([iter->object cString], strings[i]))
			SUCCESS
		else
			FAIL

	CHECK(!strcmp([[list first]->object cString], strings[0]))
	CHECK(!strcmp([[list last]->object cString], strings[2]))

	[list remove: [list last]];
	CHECK(!strcmp([[list last]->object cString], strings[1]))

	[list remove: [list first]];
	CHECK(!strcmp([[list first]->object cString],
	    [[list last]->object cString]))

	[list insert: [OFString newFromCString: strings[0]]
	      before: [list last]];
	[list insert: [OFString newFromCString: strings[2]]
	       after: [list first]->next];

	for (iter = [list first], j = 0; iter != NULL; iter = iter->next, j++)
		CHECK(!strcmp([iter->object cString], strings[j]))

	puts("");

	return 0;
}







|

|
|
|

















|

|









55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
int
main()
{
	size_t i, j;
	OFList *list;
	of_list_object_t *iter;

	list = [OFList list];

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

	for (iter = [list first], i = 0; iter != NULL; iter = iter->next, i++)
		if (!strcmp([iter->object cString], strings[i]))
			SUCCESS
		else
			FAIL

	CHECK(!strcmp([[list first]->object cString], strings[0]))
	CHECK(!strcmp([[list last]->object cString], strings[2]))

	[list remove: [list last]];
	CHECK(!strcmp([[list last]->object cString], strings[1]))

	[list remove: [list first]];
	CHECK(!strcmp([[list first]->object cString],
	    [[list last]->object cString]))

	[list insert: [OFString stringWithCString: strings[0]]
	      before: [list last]];
	[list insert: [OFString stringWithCString: strings[2]]
	       after: [list first]->next];

	for (iter = [list first], j = 0; iter != NULL; iter = iter->next, j++)
		CHECK(!strcmp([iter->object cString], strings[j]))

	puts("");

	return 0;
}