ObjFW  Diff

Differences From Artifact [83725e7e15]:

To Artifact [086a701808]:


27
28
29
30
31
32
33


34
35
36
37
38
39
40
		puts("Resuming...");			\
	}						\
	if (!caught) {					\
		puts("NOT CAUGHT!");			\
		return 1;				\
	}



int
main()
{
	BOOL caught;
	OFArray *a;
	void *p, *q;
	size_t i;







>
>







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
		puts("Resuming...");			\
	}						\
	if (!caught) {					\
		puts("NOT CAUGHT!");			\
		return 1;				\
	}

const char *str = "Hallo!";

int
main()
{
	BOOL caught;
	OFArray *a;
	void *p, *q;
	size_t i;
94
95
96
97
98
99
100

















101
102
	puts("Trying to remove more data than we added...");
	CATCH_EXCEPTION([a removeNItems: [a items] + 1], OFOverflowException);

	puts("Trying to access an index that does not exist...");
	CATCH_EXCEPTION([a item: [a items]], OFOverflowException);

	[a free];

















	return 0;
}







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


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
	puts("Trying to remove more data than we added...");
	CATCH_EXCEPTION([a removeNItems: [a items] + 1], OFOverflowException);

	puts("Trying to access an index that does not exist...");
	CATCH_EXCEPTION([a item: [a items]], OFOverflowException);

	[a free];

	puts("Creating new array and using it to build a string...");
	a = [OFArray newWithItemSize: 1];

	for (i = 0; i < strlen(str); i++)
		[a add: (void*)(str + i)];
	[a add: ""];

	if (!strcmp([a data], str))
		puts("Built string matches!");
	else {
		puts("Built string does not match!");
		abort();
	}

	[a free];

	return 0;
}