ObjFW  Diff

Differences From Artifact [1c9d8d3ad2]:

To Artifact [9aaf176836]:


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

static OFString *module;
const char *str = "Hello!";

static void
do_tests(Class class)
{
	OFDataArray *array[2];
	void *data[2];
	Class other;

	TEST(@"+[dataArrayWithItemSize:]",
	    (array[0] = [class dataArrayWithItemSize: 4096]))

	data[0] = [array[0] allocMemoryWithSize: 4096];







|







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

static OFString *module;
const char *str = "Hello!";

static void
do_tests(Class class)
{
	OFDataArray *array[4];
	void *data[2];
	Class other;

	TEST(@"+[dataArrayWithItemSize:]",
	    (array[0] = [class dataArrayWithItemSize: 4096]))

	data[0] = [array[0] allocMemoryWithSize: 4096];
57
58
59
60
61
62
63





64
65
66
67

68
69
70
71
72
73
74
		     fromCArray: [array[0] cArray]] &&
	    [array[1] isEqual: array[0]] &&
	    [array[1] removeNItems: 1] && ![array[0] isEqual: array[1]])

	TEST(@"-[copy]", (array[1] = [[array[0] copy] autorelease]) &&
	    [array[0] isEqual: array[1]])






	TEST(@"-[compare]", [array[0] compare: array[1]] == 0 &&
	    [array[1] removeNItems: 1] &&
	    [array[0] compare: array[1]] == OF_ORDERED_DESCENDING &&
	    [array[1] compare: array[0]] == OF_ORDERED_ASCENDING)


	TEST(@"-[hash]", [array[0] hash] == 0xC54621B6)

	TEST(@"-[removeNItems:]", [array[0] removeNItems: 1])

	TEST(@"Building strings",
	    (array[0] = [class dataArrayWithItemSize: 1]) &&







>
>
>
>
>



|
>







57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
		     fromCArray: [array[0] cArray]] &&
	    [array[1] isEqual: array[0]] &&
	    [array[1] removeNItems: 1] && ![array[0] isEqual: array[1]])

	TEST(@"-[copy]", (array[1] = [[array[0] copy] autorelease]) &&
	    [array[0] isEqual: array[1]])

	array[2] = [OFDataArray dataArrayWithItemSize: 1];
	array[3] = [OFDataArray dataArrayWithItemSize: 1];
	[array[2] addItem: "a"];
	[array[2] addItem: "a"];
	[array[3] addItem: "z"];
	TEST(@"-[compare]", [array[0] compare: array[1]] == 0 &&
	    [array[1] removeNItems: 1] &&
	    [array[0] compare: array[1]] == OF_ORDERED_DESCENDING &&
	    [array[1] compare: array[0]] == OF_ORDERED_ASCENDING &&
	    [array[2] compare: array[3]] == OF_ORDERED_ASCENDING)

	TEST(@"-[hash]", [array[0] hash] == 0xC54621B6)

	TEST(@"-[removeNItems:]", [array[0] removeNItems: 1])

	TEST(@"Building strings",
	    (array[0] = [class dataArrayWithItemSize: 1]) &&