From 903e0be357aacd86d7f27b73cd343e8fc8828b88 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sun, 9 Jan 2011 14:12:54 +0000 Subject: More tests tidy up. --- UnitTests/SPStringAdditionsTest.m | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'UnitTests/SPStringAdditionsTest.m') diff --git a/UnitTests/SPStringAdditionsTest.m b/UnitTests/SPStringAdditionsTest.m index 208381a8..8fce7e07 100644 --- a/UnitTests/SPStringAdditionsTest.m +++ b/UnitTests/SPStringAdditionsTest.m @@ -26,32 +26,35 @@ #import "SPStringAdditionsTest.h" #import "SPStringAdditions.h" -@implementation SPStringAdditionsTest - -- (void)setUp -{ - -} +static const NSString *SPASCIITestString = @"this is a big, crazy test st'ring with som'e random spaces and quot'es"; +static const NSString *SPUTFTestString = @"In der Kürze liegt die Würz"; -- (void)tearDown -{ - -} +@implementation SPStringAdditionsTest +/** + * stringByRemovingCharactersInSet test case. + */ - (void)testStringByRemovingCharactersInSet { - NSCharacterSet *junk = [NSCharacterSet characterSetWithCharactersInString:@"abc',ü"]; + NSString *charsToRemove = @"abc',ü"; + + NSCharacterSet *junk = [NSCharacterSet characterSetWithCharactersInString:charsToRemove]; - NSString *s = @"this is big, crazy st'ring"; - NSString *expect = @"this is ig rzy string"; + NSString *actualUTFString = SPUTFTestString; + NSString *actualASCIIString = SPASCIITestString; - STAssertEqualObjects([s stringByRemovingCharactersInSet:junk], expect, @"stringByRemovingCharactersInSet"); + NSString *expectedUTFString = @"In der Krze liegt die Wrz"; + NSString *expectedASCIIString = @"this is ig rzy test string with some rndom spes nd quotes"; - // Check UTF - s = @"In der Kürze liegt die Würz"; - expect = @"In der Krze liegt die Wrz"; + STAssertEqualObjects([actualASCIIString stringByRemovingCharactersInSet:junk], + expectedASCIIString, + @"The following characters should have been removed %@", + charsToRemove); - STAssertEqualObjects([s stringByRemovingCharactersInSet:junk], expect, @"stringByRemovingCharactersInSet"); + STAssertEqualObjects([actualUTFString stringByRemovingCharactersInSet:junk], + expectedUTFString, + @"The following characters should have been removed %@", + charsToRemove); } @end -- cgit v1.2.3