ObjFW  Diff

Differences From Artifact [2602b81521]:

To Artifact [65c18fe8c4]:


279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301


302
303
304
305
306
307
308


309
310
311
312
313
314
315
	    isEqual: @"/tmp"] &&
	    [[@"foo/bar" stringByDeletingLastPathComponent] isEqual: @"foo"] &&
	    [[@"/" stringByDeletingLastPathComponent] isEqual: @"/"] &&
	    [[@"foo" stringByDeletingLastPathComponent] isEqual: @"."])

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

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

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



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



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








|
|
|



|
|

|
|





>
>







>
>







279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
	    isEqual: @"/tmp"] &&
	    [[@"foo/bar" stringByDeletingLastPathComponent] isEqual: @"foo"] &&
	    [[@"/" stringByDeletingLastPathComponent] isEqual: @"/"] &&
	    [[@"foo" stringByDeletingLastPathComponent] isEqual: @"."])

	TEST(@"-[decimalValue]",
	    [@"1234" decimalValue] == 1234 &&
	    [@"\r\n+123  " decimalValue] == 123 &&
	    [@"-500\t" decimalValue] == -500 &&
	    [@"\t\t\r\n" decimalValue] == 0)

	TEST(@"-[hexadecimalValue]",
	    [@"123f" hexadecimalValue] == 0x123f &&
	    [@"\t\n0xABcd\r" hexadecimalValue] == 0xABCD &&
	    [@"  xbCDE" hexadecimalValue] == 0xBCDE &&
	    [@"$CdEf" hexadecimalValue] == 0xCDEF &&
	    [@"\rFeh " hexadecimalValue] == 0xFE &&
	    [@"\r\t" hexadecimalValue] == 0)

	EXPECT_EXCEPTION(@"Detect invalid characters in -[decimalValue] #1",
	    OFInvalidFormatException, [@"abc" decimalValue])
	EXPECT_EXCEPTION(@"Detect invalid characters in -[decimalValue] #2",
	    OFInvalidFormatException, [@"0a" decimalValue])
	EXPECT_EXCEPTION(@"Detect invalid characters in -[decimalValue] #3",
			 OFInvalidFormatException, [@"0 1" decimalValue])

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

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