ObjFW  Diff

Differences From Artifact [0feeee8df5]:

To Artifact [860575542d]:


217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
	    [[a objectAtIndex: i++] isEqual: @"foo"] &&
	    [[a objectAtIndex: i++] isEqual: @"bar"] &&
	    [[a objectAtIndex: i++] isEqual: @""] &&
	    [[a objectAtIndex: i++] isEqual: @"baz"] &&
	    [[a objectAtIndex: i++] isEqual: @""] &&
	    [[a objectAtIndex: i++] isEqual: @""])

	TEST(@"-[decimalValueAsInteger]",
	    [@"1234" decimalValueAsInteger] == 1234 &&
	    [@"-500" decimalValueAsInteger] == -500 &&
	    [@"" decimalValueAsInteger] == 0)

	TEST(@"-[hexadecimalValueAsInteger]",
	    [@"123f" hexadecimalValueAsInteger] == 0x123f &&
	    [@"0xABcd" hexadecimalValueAsInteger] == 0xABCD &&
	    [@"xbCDE" hexadecimalValueAsInteger] == 0xBCDE &&
	    [@"$CdEf" hexadecimalValueAsInteger] == 0xCDEF &&
	    [@"" hexadecimalValueAsInteger] == 0)

	EXPECT_EXCEPTION(@"Detect invalid characters in "
	    @"-[decimalValueAsInteger] #1", OFInvalidEncodingException,
	    [@"abc" decimalValueAsInteger])
	EXPECT_EXCEPTION(@"Detect invalid characters in "
	    @"-[decimalValueAsInteger] #2", OFInvalidEncodingException,
	    [@"0a" decimalValueAsInteger])

	EXPECT_EXCEPTION(@"Detect invalid chars in "
	    @"-[hexadecimalValueAsInteger] #1", OFInvalidEncodingException,
	    [@"0xABCDEFG" hexadecimalValueAsInteger])
	EXPECT_EXCEPTION(@"Detect invalid chars in "
	    @"-[hexadecimalValueAsInteger] #2", OFInvalidEncodingException,
	    [@"0x" hexadecimalValueAsInteger])
	EXPECT_EXCEPTION(@"Detect invalid chars in "
	    @"-[hexadecimalValueAsInteger] #3", OFInvalidEncodingException,
	    [@"$" hexadecimalValueAsInteger])

	EXPECT_EXCEPTION(@"Detect out of range in -[decimalValueAsInteger",
	    OFOutOfRangeException,
	    [@"12345678901234567890123456789012345678901234567890"
	     @"12345678901234567890123456789012345678901234567890"
	    decimalValueAsInteger])

	EXPECT_EXCEPTION(@"Detect out of range in -[hexadecilamValueAsInteger",
	    OFOutOfRangeException,
	    [@"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
	     @"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
	    hexadecimalValueAsInteger])

	TEST(@"-[unicodeString]", (ua = [@"fööbär" unicodeString]) &&
	    !memcmp(ua, ucstr, 7 * sizeof(of_unichar_t)) && R(free(ua)))

	TEST(@"-[MD5Hash]", [[@"asdfoobar" MD5Hash]
	    isEqual: @"184dce2ec49b5422c7cfd8728864db4c"])








|
|
|
|

|
|
|
|
|
|

|
|
<
|
|
<

|
<
|
|
<
|
|
<
|

|



|

|



|







217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237

238
239

240
241

242
243

244
245

246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
	    [[a objectAtIndex: i++] isEqual: @"foo"] &&
	    [[a objectAtIndex: i++] isEqual: @"bar"] &&
	    [[a objectAtIndex: i++] isEqual: @""] &&
	    [[a objectAtIndex: i++] isEqual: @"baz"] &&
	    [[a objectAtIndex: i++] isEqual: @""] &&
	    [[a objectAtIndex: i++] isEqual: @""])

	TEST(@"-[decimalValue]",
	    [@"1234" decimalValue] == 1234 &&
	    [@"-500" decimalValue] == -500 &&
	    [@"" decimalValue] == 0)

	TEST(@"-[hexadecimalValue]",
	    [@"123f" hexadecimalValue] == 0x123f &&
	    [@"0xABcd" hexadecimalValue] == 0xABCD &&
	    [@"xbCDE" hexadecimalValue] == 0xBCDE &&
	    [@"$CdEf" hexadecimalValue] == 0xCDEF &&
	    [@"" hexadecimalValue] == 0)

	EXPECT_EXCEPTION(@"Detect invalid characters in -[decimalValue] #1",
	    OFInvalidEncodingException, [@"abc" decimalValue])

	EXPECT_EXCEPTION(@"Detect invalid characters in -[decimalValue] #2",
	    OFInvalidEncodingException, [@"0a" decimalValue])


	EXPECT_EXCEPTION(@"Detect invalid chars in -[hexadecimalValue] #1",

	    OFInvalidEncodingException, [@"0xABCDEFG" hexadecimalValue])
	EXPECT_EXCEPTION(@"Detect invalid chars in -[hexadecimalValue] #2",

	    OFInvalidEncodingException, [@"0x" hexadecimalValue])
	EXPECT_EXCEPTION(@"Detect invalid chars in -[hexadecimalValue] #3",

	    OFInvalidEncodingException, [@"$" hexadecimalValue])

	EXPECT_EXCEPTION(@"Detect out of range in -[decimalValue]",
	    OFOutOfRangeException,
	    [@"12345678901234567890123456789012345678901234567890"
	     @"12345678901234567890123456789012345678901234567890"
	    decimalValue])

	EXPECT_EXCEPTION(@"Detect out of range in -[hexadecimalValue]",
	    OFOutOfRangeException,
	    [@"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
	     @"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
	    hexadecimalValue])

	TEST(@"-[unicodeString]", (ua = [@"fööbär" unicodeString]) &&
	    !memcmp(ua, ucstr, 7 * sizeof(of_unichar_t)) && R(free(ua)))

	TEST(@"-[MD5Hash]", [[@"asdfoobar" MD5Hash]
	    isEqual: @"184dce2ec49b5422c7cfd8728864db4c"])