Last active
May 6, 2016 19:50
-
-
Save kcmoffat/e3eb47bc348632f042618a74dfc02824 to your computer and use it in GitHub Desktop.
Push ID Generator Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <XCTest/XCTest.h> | |
#import <Firebase/Firebase.h> | |
- (void)testGeneratePushId | |
{ | |
Firebase *ref = [[Firebase alloc] initWithUrl:@"INSERT SOME FIREBASE URL HERE"]; | |
NSMutableSet *set = [NSMutableSet set]; | |
NSMutableArray *pushIds = [NSMutableArray array]; | |
for (int i = 0; i < 100000; i++) { | |
NSString *pushId = [ref childByAutoId].key; | |
XCTAssert(![set containsObject:pushId], @"Duplicate key"); | |
XCTAssert(!(i > 0 && !([pushId compare:[pushIds lastObject]] == NSOrderedDescending)),@"Not monotonically increasing"); | |
[set addObject:pushId]; | |
[pushIds addObject:pushId]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment