ObjFW  Diff

Differences From Artifact [1d94987f01]:

To Artifact [92c6e56e71]:

  • File tests/OFDataArray/OFDataArray.m — part of check-in [033054ad75] at 2009-05-29 19:21:57 on branch trunk — A few renames.

    OFExceptions:
    * OFNoMemException to OFOutOfMemoryException.
    * OFMemNotPartOfObjException to OFMemoryNotPartOfObjectException.

    OFObject:
    * -[addItemToMemoryPool:] to -[addMemoryToPool:].
    * -[allocWithSize:] to -[allocMemoryWithSize:].
    * -[allocNItems:withSize] to -[allocMemoryForNItems:withSize:].
    * -[resizeMem:toSize] to -[resizeMemory:toSize:].
    * -[resizeMem:toNItems:withSize:] to
    -[resizeMemoryToNItems:withSize:].
    * -[freeMem] to -[freeMemory:].

    OFString:
    * -[urlencode] to -[urlEncodedString].
    * -[urldecode] to -[urlDecodedString]. (user: js, size: 4332) [annotate] [blame] [check-ins using]


38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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
	puts("Trying to add too much to an array...");			\
	a = [[type alloc] initWithItemSize: 4096];			\
	CATCH_EXCEPTION([a addNItems: SIZE_MAX				\
			  fromCArray: NULL],				\
	    OFOutOfRangeException)					\
									\
	puts("Trying to add something after that error...");		\
	p = [a allocWithSize: 4096];					\
	memset(p, 255, 4096);						\
	[a addItem: p];							\
	if (!memcmp([a lastItem], p, 4096))				\
		puts("[a lastItem] matches with p!");			\
	else {								\
		puts("[a lastItem] does not match p!");			\
		abort();						\
	}								\
	[a freeMem: p];							\
									\
	puts("Adding more data...");					\
	q = [a allocWithSize: 4096];					\
	memset(q, 42, 4096);						\
	[a addItem: q];							\
	if (!memcmp([a lastItem], q, 4096))				\
		puts("[a lastItem] matches with q!");			\
	else {								\
		puts("[a lastItem] does not match q!");			\
		abort();						\
	}								\
	[a freeMem: q];							\
									\
	puts("Adding multiple items at once...");			\
	p = [a allocWithSize: 8192];					\
	memset(p, 64, 8192);						\
	[a addNItems: 2							\
	  fromCArray: p];						\
	if (!memcmp([a lastItem], [a itemAtIndex: [a count] - 2], 4096) && \
	    !memcmp([a itemAtIndex: [a count] - 2], p, 4096))		\
		puts("[a lastItem], [a itemAtIndex: [a count] - 2] "	\
		    "and p match!");					\
	else {								\
		puts("[a lastItem], [a itemAtIndex: [a count] - 2] "	\
		    "and p do not match!");				\
		abort();						\
	}								\
	[a freeMem: p];							\
									\
	i = [a count];							\
	puts("Removing 2 items...");					\
	[a removeNItems: 2];						\
	if ([a count] + 2 != i) {					\
		puts("[a count] + 2 != i!");				\
		abort();						\







|








|


|








|


|












|







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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
	puts("Trying to add too much to an array...");			\
	a = [[type alloc] initWithItemSize: 4096];			\
	CATCH_EXCEPTION([a addNItems: SIZE_MAX				\
			  fromCArray: NULL],				\
	    OFOutOfRangeException)					\
									\
	puts("Trying to add something after that error...");		\
	p = [a allocMemoryWithSize: 4096];				\
	memset(p, 255, 4096);						\
	[a addItem: p];							\
	if (!memcmp([a lastItem], p, 4096))				\
		puts("[a lastItem] matches with p!");			\
	else {								\
		puts("[a lastItem] does not match p!");			\
		abort();						\
	}								\
	[a freeMemory: p];						\
									\
	puts("Adding more data...");					\
	q = [a allocMemoryWithSize: 4096];				\
	memset(q, 42, 4096);						\
	[a addItem: q];							\
	if (!memcmp([a lastItem], q, 4096))				\
		puts("[a lastItem] matches with q!");			\
	else {								\
		puts("[a lastItem] does not match q!");			\
		abort();						\
	}								\
	[a freeMemory: q];						\
									\
	puts("Adding multiple items at once...");			\
	p = [a allocMemoryWithSize: 8192];				\
	memset(p, 64, 8192);						\
	[a addNItems: 2							\
	  fromCArray: p];						\
	if (!memcmp([a lastItem], [a itemAtIndex: [a count] - 2], 4096) && \
	    !memcmp([a itemAtIndex: [a count] - 2], p, 4096))		\
		puts("[a lastItem], [a itemAtIndex: [a count] - 2] "	\
		    "and p match!");					\
	else {								\
		puts("[a lastItem], [a itemAtIndex: [a count] - 2] "	\
		    "and p do not match!");				\
		abort();						\
	}								\
	[a freeMemory: p];						\
									\
	i = [a count];							\
	puts("Removing 2 items...");					\
	[a removeNItems: 2];						\
	if ([a count] + 2 != i) {					\
		puts("[a count] + 2 != i!");				\
		abort();						\