Permalink
Browse files

Updated tests and removed warning

  • Loading branch information...
1 parent 58844bf commit a612ee3333ea68547a15611ad3b0f1ced47d62a0 @soffes soffes committed Sep 13, 2011
Showing with 39 additions and 20 deletions.
  1. +1 −0 SSToolkit/NSArray+SSToolkitAdditions.m
  2. +14 −4 Tests/ArrayCategoryTest.m
  3. +24 −16 Tests/DictionaryCategoryTest.m
@@ -7,6 +7,7 @@
//
#import "NSArray+SSToolkitAdditions.h"
+#import "NSData+SSToolkitAdditions.h"
@interface NSArray (SSToolkitPrivateAdditions)
- (NSData *)_prehashData;
View
@@ -26,17 +26,27 @@ - (void)testFirstObject {
- (void)testMD5Sum {
NSArray *array1 = [NSArray arrayWithObjects:@"value1", @"value2", @"value3", @"value4", @"value5", nil];
- NSArray *array2 = [NSArray arrayWithObjects:@"value1", @"value2", @"value3", @"value4", @"value5", nil];
+ NSMutableArray *array2 = [NSMutableArray arrayWithObjects:@"value1", @"value2", @"value3", @"value4", nil];
+ [array2 addObject:@"value5"];
- GHAssertEqualObjects([array1 MD5Sum], [array2 MD5Sum], nil);
+ NSString *sum1 = [array1 MD5Sum];
+ NSString *sum2 = [array2 MD5Sum];
+ GHAssertNotNil(sum1, nil);
+ GHAssertNotNil(sum2, nil);
+ GHAssertEqualObjects(sum1, sum2, nil);
}
- (void)testSHA1Sum {
NSArray *array1 = [NSArray arrayWithObjects:@"value1", @"value2", @"value3", @"value4", @"value5", nil];
- NSArray *array2 = [NSArray arrayWithObjects:@"value1", @"value2", @"value3", @"value4", @"value5", nil];
+ NSMutableArray *array2 = [NSMutableArray arrayWithObjects:@"value1", @"value2", @"value3", @"value4", nil];
+ [array2 addObject:@"value5"];
- GHAssertEqualObjects([array1 SHA1Sum], [array2 SHA1Sum], nil);
+ NSString *sum1 = [array1 SHA1Sum];
+ NSString *sum2 = [array2 SHA1Sum];
+ GHAssertNotNil(sum1, nil);
+ GHAssertNotNil(sum2, nil);
+ GHAssertEqualObjects(sum1, sum2, nil);
}
@end
@@ -42,15 +42,19 @@ - (void)testMD5Sum {
@"value5", @"key5",
nil];
- NSDictionary *dictionary2 = [NSDictionary dictionaryWithObjectsAndKeys:
- @"value3", @"key3",
- @"value4", @"key4",
- @"value5", @"key5",
- @"value2", @"key2",
- @"value1", @"key1",
- nil];
+ NSMutableDictionary *dictionary2 = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+ @"value3", @"key3",
+ @"value4", @"key4",
+ @"value5", @"key5",
+ @"value1", @"key1",
+ nil];
+ [dictionary2 setObject:@"value2" forKey:@"key2"];
- GHAssertEqualObjects([dictionary1 MD5Sum], [dictionary2 MD5Sum], nil);
+ NSString *sum1 = [dictionary1 MD5Sum];
+ NSString *sum2 = [dictionary2 MD5Sum];
+ GHAssertNotNil(sum1, nil);
+ GHAssertNotNil(sum2, nil);
+ GHAssertEqualObjects(sum1, sum2, nil);
}
@@ -63,15 +67,19 @@ - (void)testSHA1Sum {
@"value5", @"key5",
nil];
- NSDictionary *dictionary2 = [NSDictionary dictionaryWithObjectsAndKeys:
- @"value3", @"key3",
- @"value4", @"key4",
- @"value5", @"key5",
- @"value2", @"key2",
- @"value1", @"key1",
- nil];
+ NSMutableDictionary *dictionary2 = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+ @"value3", @"key3",
+ @"value4", @"key4",
+ @"value5", @"key5",
+ @"value1", @"key1",
+ nil];
+ [dictionary2 setObject:@"value2" forKey:@"key2"];
- GHAssertEqualObjects([dictionary1 SHA1Sum], [dictionary2 SHA1Sum], nil);
+ NSString *sum1 = [dictionary1 SHA1Sum];
+ NSString *sum2 = [dictionary2 SHA1Sum];
+ GHAssertNotNil(sum1, nil);
+ GHAssertNotNil(sum2, nil);
+ GHAssertEqualObjects(sum1, sum2, nil);
}
@end

0 comments on commit a612ee3

Please sign in to comment.