From 725df83787f10b0f6ff84c93de260a73577b1844 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Mon, 7 May 2012 16:38:40 +0000 Subject: UUID string test. --- UnitTests/SPStringAdditionsTest.h | 1 + UnitTests/SPStringAdditionsTest.m | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'UnitTests') diff --git a/UnitTests/SPStringAdditionsTest.h b/UnitTests/SPStringAdditionsTest.h index 786df76f..25d418f4 100644 --- a/UnitTests/SPStringAdditionsTest.h +++ b/UnitTests/SPStringAdditionsTest.h @@ -28,5 +28,6 @@ @interface SPStringAdditionsTest : SenTestCase - (void)testStringByRemovingCharactersInSet; +- (void)testStringWithNewUUID; @end diff --git a/UnitTests/SPStringAdditionsTest.m b/UnitTests/SPStringAdditionsTest.m index b0143a0f..0571ff3c 100644 --- a/UnitTests/SPStringAdditionsTest.m +++ b/UnitTests/SPStringAdditionsTest.m @@ -25,9 +25,7 @@ #import "SPStringAdditionsTest.h" #import "SPStringAdditions.h" - -static NSString *SPASCIITestString = @"this is a big, crazy test st'ring with som'e random spaces and quot'es"; -static NSString *SPUTFTestString = @"In der Kürze liegt die Würz"; +#import "RegexKitLite.h" @implementation SPStringAdditionsTest @@ -36,6 +34,9 @@ static NSString *SPUTFTestString = @"In der Kürze liegt die Würz"; */ - (void)testStringByRemovingCharactersInSet { + static NSString *SPASCIITestString = @"this is a big, crazy test st'ring with som'e random spaces and quot'es"; + static NSString *SPUTFTestString = @"In der Kürze liegt die Würz"; + NSString *charsToRemove = @"abc',ü"; NSCharacterSet *junk = [NSCharacterSet characterSetWithCharactersInString:charsToRemove]; @@ -57,4 +58,11 @@ static NSString *SPUTFTestString = @"In der Kürze liegt die Würz"; charsToRemove); } +- (void)testStringWithNewUUID +{ + NSString *uuid = [NSString stringWithNewUUID]; + + STAssertTrue([uuid isMatchedByRegex:@"[A-F0-9]{8}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{12}"], @"UUID %@ doesn't match regex", uuid); +} + @end -- cgit v1.2.3