Unit tests and refactoring

This commit is contained in:
Andreas Linde
2013-03-17 21:12:21 +01:00
committed by Stephan Diederich
parent 13f71b6f12
commit 4921ecb690
81 changed files with 4156 additions and 58 deletions

View File

@@ -37,7 +37,6 @@
@implementation BITStoreUpdateManager { @implementation BITStoreUpdateManager {
NSString *_lastStoreVersion;
NSString *_newStoreVersion; NSString *_newStoreVersion;
NSString *_appStoreURL; NSString *_appStoreURL;
NSString *_currentUUID; NSString *_currentUUID;
@@ -88,28 +87,19 @@
_enableStoreUpdateManager = NO; _enableStoreUpdateManager = NO;
_didSetupDidBecomeActiveNotifications = NO; _didSetupDidBecomeActiveNotifications = NO;
_updateAlertShowing = NO; _updateAlertShowing = NO;
_lastStoreVersion = nil;
_newStoreVersion = nil; _newStoreVersion = nil;
_appStoreURL = nil; _appStoreURL = nil;
_currentUUID = [[self executableUUID] copy]; _currentUUID = [[self executableUUID] copy];
_countryCode = nil; _countryCode = nil;
_mainBundle = [NSBundle mainBundle];
_currentLocale = [NSLocale currentLocale];
_userDefaults = [NSUserDefaults standardUserDefaults];
// set defaults // set defaults
self.checkForUpdateOnLaunch = YES; self.checkForUpdateOnLaunch = YES;
self.updateSetting = BITStoreUpdateCheckDaily; self.updateSetting = BITStoreUpdateCheckDaily;
if ([[NSUserDefaults standardUserDefaults] objectForKey:kBITStoreUpdateLastStoreVersion]) {
_lastStoreVersion = [[NSUserDefaults standardUserDefaults] objectForKey:kBITStoreUpdateLastStoreVersion];
}
if ([[NSUserDefaults standardUserDefaults] objectForKey:kBITStoreUpdateDateOfLastCheck]) {
self.lastCheck = [[NSUserDefaults standardUserDefaults] objectForKey:kBITStoreUpdateDateOfLastCheck];
}
if (!_lastCheck) {
self.lastCheck = [NSDate distantPast];
}
if (!BITHockeyBundle()) { if (!BITHockeyBundle()) {
NSLog(@"[HockeySDK] WARNING: %@ is missing, make sure it is added!", BITHOCKEYSDK_BUNDLE); NSLog(@"[HockeySDK] WARNING: %@ is missing, make sure it is added!", BITHOCKEYSDK_BUNDLE);
} }
@@ -126,24 +116,66 @@
#pragma mark - Version #pragma mark - Version
- (NSString *)lastStoreVersion {
NSString *versionString = nil;
if ([self.userDefaults objectForKey:kBITStoreUpdateLastStoreVersion]) {
// get the last saved version string from the app store
versionString = [self.userDefaults objectForKey:kBITStoreUpdateLastStoreVersion];
}
// if there is a UUID saved which doesn't match the current binary UUID
// then there is possibly a newer version in the store
NSString *lastSavedUUID = nil;
if ([self.userDefaults objectForKey:kBITStoreUpdateLastUUID]) {
lastSavedUUID = [self.userDefaults objectForKey:kBITStoreUpdateLastUUID];
if (lastSavedUUID && ![lastSavedUUID isEqualToString:_currentUUID]) {
// the UUIDs don't match, store the new one
[self.userDefaults setObject:_currentUUID forKey:kBITStoreUpdateLastUUID];
if (versionString) {
// a new version has been installed, reset everything
// so we set versionString to nil to simulate that this is the very run
[self.userDefaults removeObjectForKey:kBITStoreUpdateLastStoreVersion];
versionString = nil;
}
[self.userDefaults synchronize];
}
}
return versionString;
}
- (BOOL)hasNewVersion:(NSDictionary *)dictionary { - (BOOL)hasNewVersion:(NSDictionary *)dictionary {
_lastCheckFailed = YES; _lastCheckFailed = YES;
if ( [(NSDictionary *)[dictionary objectForKey:@"results"] count] > 0 ) { NSString *lastStoreVersion = [self lastStoreVersion];
if ([[dictionary objectForKey:@"results"] isKindOfClass:[NSArray class]] &&
[(NSArray *)[dictionary objectForKey:@"results"] count] > 0 ) {
_lastCheckFailed = NO; _lastCheckFailed = NO;
_newStoreVersion = [(NSDictionary *)[[dictionary objectForKey:@"results"] objectAtIndex:0] objectForKey:@"version"]; _newStoreVersion = [(NSDictionary *)[(NSArray *)[dictionary objectForKey:@"results"] objectAtIndex:0] objectForKey:@"version"];
_appStoreURL = [(NSDictionary *)[[dictionary objectForKey:@"results"] objectAtIndex:0] objectForKey:@"trackViewUrl"]; _appStoreURL = [(NSDictionary *)[(NSArray *)[dictionary objectForKey:@"results"] objectAtIndex:0] objectForKey:@"trackViewUrl"];
if (!_newStoreVersion || !_appStoreURL) { if (!_newStoreVersion || !_appStoreURL) {
return NO; return NO;
} else if (!_lastStoreVersion) { } else if (!lastStoreVersion) {
[[NSUserDefaults standardUserDefaults] setObject:_currentUUID forKey:kBITStoreUpdateLastUUID]; // this is the very first time we get a valid response and
[[NSUserDefaults standardUserDefaults] setObject:_newStoreVersion forKey:kBITStoreUpdateLastStoreVersion]; // set the reference of the store result to be equal to the current installed version
[[NSUserDefaults standardUserDefaults] synchronize]; // even though the current installed version could be older than the one in the app store
// but this ensures that we never have false alerts, since the version string in
// iTunes Connect doesn't have to match CFBundleVersion or CFBundleShortVersionString
// and even if it matches it is hard/impossible to 100% determine which one it is,
// since they could change at any time
[self.userDefaults setObject:_currentUUID forKey:kBITStoreUpdateLastUUID];
[self.userDefaults setObject:_newStoreVersion forKey:kBITStoreUpdateLastStoreVersion];
[self.userDefaults synchronize];
return NO; return NO;
} else { } else {
NSComparisonResult comparissonResult = bit_versionCompare(_newStoreVersion, _lastStoreVersion); NSComparisonResult comparissonResult = bit_versionCompare(_newStoreVersion, lastStoreVersion);
if (comparissonResult == NSOrderedDescending) { if (comparissonResult == NSOrderedDescending) {
return YES; return YES;
@@ -157,6 +189,9 @@
return NO; return NO;
} }
#pragma mark - Time
- (BOOL)shouldCheckForUpdates { - (BOOL)shouldCheckForUpdates {
BOOL checkForUpdate = NO; BOOL checkForUpdate = NO;
@@ -188,13 +223,48 @@
} }
#pragma mark - Private
- (BOOL)shouldCancelProcessing {
if (![self isAppStoreEnvironment]) return YES;
if (![self isStoreUpdateManagerEnabled]) return YES;
return NO;
}
- (BOOL)processStoreResponseWithString:(NSString *)responseString {
if (!responseString) return NO;
NSData *data = [responseString dataUsingEncoding:NSUTF8StringEncoding];
NSError *error = nil;
NSDictionary *json = (NSDictionary *)[NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
if (error) {
BITHockeyLog(@"ERROR: Invalid JSON string. %@", [error localizedDescription]);
return NO;
}
// remember that we just checked the server
self.lastCheck = [NSDate date];
self.updateAvailable = [self hasNewVersion:json];
if (_lastCheckFailed) return NO;
if ([self isUpdateAvailable]) {
[self showUpdateAlert];
}
return YES;
}
#pragma mark - Update Check #pragma mark - Update Check
- (void)checkForUpdate { - (void)checkForUpdate {
if (![self isAppStoreEnvironment]) return; if ([self shouldCancelProcessing]) return;
if (![self isStoreUpdateManagerEnabled]) return;
if (self.isCheckInProgress) return; if (self.isCheckInProgress) return;
self.checkInProgress = YES; self.checkInProgress = YES;
// do we need to update? // do we need to update?
@@ -208,11 +278,11 @@
if (self.countryCode) { if (self.countryCode) {
country = [NSString stringWithFormat:@"&country=%@", self.countryCode]; country = [NSString stringWithFormat:@"&country=%@", self.countryCode];
} else { } else {
country = [NSString stringWithFormat:@"&country=%@", [(NSDictionary *)[NSLocale currentLocale] objectForKey: NSLocaleCountryCode]]; country = [NSString stringWithFormat:@"&country=%@", [(NSDictionary *)self.currentLocale objectForKey: NSLocaleCountryCode]];
} }
// TODO: problem with worldwide is timed releases! // TODO: problem with worldwide is timed releases!
NSString *appBundleIdentifier = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"]; NSString *appBundleIdentifier = [self.mainBundle objectForInfoDictionaryKey:@"CFBundleIdentifier"];
NSString *url = [NSString stringWithFormat:@"http://itunes.apple.com/lookup?bundleId=%@%@", NSString *url = [NSString stringWithFormat:@"http://itunes.apple.com/lookup?bundleId=%@%@",
bit_URLEncodedString(appBundleIdentifier), bit_URLEncodedString(appBundleIdentifier),
@@ -237,18 +307,7 @@
return; return;
} }
NSError *error = nil; [self processStoreResponseWithString:responseString];
NSDictionary *json = (NSDictionary *)[NSJSONSerialization JSONObjectWithData:[responseString dataUsingEncoding:NSUTF8StringEncoding] options:kNilOptions error:&error];
// remember that we just checked the server
self.lastCheck = [NSDate date];
self.updateAvailable = [self hasNewVersion:json];
if (_lastCheckFailed) return;
if ([self isUpdateAvailable]) {
[self showUpdateAlert];
}
} }
}]; }];
} }
@@ -256,25 +315,16 @@
// begin the startup process // begin the startup process
- (void)startManager { - (void)startManager {
if (![self isAppStoreEnvironment]) return; if ([self shouldCancelProcessing]) return;
if (![self isStoreUpdateManagerEnabled]) return;
BITHockeyLog(@"INFO: Start UpdateManager"); BITHockeyLog(@"INFO: Start UpdateManager");
// did the user just update the version? if ([self.userDefaults objectForKey:kBITStoreUpdateDateOfLastCheck]) {
NSString *lastStoredUUID = nil; self.lastCheck = [self.userDefaults objectForKey:kBITStoreUpdateDateOfLastCheck];
if ([[NSUserDefaults standardUserDefaults] objectForKey:kBITStoreUpdateLastUUID]) {
lastStoredUUID = [[NSUserDefaults standardUserDefaults] objectForKey:kBITStoreUpdateLastUUID];
if (_lastStoreVersion && lastStoredUUID && ![lastStoredUUID isEqualToString:_currentUUID]) {
// a new version has been installed, reset everything
[[NSUserDefaults standardUserDefaults] removeObjectForKey:kBITStoreUpdateLastStoreVersion];
_lastStoreVersion = nil;
}
} }
if (lastStoredUUID && ![lastStoredUUID isEqualToString:_currentUUID]) { if (!_lastCheck) {
[[NSUserDefaults standardUserDefaults] setObject:_currentUUID forKey:kBITStoreUpdateLastUUID]; self.lastCheck = [NSDate distantPast];
[[NSUserDefaults standardUserDefaults] synchronize];
} }
if ([self isCheckingForUpdateOnLaunch] && [self shouldCheckForUpdates]) { if ([self isCheckingForUpdateOnLaunch] && [self shouldCheckForUpdates]) {
@@ -310,8 +360,8 @@
if (_lastCheck != aLastCheck) { if (_lastCheck != aLastCheck) {
_lastCheck = [aLastCheck copy]; _lastCheck = [aLastCheck copy];
[[NSUserDefaults standardUserDefaults] setObject:self.lastCheck forKey:kBITStoreUpdateDateOfLastCheck]; [self.userDefaults setObject:self.lastCheck forKey:kBITStoreUpdateDateOfLastCheck];
[[NSUserDefaults standardUserDefaults] synchronize]; [self.userDefaults synchronize];
} }
} }
@@ -322,8 +372,8 @@
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
_updateAlertShowing = NO; _updateAlertShowing = NO;
if (buttonIndex == [alertView cancelButtonIndex]) { if (buttonIndex == [alertView cancelButtonIndex]) {
[[NSUserDefaults standardUserDefaults] setObject:self.lastCheck forKey:kBITStoreUpdateDateOfLastCheck]; [self.userDefaults setObject:self.lastCheck forKey:kBITStoreUpdateDateOfLastCheck];
[[NSUserDefaults standardUserDefaults] synchronize]; [self.userDefaults synchronize];
} else if (buttonIndex == [alertView firstOtherButtonIndex]) { } else if (buttonIndex == [alertView firstOtherButtonIndex]) {
// Remind button // Remind button
} else if (buttonIndex == [alertView firstOtherButtonIndex] + 1) { } else if (buttonIndex == [alertView firstOtherButtonIndex] + 1) {

View File

@@ -46,4 +46,13 @@
// used by BITHockeyManager if disable status is changed // used by BITHockeyManager if disable status is changed
@property (nonatomic, getter = isStoreUpdateManagerEnabled) BOOL enableStoreUpdateManager; @property (nonatomic, getter = isStoreUpdateManagerEnabled) BOOL enableStoreUpdateManager;
#pragma mark - For Testing
@property (nonatomic, assign) NSBundle *mainBundle;
@property (nonatomic, assign) NSLocale *currentLocale;
@property (nonatomic, assign) NSUserDefaults *userDefaults;
- (BOOL)hasNewVersion:(NSDictionary *)dictionary;
- (BOOL)processStoreResponseWithString:(NSString *)responseString;
@end @end

View File

@@ -95,15 +95,28 @@
1E5955CF15B71C8600A03429 /* IconGradient.png in Resources */ = {isa = PBXBuildFile; fileRef = 1E5955C415B71C8600A03429 /* IconGradient.png */; }; 1E5955CF15B71C8600A03429 /* IconGradient.png in Resources */ = {isa = PBXBuildFile; fileRef = 1E5955C415B71C8600A03429 /* IconGradient.png */; };
1E5955D015B71C8600A03429 /* IconGradient@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1E5955C515B71C8600A03429 /* IconGradient@2x.png */; }; 1E5955D015B71C8600A03429 /* IconGradient@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1E5955C515B71C8600A03429 /* IconGradient@2x.png */; };
1E5955FD15B7877B00A03429 /* BITHockeyManagerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E5955FA15B7877A00A03429 /* BITHockeyManagerDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1E5955FD15B7877B00A03429 /* BITHockeyManagerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E5955FA15B7877A00A03429 /* BITHockeyManagerDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
1E5A459216F0DFC200B55C04 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1E5A459116F0DFC200B55C04 /* SenTestingKit.framework */; };
1E5A459416F0DFC200B55C04 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1E5A459316F0DFC200B55C04 /* UIKit.framework */; };
1E5A459516F0DFC200B55C04 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E400561D148D79B500EB22B9 /* Foundation.framework */; };
1E5A459B16F0DFC200B55C04 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1E5A459916F0DFC200B55C04 /* InfoPlist.strings */; };
1E5A459E16F0DFC200B55C04 /* BITStoreUpdateManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E5A459D16F0DFC200B55C04 /* BITStoreUpdateManagerTests.m */; };
1E754E5C1621FBB70070AB92 /* BITCrashManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E754E561621FBB70070AB92 /* BITCrashManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1E754E5C1621FBB70070AB92 /* BITCrashManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E754E561621FBB70070AB92 /* BITCrashManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
1E754E5D1621FBB70070AB92 /* BITCrashManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E754E571621FBB70070AB92 /* BITCrashManager.m */; }; 1E754E5D1621FBB70070AB92 /* BITCrashManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E754E571621FBB70070AB92 /* BITCrashManager.m */; };
1E754E5E1621FBB70070AB92 /* BITCrashManagerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E754E581621FBB70070AB92 /* BITCrashManagerDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1E754E5E1621FBB70070AB92 /* BITCrashManagerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E754E581621FBB70070AB92 /* BITCrashManagerDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
1E754E5F1621FBB70070AB92 /* BITCrashManagerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E754E591621FBB70070AB92 /* BITCrashManagerPrivate.h */; }; 1E754E5F1621FBB70070AB92 /* BITCrashManagerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E754E591621FBB70070AB92 /* BITCrashManagerPrivate.h */; };
1E754E601621FBB70070AB92 /* BITCrashReportTextFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E754E5A1621FBB70070AB92 /* BITCrashReportTextFormatter.h */; }; 1E754E601621FBB70070AB92 /* BITCrashReportTextFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E754E5A1621FBB70070AB92 /* BITCrashReportTextFormatter.h */; };
1E754E611621FBB70070AB92 /* BITCrashReportTextFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E754E5B1621FBB70070AB92 /* BITCrashReportTextFormatter.m */; }; 1E754E611621FBB70070AB92 /* BITCrashReportTextFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E754E5B1621FBB70070AB92 /* BITCrashReportTextFormatter.m */; };
1E7A45FC16F54FB5005B08F1 /* OCHamcrestIOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1E7A45FA16F54FB5005B08F1 /* OCHamcrestIOS.framework */; };
1E7A45FD16F54FB5005B08F1 /* OCMockitoIOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1E7A45FB16F54FB5005B08F1 /* OCMockitoIOS.framework */; };
1E94F9E116E91330006570AD /* BITStoreUpdateManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E94F9DF16E91330006570AD /* BITStoreUpdateManager.h */; }; 1E94F9E116E91330006570AD /* BITStoreUpdateManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E94F9DF16E91330006570AD /* BITStoreUpdateManager.h */; };
1E94F9E216E91330006570AD /* BITStoreUpdateManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E94F9E016E91330006570AD /* BITStoreUpdateManager.m */; }; 1E94F9E216E91330006570AD /* BITStoreUpdateManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E94F9E016E91330006570AD /* BITStoreUpdateManager.m */; };
1E94F9E416E9136B006570AD /* BITStoreUpdateManagerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E94F9E316E9136B006570AD /* BITStoreUpdateManagerPrivate.h */; }; 1E94F9E416E9136B006570AD /* BITStoreUpdateManagerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E94F9E316E9136B006570AD /* BITStoreUpdateManagerPrivate.h */; };
1EA1170016F4D32C001C015C /* libHockeySDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1E5954F215B6F24A00A03429 /* libHockeySDK.a */; };
1EA1170116F4D354001C015C /* CrashReporter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E41EB48B148D7C4E0015DEDC /* CrashReporter.framework */; };
1EA1170416F53B49001C015C /* StoreBundleIdentifierUnknown.json in Resources */ = {isa = PBXBuildFile; fileRef = 1EA1170316F53B49001C015C /* StoreBundleIdentifierUnknown.json */; };
1EA1170716F53B91001C015C /* BITTestHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 1EA1170616F53B91001C015C /* BITTestHelper.m */; };
1EA1170916F53E3A001C015C /* StoreBundleIdentifierKnown.json in Resources */ = {isa = PBXBuildFile; fileRef = 1EA1170816F53E3A001C015C /* StoreBundleIdentifierKnown.json */; };
1EA1170C16F54A64001C015C /* HockeySDKResources.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 1E59550A15B6F45800A03429 /* HockeySDKResources.bundle */; };
1EACC97B162F041E007578C5 /* BITAttributedLabel.h in Headers */ = {isa = PBXBuildFile; fileRef = 1EACC979162F041E007578C5 /* BITAttributedLabel.h */; }; 1EACC97B162F041E007578C5 /* BITAttributedLabel.h in Headers */ = {isa = PBXBuildFile; fileRef = 1EACC979162F041E007578C5 /* BITAttributedLabel.h */; };
1EACC97C162F041E007578C5 /* BITAttributedLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 1EACC97A162F041E007578C5 /* BITAttributedLabel.m */; }; 1EACC97C162F041E007578C5 /* BITAttributedLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 1EACC97A162F041E007578C5 /* BITAttributedLabel.m */; };
1EAF20A8162DC0F600957B1D /* feedbackActivity@2x~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 1EAF20A4162DC0F600957B1D /* feedbackActivity@2x~ipad.png */; }; 1EAF20A8162DC0F600957B1D /* feedbackActivity@2x~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 1EAF20A4162DC0F600957B1D /* feedbackActivity@2x~ipad.png */; };
@@ -132,6 +145,20 @@
remoteGlobalIDString = 1E8E66AD15BC3D7700632A2E; remoteGlobalIDString = 1E8E66AD15BC3D7700632A2E;
remoteInfo = "HockeySDK Documentation"; remoteInfo = "HockeySDK Documentation";
}; };
1EA116FE16F4D302001C015C /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = E4005611148D79B500EB22B9 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 1E5954CB15B6F24A00A03429;
remoteInfo = HockeySDK;
};
1EA1170A16F54A5C001C015C /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = E4005611148D79B500EB22B9 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 1E59550915B6F45800A03429;
remoteInfo = HockeySDKResources;
};
/* End PBXContainerItemProxy section */ /* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
@@ -203,6 +230,13 @@
1E5955C415B71C8600A03429 /* IconGradient.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = IconGradient.png; sourceTree = "<group>"; }; 1E5955C415B71C8600A03429 /* IconGradient.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = IconGradient.png; sourceTree = "<group>"; };
1E5955C515B71C8600A03429 /* IconGradient@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "IconGradient@2x.png"; sourceTree = "<group>"; }; 1E5955C515B71C8600A03429 /* IconGradient@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "IconGradient@2x.png"; sourceTree = "<group>"; };
1E5955FA15B7877A00A03429 /* BITHockeyManagerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITHockeyManagerDelegate.h; sourceTree = "<group>"; }; 1E5955FA15B7877A00A03429 /* BITHockeyManagerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITHockeyManagerDelegate.h; sourceTree = "<group>"; };
1E5A459016F0DFC200B55C04 /* HockeySDKTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HockeySDKTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
1E5A459116F0DFC200B55C04 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
1E5A459316F0DFC200B55C04 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
1E5A459816F0DFC200B55C04 /* HockeySDKTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "HockeySDKTests-Info.plist"; sourceTree = "<group>"; };
1E5A459A16F0DFC200B55C04 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1E5A459D16F0DFC200B55C04 /* BITStoreUpdateManagerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BITStoreUpdateManagerTests.m; sourceTree = "<group>"; };
1E5A459F16F0DFC200B55C04 /* HockeySDKTests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "HockeySDKTests-Prefix.pch"; sourceTree = "<group>"; };
1E66CA9115D4100500F35BED /* buildnumber.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = buildnumber.xcconfig; sourceTree = "<group>"; }; 1E66CA9115D4100500F35BED /* buildnumber.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = buildnumber.xcconfig; sourceTree = "<group>"; };
1E6DDCEE169E290C0076C65D /* ro */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ro; path = ro.lproj/HockeySDK.strings; sourceTree = "<group>"; }; 1E6DDCEE169E290C0076C65D /* ro */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ro; path = ro.lproj/HockeySDK.strings; sourceTree = "<group>"; };
1E6F0450167B5E5600ED1C86 /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-PT"; path = "pt-PT.lproj/HockeySDK.strings"; sourceTree = "<group>"; }; 1E6F0450167B5E5600ED1C86 /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-PT"; path = "pt-PT.lproj/HockeySDK.strings"; sourceTree = "<group>"; };
@@ -214,9 +248,15 @@
1E754E591621FBB70070AB92 /* BITCrashManagerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITCrashManagerPrivate.h; sourceTree = "<group>"; }; 1E754E591621FBB70070AB92 /* BITCrashManagerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITCrashManagerPrivate.h; sourceTree = "<group>"; };
1E754E5A1621FBB70070AB92 /* BITCrashReportTextFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITCrashReportTextFormatter.h; sourceTree = "<group>"; }; 1E754E5A1621FBB70070AB92 /* BITCrashReportTextFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITCrashReportTextFormatter.h; sourceTree = "<group>"; };
1E754E5B1621FBB70070AB92 /* BITCrashReportTextFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BITCrashReportTextFormatter.m; sourceTree = "<group>"; }; 1E754E5B1621FBB70070AB92 /* BITCrashReportTextFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BITCrashReportTextFormatter.m; sourceTree = "<group>"; };
1E7A45FA16F54FB5005B08F1 /* OCHamcrestIOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = OCHamcrestIOS.framework; sourceTree = "<group>"; };
1E7A45FB16F54FB5005B08F1 /* OCMockitoIOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = OCMockitoIOS.framework; sourceTree = "<group>"; };
1E94F9DF16E91330006570AD /* BITStoreUpdateManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITStoreUpdateManager.h; sourceTree = "<group>"; }; 1E94F9DF16E91330006570AD /* BITStoreUpdateManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITStoreUpdateManager.h; sourceTree = "<group>"; };
1E94F9E016E91330006570AD /* BITStoreUpdateManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BITStoreUpdateManager.m; sourceTree = "<group>"; }; 1E94F9E016E91330006570AD /* BITStoreUpdateManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BITStoreUpdateManager.m; sourceTree = "<group>"; };
1E94F9E316E9136B006570AD /* BITStoreUpdateManagerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITStoreUpdateManagerPrivate.h; sourceTree = "<group>"; }; 1E94F9E316E9136B006570AD /* BITStoreUpdateManagerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITStoreUpdateManagerPrivate.h; sourceTree = "<group>"; };
1EA1170316F53B49001C015C /* StoreBundleIdentifierUnknown.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = StoreBundleIdentifierUnknown.json; sourceTree = "<group>"; };
1EA1170516F53B91001C015C /* BITTestHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITTestHelper.h; sourceTree = "<group>"; };
1EA1170616F53B91001C015C /* BITTestHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BITTestHelper.m; sourceTree = "<group>"; };
1EA1170816F53E3A001C015C /* StoreBundleIdentifierKnown.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = StoreBundleIdentifierKnown.json; sourceTree = "<group>"; };
1EA512DF167F7EF000FC9FBA /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/HockeySDK.strings"; sourceTree = "<group>"; }; 1EA512DF167F7EF000FC9FBA /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/HockeySDK.strings"; sourceTree = "<group>"; };
1EACC979162F041E007578C5 /* BITAttributedLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITAttributedLabel.h; sourceTree = "<group>"; }; 1EACC979162F041E007578C5 /* BITAttributedLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITAttributedLabel.h; sourceTree = "<group>"; };
1EACC97A162F041E007578C5 /* BITAttributedLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = BITAttributedLabel.m; sourceTree = "<group>"; }; 1EACC97A162F041E007578C5 /* BITAttributedLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = BITAttributedLabel.m; sourceTree = "<group>"; };
@@ -254,6 +294,20 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
1E5A458C16F0DFC200B55C04 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1EA1170016F4D32C001C015C /* libHockeySDK.a in Frameworks */,
1E5A459216F0DFC200B55C04 /* SenTestingKit.framework in Frameworks */,
1E5A459416F0DFC200B55C04 /* UIKit.framework in Frameworks */,
1EA1170116F4D354001C015C /* CrashReporter.framework in Frameworks */,
1E5A459516F0DFC200B55C04 /* Foundation.framework in Frameworks */,
1E7A45FC16F54FB5005B08F1 /* OCHamcrestIOS.framework in Frameworks */,
1E7A45FD16F54FB5005B08F1 /* OCMockitoIOS.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
@@ -285,6 +339,30 @@
name = Images; name = Images;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
1E5A459616F0DFC200B55C04 /* HockeySDKTests */ = {
isa = PBXGroup;
children = (
1EA1170216F53B49001C015C /* Fixtures */,
1E5A459716F0DFC200B55C04 /* Supporting Files */,
1E5A459D16F0DFC200B55C04 /* BITStoreUpdateManagerTests.m */,
);
path = HockeySDKTests;
sourceTree = "<group>";
};
1E5A459716F0DFC200B55C04 /* Supporting Files */ = {
isa = PBXGroup;
children = (
1E7A45FA16F54FB5005B08F1 /* OCHamcrestIOS.framework */,
1E7A45FB16F54FB5005B08F1 /* OCMockitoIOS.framework */,
1E5A459816F0DFC200B55C04 /* HockeySDKTests-Info.plist */,
1E5A459916F0DFC200B55C04 /* InfoPlist.strings */,
1E5A459F16F0DFC200B55C04 /* HockeySDKTests-Prefix.pch */,
1EA1170516F53B91001C015C /* BITTestHelper.h */,
1EA1170616F53B91001C015C /* BITTestHelper.m */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
1E66CA8F15D40FF600F35BED /* Support */ = { 1E66CA8F15D40FF600F35BED /* Support */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@@ -382,10 +460,20 @@
name = StoreUpdate; name = StoreUpdate;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
1EA1170216F53B49001C015C /* Fixtures */ = {
isa = PBXGroup;
children = (
1EA1170316F53B49001C015C /* StoreBundleIdentifierUnknown.json */,
1EA1170816F53E3A001C015C /* StoreBundleIdentifierKnown.json */,
);
path = Fixtures;
sourceTree = "<group>";
};
E400560F148D79B500EB22B9 = { E400560F148D79B500EB22B9 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
E41EB489148D7BF90015DEDC /* HockeySDK */, E41EB489148D7BF90015DEDC /* HockeySDK */,
1E5A459616F0DFC200B55C04 /* HockeySDKTests */,
E400561C148D79B500EB22B9 /* Frameworks */, E400561C148D79B500EB22B9 /* Frameworks */,
E4005648148D7A3000EB22B9 /* Resources */, E4005648148D7A3000EB22B9 /* Resources */,
1E66CA8F15D40FF600F35BED /* Support */, 1E66CA8F15D40FF600F35BED /* Support */,
@@ -398,6 +486,7 @@
children = ( children = (
1E5954F215B6F24A00A03429 /* libHockeySDK.a */, 1E5954F215B6F24A00A03429 /* libHockeySDK.a */,
1E59550A15B6F45800A03429 /* HockeySDKResources.bundle */, 1E59550A15B6F45800A03429 /* HockeySDKResources.bundle */,
1E5A459016F0DFC200B55C04 /* HockeySDKTests.octest */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -407,6 +496,8 @@
children = ( children = (
E41EB48B148D7C4E0015DEDC /* CrashReporter.framework */, E41EB48B148D7C4E0015DEDC /* CrashReporter.framework */,
E400561D148D79B500EB22B9 /* Foundation.framework */, E400561D148D79B500EB22B9 /* Foundation.framework */,
1E5A459116F0DFC200B55C04 /* SenTestingKit.framework */,
1E5A459316F0DFC200B55C04 /* UIKit.framework */,
); );
name = Frameworks; name = Frameworks;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -531,6 +622,26 @@
productReference = 1E59550A15B6F45800A03429 /* HockeySDKResources.bundle */; productReference = 1E59550A15B6F45800A03429 /* HockeySDKResources.bundle */;
productType = "com.apple.product-type.bundle"; productType = "com.apple.product-type.bundle";
}; };
1E5A458F16F0DFC200B55C04 /* HockeySDKTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1E5A45A216F0DFC200B55C04 /* Build configuration list for PBXNativeTarget "HockeySDKTests" */;
buildPhases = (
1E5A458B16F0DFC200B55C04 /* Sources */,
1E5A458C16F0DFC200B55C04 /* Frameworks */,
1E5A458D16F0DFC200B55C04 /* Resources */,
1E5A458E16F0DFC200B55C04 /* ShellScript */,
);
buildRules = (
);
dependencies = (
1EA1170B16F54A5C001C015C /* PBXTargetDependency */,
1EA116FF16F4D302001C015C /* PBXTargetDependency */,
);
name = HockeySDKTests;
productName = HockeySDKTests;
productReference = 1E5A459016F0DFC200B55C04 /* HockeySDKTests.octest */;
productType = "com.apple.product-type.bundle";
};
/* End PBXNativeTarget section */ /* End PBXNativeTarget section */
/* Begin PBXProject section */ /* Begin PBXProject section */
@@ -571,6 +682,7 @@
1E59550915B6F45800A03429 /* HockeySDKResources */, 1E59550915B6F45800A03429 /* HockeySDKResources */,
1E8E66AD15BC3D7700632A2E /* HockeySDK Documentation */, 1E8E66AD15BC3D7700632A2E /* HockeySDK Documentation */,
1E4F61E91621AD970033EFC5 /* HockeySDK Framework */, 1E4F61E91621AD970033EFC5 /* HockeySDK Framework */,
1E5A458F16F0DFC200B55C04 /* HockeySDKTests */,
); );
}; };
/* End PBXProject section */ /* End PBXProject section */
@@ -605,6 +717,17 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
1E5A458D16F0DFC200B55C04 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1EA1170C16F54A64001C015C /* HockeySDKResources.bundle in Resources */,
1E5A459B16F0DFC200B55C04 /* InfoPlist.strings in Resources */,
1EA1170416F53B49001C015C /* StoreBundleIdentifierUnknown.json in Resources */,
1EA1170916F53E3A001C015C /* StoreBundleIdentifierKnown.json in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */ /* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */
@@ -622,6 +745,19 @@
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "# Sets the target folders and the final framework product.\nFMK_NAME=HockeySDK\nFMK_VERSION=A\nFMK_RESOURCE_BUNDLE=HockeySDKResources\n\n# Documentation\nHOCKEYSDK_DOCSET_VERSION_NAME=\"de.bitstadium.${HOCKEYSDK_DOCSET_NAME}-${VERSION_STRING}\"\n\n# Install dir will be the final output to the framework.\n# The following line create it in the root folder of the current project.\nPRODUCTS_DIR=${SRCROOT}/../Products\nTEMP_DIR=${PRODUCTS_DIR}/Temp\nINSTALL_DIR=${TEMP_DIR}/${FMK_NAME}.framework\n\n# Working dir will be deleted after the framework creation.\nWRK_DIR=build\nDEVICE_DIR=${WRK_DIR}/Release-iphoneos\nSIMULATOR_DIR=${WRK_DIR}/Release-iphonesimulator\nHEADERS_DIR=${WRK_DIR}/Release-iphoneos/usr/local/include\n\n# Building both architectures.\nxcodebuild -project \"HockeySDK.xcodeproj\" -configuration \"Release\" -target \"${FMK_NAME}\" -sdk iphoneos\nxcodebuild -project \"HockeySDK.xcodeproj\" -configuration \"Release\" -target \"${FMK_NAME}\" -sdk iphonesimulator\n\n# Cleaning the oldest.\nif [ -d \"${TEMP_DIR}\" ]\nthen\nrm -rf \"${TEMP_DIR}\"\nfi\n\n# Creates and renews the final product folder.\nmkdir -p \"${INSTALL_DIR}\"\nmkdir -p \"${INSTALL_DIR}/Versions\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers\"\n\n# Creates the internal links.\n# It MUST uses relative path, otherwise will not work when the folder is copied/moved.\nln -s \"${FMK_VERSION}\" \"${INSTALL_DIR}/Versions/Current\"\nln -s \"Versions/Current/Headers\" \"${INSTALL_DIR}/Headers\"\nln -s \"Versions/Current/Resources\" \"${INSTALL_DIR}/Resources\"\nln -s \"Versions/Current/${FMK_NAME}\" \"${INSTALL_DIR}/${FMK_NAME}\"\n\n# Copies the headers and resources files to the final product folder.\ncp -R \"${SRCROOT}/build/Release-iphoneos/include/HockeySDK/\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${DEVICE_DIR}/${FMK_RESOURCE_BUNDLE}.bundle\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources/\"\ncp -f \"${SRCROOT}/${FMK_NAME}.xcconfig\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources/\"\n\n# Uses the Lipo Tool to merge both binary files (i386 + armv6/armv7) into one Universal final product.\nlipo -create \"${DEVICE_DIR}/lib${FMK_NAME}.a\" \"${SIMULATOR_DIR}/lib${FMK_NAME}.a\" -output \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\"\n\n# Combine the CrashReporter static library into a new Hockey static library file if they are not already present and copy the public headers too\nif [ -z $(otool -L \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" | grep 'libCrashReporter') ]\nthen\nlibtool -static -o \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" \"${SRCROOT}/../Vendor/CrashReporter.framework/Versions/A/CrashReporter\"\nfi\n\nrm -r \"${WRK_DIR}\"\n\n# build embeddedframework folder and move framework into it\nmkdir \"${INSTALL_DIR}/../${FMK_NAME}.embeddedframework\"\nmv \"${INSTALL_DIR}\" \"${INSTALL_DIR}/../${FMK_NAME}.embeddedframework/${FMK_NAME}.framework\"\n\n# link Resources\nNEW_INSTALL_DIR=${TEMP_DIR}/${FMK_NAME}.embeddedframework\nmkdir \"${NEW_INSTALL_DIR}/Resources\"\nln -s \"../${FMK_NAME}.framework/Resources/${FMK_RESOURCE_BUNDLE}.bundle\" \"${NEW_INSTALL_DIR}/Resources/${FMK_RESOURCE_BUNDLE}.bundle\"\nln -s \"../${FMK_NAME}.framework/Resources/${FMK_NAME}.xcconfig\" \"${NEW_INSTALL_DIR}/Resources/${FMK_NAME}.xcconfig\"\n\n# copy license, changelog, documentation\ncp -f \"${SRCROOT}/../Docs/Changelog-template.md\" \"${TEMP_DIR}/CHANGELOG\"\ncp -f \"${SRCROOT}/../Docs/Guide-Installation-Setup-template.md\" \"${TEMP_DIR}/README.md\"\ncp -f \"${SRCROOT}/../LICENSE\" \"${TEMP_DIR}\"\nmkdir \"${TEMP_DIR}/${HOCKEYSDK_DOCSET_VERSION_NAME}.docset\"\ncp -R \"${SRCROOT}/../documentation/docset/Contents\" \"${TEMP_DIR}/${HOCKEYSDK_DOCSET_VERSION_NAME}.docset\"\n\n# build zip\ncd \"${PRODUCTS_DIR}\"\nrm -f \"${FMK_NAME}-iOS-${VERSION_STRING}.zip\"\ncd \"${TEMP_DIR}\"\nzip -yr \"../${FMK_NAME}-iOS-${VERSION_STRING}.zip\" \"./${FMK_NAME}.embeddedframework\" \"./CHANGELOG\" \"./README.md\" \"./LICENSE\" \"./${HOCKEYSDK_DOCSET_VERSION_NAME}.docset\" -x \\*/.*\n\n#copy to output dir on cisimple\nif [ $CISIMPLE ]; then\n if [ ! -d \"${CONFIGURATION_BUILD_DIR}\" ]; then\n mkdir \"${CONFIGURATION_BUILD_DIR}\"\n fi\n cd \"${PRODUCTS_DIR}\"\n cp \"${FMK_NAME}-iOS-${VERSION_STRING}.zip\" \"${CONFIGURATION_BUILD_DIR}/${FMK_NAME}-iOS-${VERSION_STRING}.zip\"\nfi"; shellScript = "# Sets the target folders and the final framework product.\nFMK_NAME=HockeySDK\nFMK_VERSION=A\nFMK_RESOURCE_BUNDLE=HockeySDKResources\n\n# Documentation\nHOCKEYSDK_DOCSET_VERSION_NAME=\"de.bitstadium.${HOCKEYSDK_DOCSET_NAME}-${VERSION_STRING}\"\n\n# Install dir will be the final output to the framework.\n# The following line create it in the root folder of the current project.\nPRODUCTS_DIR=${SRCROOT}/../Products\nTEMP_DIR=${PRODUCTS_DIR}/Temp\nINSTALL_DIR=${TEMP_DIR}/${FMK_NAME}.framework\n\n# Working dir will be deleted after the framework creation.\nWRK_DIR=build\nDEVICE_DIR=${WRK_DIR}/Release-iphoneos\nSIMULATOR_DIR=${WRK_DIR}/Release-iphonesimulator\nHEADERS_DIR=${WRK_DIR}/Release-iphoneos/usr/local/include\n\n# Building both architectures.\nxcodebuild -project \"HockeySDK.xcodeproj\" -configuration \"Release\" -target \"${FMK_NAME}\" -sdk iphoneos\nxcodebuild -project \"HockeySDK.xcodeproj\" -configuration \"Release\" -target \"${FMK_NAME}\" -sdk iphonesimulator\n\n# Cleaning the oldest.\nif [ -d \"${TEMP_DIR}\" ]\nthen\nrm -rf \"${TEMP_DIR}\"\nfi\n\n# Creates and renews the final product folder.\nmkdir -p \"${INSTALL_DIR}\"\nmkdir -p \"${INSTALL_DIR}/Versions\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers\"\n\n# Creates the internal links.\n# It MUST uses relative path, otherwise will not work when the folder is copied/moved.\nln -s \"${FMK_VERSION}\" \"${INSTALL_DIR}/Versions/Current\"\nln -s \"Versions/Current/Headers\" \"${INSTALL_DIR}/Headers\"\nln -s \"Versions/Current/Resources\" \"${INSTALL_DIR}/Resources\"\nln -s \"Versions/Current/${FMK_NAME}\" \"${INSTALL_DIR}/${FMK_NAME}\"\n\n# Copies the headers and resources files to the final product folder.\ncp -R \"${SRCROOT}/build/Release-iphoneos/include/HockeySDK/\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${DEVICE_DIR}/${FMK_RESOURCE_BUNDLE}.bundle\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources/\"\ncp -f \"${SRCROOT}/${FMK_NAME}.xcconfig\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources/\"\n\n# Uses the Lipo Tool to merge both binary files (i386 + armv6/armv7) into one Universal final product.\nlipo -create \"${DEVICE_DIR}/lib${FMK_NAME}.a\" \"${SIMULATOR_DIR}/lib${FMK_NAME}.a\" -output \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\"\n\n# Combine the CrashReporter static library into a new Hockey static library file if they are not already present and copy the public headers too\nif [ -z $(otool -L \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" | grep 'libCrashReporter') ]\nthen\nlibtool -static -o \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" \"${SRCROOT}/../Vendor/CrashReporter.framework/Versions/A/CrashReporter\"\nfi\n\nrm -r \"${WRK_DIR}\"\n\n# build embeddedframework folder and move framework into it\nmkdir \"${INSTALL_DIR}/../${FMK_NAME}.embeddedframework\"\nmv \"${INSTALL_DIR}\" \"${INSTALL_DIR}/../${FMK_NAME}.embeddedframework/${FMK_NAME}.framework\"\n\n# link Resources\nNEW_INSTALL_DIR=${TEMP_DIR}/${FMK_NAME}.embeddedframework\nmkdir \"${NEW_INSTALL_DIR}/Resources\"\nln -s \"../${FMK_NAME}.framework/Resources/${FMK_RESOURCE_BUNDLE}.bundle\" \"${NEW_INSTALL_DIR}/Resources/${FMK_RESOURCE_BUNDLE}.bundle\"\nln -s \"../${FMK_NAME}.framework/Resources/${FMK_NAME}.xcconfig\" \"${NEW_INSTALL_DIR}/Resources/${FMK_NAME}.xcconfig\"\n\n# copy license, changelog, documentation\ncp -f \"${SRCROOT}/../Docs/Changelog-template.md\" \"${TEMP_DIR}/CHANGELOG\"\ncp -f \"${SRCROOT}/../Docs/Guide-Installation-Setup-template.md\" \"${TEMP_DIR}/README.md\"\ncp -f \"${SRCROOT}/../LICENSE\" \"${TEMP_DIR}\"\nmkdir \"${TEMP_DIR}/${HOCKEYSDK_DOCSET_VERSION_NAME}.docset\"\ncp -R \"${SRCROOT}/../documentation/docset/Contents\" \"${TEMP_DIR}/${HOCKEYSDK_DOCSET_VERSION_NAME}.docset\"\n\n# build zip\ncd \"${PRODUCTS_DIR}\"\nrm -f \"${FMK_NAME}-iOS-${VERSION_STRING}.zip\"\ncd \"${TEMP_DIR}\"\nzip -yr \"../${FMK_NAME}-iOS-${VERSION_STRING}.zip\" \"./${FMK_NAME}.embeddedframework\" \"./CHANGELOG\" \"./README.md\" \"./LICENSE\" \"./${HOCKEYSDK_DOCSET_VERSION_NAME}.docset\" -x \\*/.*\n\n#copy to output dir on cisimple\nif [ $CISIMPLE ]; then\n if [ ! -d \"${CONFIGURATION_BUILD_DIR}\" ]; then\n mkdir \"${CONFIGURATION_BUILD_DIR}\"\n fi\n cd \"${PRODUCTS_DIR}\"\n cp \"${FMK_NAME}-iOS-${VERSION_STRING}.zip\" \"${CONFIGURATION_BUILD_DIR}/${FMK_NAME}-iOS-${VERSION_STRING}.zip\"\nfi";
}; };
1E5A458E16F0DFC200B55C04 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n";
};
1E8E66B215BC3D8200632A2E /* ShellScript */ = { 1E8E66B215BC3D8200632A2E /* ShellScript */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@@ -675,6 +811,15 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
1E5A458B16F0DFC200B55C04 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1E5A459E16F0DFC200B55C04 /* BITStoreUpdateManagerTests.m in Sources */,
1EA1170716F53B91001C015C /* BITTestHelper.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */ /* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */ /* Begin PBXTargetDependency section */
@@ -688,6 +833,16 @@
target = 1E8E66AD15BC3D7700632A2E /* HockeySDK Documentation */; target = 1E8E66AD15BC3D7700632A2E /* HockeySDK Documentation */;
targetProxy = 1E754E421621F6290070AB92 /* PBXContainerItemProxy */; targetProxy = 1E754E421621F6290070AB92 /* PBXContainerItemProxy */;
}; };
1EA116FF16F4D302001C015C /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 1E5954CB15B6F24A00A03429 /* HockeySDK */;
targetProxy = 1EA116FE16F4D302001C015C /* PBXContainerItemProxy */;
};
1EA1170B16F54A5C001C015C /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 1E59550915B6F45800A03429 /* HockeySDKResources */;
targetProxy = 1EA1170A16F54A5C001C015C /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */ /* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */ /* Begin PBXVariantGroup section */
@@ -711,6 +866,14 @@
name = HockeySDK.strings; name = HockeySDK.strings;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
1E5A459916F0DFC200B55C04 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
1E5A459A16F0DFC200B55C04 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */ /* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */ /* Begin XCBuildConfiguration section */
@@ -783,6 +946,74 @@
}; };
name = Release; name = Release;
}; };
1E5A45A016F0DFC200B55C04 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
FRAMEWORK_SEARCH_PATHS = (
"\"$(SDKROOT)/Developer/Library/Frameworks\"",
"\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
"\"$(SRCROOT)/../Vendor\"",
"\"$(SRCROOT)/HockeySDKTests\"",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "HockeySDKTests/HockeySDKTests-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_UNINITIALIZED_AUTOS = YES;
INFOPLIST_FILE = "HockeySDKTests/HockeySDKTests-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 6.1;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/HockeySDKTests/OCMock\"",
"\"$(SRCROOT)/HockeySDKTests\"",
);
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = octest;
};
name = Debug;
};
1E5A45A116F0DFC200B55C04 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
FRAMEWORK_SEARCH_PATHS = (
"\"$(SDKROOT)/Developer/Library/Frameworks\"",
"\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
"\"$(SRCROOT)/../Vendor\"",
"\"$(SRCROOT)/HockeySDKTests\"",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "HockeySDKTests/HockeySDKTests-Prefix.pch";
GCC_WARN_UNINITIALIZED_AUTOS = YES;
INFOPLIST_FILE = "HockeySDKTests/HockeySDKTests-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 6.1;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/HockeySDKTests/OCMock\"",
"\"$(SRCROOT)/HockeySDKTests\"",
);
PRODUCT_NAME = "$(TARGET_NAME)";
VALIDATE_PRODUCT = YES;
WRAPPER_EXTENSION = octest;
};
name = Release;
};
1E8E66AE15BC3D7700632A2E /* Debug */ = { 1E8E66AE15BC3D7700632A2E /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
@@ -894,6 +1125,15 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
1E5A45A216F0DFC200B55C04 /* Build configuration list for PBXNativeTarget "HockeySDKTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1E5A45A016F0DFC200B55C04 /* Debug */,
1E5A45A116F0DFC200B55C04 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1E8E66B015BC3D7700632A2E /* Build configuration list for PBXAggregateTarget "HockeySDK Documentation" */ = { 1E8E66B015BC3D7700632A2E /* Build configuration list for PBXAggregateTarget "HockeySDK Documentation" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (

View File

@@ -28,6 +28,16 @@
shouldUseLaunchSchemeArgsEnv = "YES" shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug"> buildConfiguration = "Debug">
<Testables> <Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1E5A458F16F0DFC200B55C04"
BuildableName = "HockeySDKTests.octest"
BlueprintName = "HockeySDKTests"
ReferencedContainer = "container:HockeySDK.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables> </Testables>
</TestAction> </TestAction>
<LaunchAction <LaunchAction

View File

@@ -0,0 +1,182 @@
//
// HockeySDKTests.m
// HockeySDKTests
//
// Created by Andreas Linde on 13.03.13.
//
//
#import <SenTestingKit/SenTestingKit.h>
// Uncomment the next two lines to use OCHamcrest for test assertions:
#define HC_SHORTHAND
#import <OCHamcrestIOS/OCHamcrestIOS.h>
// Uncomment the next two lines to use OCMockito for mock objects:
#define MOCKITO_SHORTHAND
#import <OCMockitoIOS/OCMockitoIOS.h>
#import "BITStoreUpdateManager.h"
#import "BITStoreUpdateManagerPrivate.h"
#import "BITHockeyBaseManager.h"
#import "BITHockeyBaseManagerPrivate.h"
#import "BITTestHelper.h"
@interface BITStoreUpdateManagerTests : SenTestCase
@end
@implementation BITStoreUpdateManagerTests {
BITStoreUpdateManager *_storeUpdateManager;
}
- (void)setUp {
[super setUp];
// Set-up code here.
_storeUpdateManager = [[BITStoreUpdateManager alloc] initWithAppIdentifier:nil isAppStoreEnvironemt:YES];
}
- (void)tearDown {
// Tear-down code here.
_storeUpdateManager = nil;
[super tearDown];
}
#pragma mark - Private
- (NSDictionary *)jsonFromFixture:(NSString *)fixture {
NSString *dataString = [BITTestHelper jsonFixture:fixture];
NSData *data = [dataString dataUsingEncoding:NSUTF8StringEncoding];
NSError *error = nil;
NSDictionary *json = (NSDictionary *)[NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
return json;
}
- (void)startManager {
_storeUpdateManager.enableStoreUpdateManager = YES;
[_storeUpdateManager startManager];
[NSObject cancelPreviousPerformRequestsWithTarget:_storeUpdateManager selector:@selector(checkForUpdate) object:nil];
}
#pragma mark - Time
#pragma mark - JSON Response Processing
- (void)testProcessStoreResponseWithEmptyData {
BOOL result = [_storeUpdateManager processStoreResponseWithString:nil];
STAssertFalse(result, @"Empty data was handled correctly");
}
- (void)testProcessStoreResponseWithInvalidData {
NSString *invalidString = @"8a@c&)if";
BOOL result = [_storeUpdateManager processStoreResponseWithString:invalidString];
STAssertFalse(result, @"Invalid JSON data was handled correctly");
}
- (void)testProcessStoreResponseWithUnknownBundleIdentifier {
NSString *dataString = [BITTestHelper jsonFixture:@"StoreBundleIdentifierUnknown"];
BOOL result = [_storeUpdateManager processStoreResponseWithString:dataString];
STAssertFalse(result, @"Valid but empty json data was handled correctly");
}
- (void)testProcessStoreResponseWithKnownBundleIdentifier {
NSString *dataString = [BITTestHelper jsonFixture:@"StoreBundleIdentifierKnown"];
BOOL result = [_storeUpdateManager processStoreResponseWithString:dataString];
STAssertTrue(result, @"Valid and correct JSON data was handled correctly");
}
#pragma mark - Last version
#pragma mark - Version compare
- (void)testFirstStartHasNewVersionReturnsFalseWithFirstCheck {
NSUserDefaults *mockUserDefaults = mock([NSUserDefaults class]);
_storeUpdateManager.userDefaults = mockUserDefaults;
[self startManager];
NSDictionary *json = [self jsonFromFixture:@"StoreBundleIdentifierKnown"];
BOOL result = [_storeUpdateManager hasNewVersion:json];
STAssertFalse(result, @"There is no udpate available");
}
- (void)testFirstStartHasNewVersionReturnsFalseWithSameVersion {
NSUserDefaults *mockUserDefaults = mock([NSUserDefaults class]);
[given([mockUserDefaults objectForKey:@"BITStoreUpdateLastStoreVersion"]) willReturn:@"4.1.2"];
[given([mockUserDefaults objectForKey:@"BITStoreUpdateLastUUID"]) willReturn:@""];
_storeUpdateManager.userDefaults = mockUserDefaults;
[self startManager];
NSDictionary *json = [self jsonFromFixture:@"StoreBundleIdentifierKnown"];
BOOL result = [_storeUpdateManager hasNewVersion:json];
STAssertFalse(result, @"There is no udpate available");
}
- (void)testFirstStartHasNewVersionReturnsFalseWithSameVersionButDifferentUUID {
NSUserDefaults *mockUserDefaults = mock([NSUserDefaults class]);
[given([mockUserDefaults objectForKey:@"BITStoreUpdateLastStoreVersion"]) willReturn:@"4.1.2"];
[given([mockUserDefaults objectForKey:@"BITStoreUpdateLastUUID"]) willReturn:@"1"];
_storeUpdateManager.userDefaults = mockUserDefaults;
[self startManager];
NSDictionary *json = [self jsonFromFixture:@"StoreBundleIdentifierKnown"];
BOOL result = [_storeUpdateManager hasNewVersion:json];
STAssertFalse(result, @"There is no udpate available");
}
- (void)testFirstStartHasNewVersionReturnsTrue {
NSUserDefaults *mockUserDefaults = mock([NSUserDefaults class]);
[given([mockUserDefaults objectForKey:@"BITStoreUpdateLastStoreVersion"]) willReturn:@"4.1.1"];
[given([mockUserDefaults objectForKey:@"BITStoreUpdateLastUUID"]) willReturn:@""];
_storeUpdateManager.userDefaults = mockUserDefaults;
[self startManager];
NSDictionary *json = [self jsonFromFixture:@"StoreBundleIdentifierKnown"];
BOOL result = [_storeUpdateManager hasNewVersion:json];
STAssertTrue(result, @"There is an udpate available");
}
- (void)testFirstStartHasNewVersionReturnsFalseBecauseWeHaveANewerVersionInstalled {
NSUserDefaults *mockUserDefaults = mock([NSUserDefaults class]);
[given([mockUserDefaults objectForKey:@"BITStoreUpdateLastStoreVersion"]) willReturn:@"4.1.3"];
[given([mockUserDefaults objectForKey:@"BITStoreUpdateLastUUID"]) willReturn:@""];
_storeUpdateManager.userDefaults = mockUserDefaults;
[self startManager];
NSDictionary *json = [self jsonFromFixture:@"StoreBundleIdentifierKnown"];
BOOL result = [_storeUpdateManager hasNewVersion:json];
STAssertFalse(result, @"There is no udpate available");
}
@end

View File

@@ -0,0 +1,6 @@
@interface BITTestHelper : NSObject
+ (id)jsonFixture:(NSString *)fixture;
@end

View File

@@ -0,0 +1,16 @@
#import "BITTestHelper.h"
@implementation BITTestHelper
// loads test fixture from json file
// http://blog.roberthoglund.com/2010/12/ios-unit-testing-loading-bundle.html
+ (NSString *)jsonFixture:(NSString *)fixture {
NSString *path = [[NSBundle bundleForClass:self.class] pathForResource:fixture ofType:@"json"];
NSError *error = nil;
NSString *content = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error];
return content;
}
@end

View File

@@ -0,0 +1,9 @@
{
"resultCount":1,
"results": [
{"kind":"software", "features":["iosUniversal"], "supportedDevices":["all"], "isGameCenterEnabled":false,
"screenshotUrls":["http://a354.phobos.apple.com/us/r1000/111/Purple/v4/7c/8a/ee/7c8aeeaf-5daa-de29-b4da-35ba051c53b4/mzl.iwzvkijg.png", "http://a1774.phobos.apple.com/us/r1000/107/Purple/v4/6a/59/a3/6a59a3ca-0235-b0db-75bd-0eca8fdfbf9b/mzl.opdtqzgj.png", "http://a1627.phobos.apple.com/us/r1000/116/Purple/v4/c3/e6/d9/c3e6d96c-b8d4-872b-bce9-bdf4a35bfe49/mzl.zdmdddyh.png", "http://a1594.phobos.apple.com/us/r1000/073/Purple/v4/e8/18/aa/e818aaa1-9d72-6ff6-823d-4e9d07ae5c65/mzl.qkqmxuhu.png", "http://a349.phobos.apple.com/us/r1000/075/Purple/v4/39/76/d7/3976d725-2ca3-04a3-74ab-f5a991c2b779/mzl.wyygagaj.png"],
"ipadScreenshotUrls":["http://a844.phobos.apple.com/us/r1000/081/Purple/v4/29/90/75/2990756f-e818-6b3e-7d79-1358c83ff2cf/mzl.bwbdcvif.1024x1024-65.jpg", "http://a834.phobos.apple.com/us/r1000/115/Purple/v4/55/a2/e9/55a2e923-61a9-0453-7637-4832de432f74/mzl.zlruoazd.1024x1024-65.jpg", "http://a1757.phobos.apple.com/us/r1000/101/Purple/v4/a5/2a/62/a52a627e-41b4-91b2-9c4d-526d602bf00e/mzl.qekglwsg.1024x1024-65.jpg", "http://a1812.phobos.apple.com/us/r1000/063/Purple/v4/39/80/39/398039db-7184-b623-97b6-988753aea1b0/mzl.scddwowl.1024x1024-65.jpg", "http://a1219.phobos.apple.com/us/r1000/081/Purple/v4/17/76/6b/17766b98-8100-fda3-8263-a88c06d4a6c0/mzl.oauotukf.1024x1024-65.jpg"], "artworkUrl60":"http://a147.phobos.apple.com/us/r1000/095/Purple/v4/e0/44/72/e04472f7-6807-b114-e971-c1d602805298/Icon.png", "artworkUrl512":"http://a1921.phobos.apple.com/us/r1000/118/Purple/v4/2b/d6/85/2bd68583-090f-a513-d3f6-a47ea2175a0c/temp..mkgsmtvp.png", "artistViewUrl":"https://itunes.apple.com/us/artist/andreas-linde/id292957656?uo=4", "artistId":292957656, "artistName":"Andreas Linde", "price":3.99, "version":"4.1.2",
"description":"## Apple Rewind 2011 Germany: Best iPad travel app ##\n\nTravel the world from wherever you are and watch webcams worldwide with an elegant, friendly, and intuitive user interface.\n\nWorldView+ puts the world into your pocket or onto your couch! Watch over 20,000 webcams from all over the world and get additional information for each place such as current weather or Wikipedia articles.\n\nPress Quotes:\n\"Want to check the weather in Covent Garden, or indeed see the pyramids? WorldView opens your eyes.\" - The Times Online\n\"It's an ideal toy for tourists wishing to get a sense of the weather at their destinations, or for armchair travelers stuck in their work cubicles.\" - USA Today Online\n\"If you like webcams, you'll really enjoy WorldView's features and design.\" - TUAW\n\nFeature Overview:\n- Save your favorite webcams and even group them into your own collections\n- iCloud support! Automatically syncs your favorites.\n- Add additional webcams manually\n- View images in fullscreen with the best image quality provided by the webcam\n- WorldView+ automatically updates the image as soon as most webcams provide them\n- Share webcams and images on Twitter, Facebook, and via email\n\nFind webcams:\n- Type in text and search or select any of the suggested locations\n- Search using map, tap and hold on a place to search around a specific spot\n- Watch webcams near your current location\n- Get lucky and view random webcams\n- Browse a list of new, recently viewed, and featured webcams\n- All webcams listed in http://webcams.travel/ are available\n\nMore than just webcams:\n- Current weather information near the webcams location\n- Wikipedia articles around the webcams location\n- View webcam locations on a map\n- View daylight images\n- Get a live video stream when possible\n- See a timelapse video of selected webcams\n- Visit the webcam's website on webcams.travel\n\nAdd more yourself:\n- Easily add webcams not listed in webcams.travel\n\n\nWorldView+ \u2013 browse and discover the world like never before.\n\n\nTechnical info:\n- Manually added webcams support password protection via HTTP basic authorization\n- Supports most webcam types providing images via JPG and PNG and video streams using Motion-JPEG\n- Auto updating images is technically not possible for all webcams, currently supported for more than 9,000\n- Live video streams are available for more than 900 webcams, audio is not supported\n- Timelapse videos are provided by webcams.travel for about 50 webcams as of now\n\n\nIf there are any questions or problems, please visit our support forum at http://support.worldviewmobileapp.com/. This will allow us to help sort out any issues you may be experiencing. Thanks and happy WorldViewing!", "currency":"USD", "genres":["Travel", "Weather"], "genreIds":["6003", "6001"], "releaseDate":"2008-12-04T10:31:45Z", "sellerName":"Andreas Linde", "bundleId":"de.buzzworks.WorldViewLive", "trackId":297063830, "trackName":"WorldView+", "primaryGenreName":"Travel", "primaryGenreId":6003,
"releaseNotes":"- Improvements to iCloud sync\n- Improved swedish & croatian localizations\n- Fix import bookmarks from WorldView by webcams.travel (Requires version 4.1.2 of both apps)\n- Improved handling of corrupted iCloud data. (Can require second app start to fix it)\n- Improved stability\n- Various minor improvements", "formattedPrice":"$3.99", "wrapperType":"software", "trackCensoredName":"WorldView+", "languageCodesISO2A":["SV", "ZH", "DE", "EN", "ES", "FI", "FR", "HR", "JA", "NL", "PL", "PT", "RU"], "fileSizeBytes":"4374716", "sellerUrl":"http://www.worldviewmobileapp.com/", "contentAdvisoryRating":"4+", "averageUserRatingForCurrentVersion":4.5, "userRatingCountForCurrentVersion":4, "artworkUrl100":"http://a1921.phobos.apple.com/us/r1000/118/Purple/v4/2b/d6/85/2bd68583-090f-a513-d3f6-a47ea2175a0c/temp..mkgsmtvp.png", "trackViewUrl":"https://itunes.apple.com/us/app/worldview+/id297063830?mt=8&uo=4", "trackContentRating":"4+", "averageUserRating":3.5, "userRatingCount":569}]
}

View File

@@ -0,0 +1,4 @@
{
"resultCount":0,
"results": []
}

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.hockeyapp.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@@ -0,0 +1,8 @@
//
// Prefix header for all source files of the 'HockeySDKTests' target in the 'HockeySDKTests' project
//
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif

View File

@@ -0,0 +1 @@
Versions/Current/Headers

View File

@@ -0,0 +1 @@
Versions/Current/OCHamcrestIOS

View File

@@ -0,0 +1 @@
Versions/Current/Resources

View File

@@ -0,0 +1,45 @@
//
// OCHamcrest - HCAllOf.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCAllOf : HCBaseMatcher
{
NSArray *matchers;
}
+ (id)allOf:(NSArray *)theMatchers;
- (id)initWithMatchers:(NSArray *)theMatchers;
@end
OBJC_EXPORT id<HCMatcher> HC_allOf(id match, ...) NS_REQUIRES_NIL_TERMINATION;
/**
allOf(firstMatcher, ...) -
Matches if all of the given matchers evaluate to @c YES.
@param firstMatcher,... A comma-separated list of matchers ending with @c nil.
The matchers are evaluated from left to right using short-circuit evaluation, so evaluation
stops as soon as a matcher returns @c NO.
Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_allOf instead.)
@ingroup logical_matchers
*/
#ifdef HC_SHORTHAND
#define allOf HC_allOf
#endif

View File

@@ -0,0 +1,45 @@
//
// OCHamcrest - HCAnyOf.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCAnyOf : HCBaseMatcher
{
NSArray *matchers;
}
+ (id)anyOf:(NSArray *)theMatchers;
- (id)initWithMatchers:(NSArray *)theMatchers;
@end
OBJC_EXPORT id<HCMatcher> HC_anyOf(id match, ...) NS_REQUIRES_NIL_TERMINATION;
/**
anyOf(firstMatcher, ...) -
Matches if any of the given matchers evaluate to @c YES.
@param firstMatcher,... A comma-separated list of matchers ending with @c nil.
The matchers are evaluated from left to right using short-circuit evaluation, so evaluation
stops as soon as a matcher returns @c YES.
Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_anyOf instead.)
@ingroup logical_matchers
*/
#ifdef HC_SHORTHAND
#define anyOf HC_anyOf
#endif

View File

@@ -0,0 +1,42 @@
//
// OCHamcrest - HCAssertThat.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <objc/objc-api.h>
@protocol HCMatcher;
OBJC_EXPORT void HC_assertThatWithLocation(id testCase, id actual, id<HCMatcher> matcher,
const char *fileName, int lineNumber);
#define HC_assertThat(actual, matcher) \
HC_assertThatWithLocation(self, actual, matcher, __FILE__, __LINE__)
/**
assertThat(actual, matcher) -
Asserts that actual value satisfies matcher.
@param actual The object to evaluate as the actual value.
@param matcher The matcher to satisfy as the expected condition.
@c assertThat passes the actual value to the matcher for evaluation. If the matcher is not
satisfied, an exception is thrown describing the mismatch.
@c assertThat is designed to integrate well with OCUnit and other unit testing frameworks.
Unmet assertions are reported as test failures. In Xcode, these failures can be clicked to
reveal the line of the assertion.
In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_assertThat instead.
@ingroup integration
*/
#ifdef HC_SHORTHAND
#define assertThat HC_assertThat
#endif

View File

@@ -0,0 +1,33 @@
//
// OCHamcrest - HCBaseDescription.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <Foundation/Foundation.h>
#import <OCHamcrestIOS/HCDescription.h>
/**
Base class for all HCDescription implementations.
@ingroup core
*/
@interface HCBaseDescription : NSObject <HCDescription>
@end
/**
Methods that must be provided by subclasses of HCBaseDescription.
*/
@interface HCBaseDescription (SubclassMustImplement)
/**
Append the string @a str to the description.
*/
- (void)append:(NSString *)str;
@end

View File

@@ -0,0 +1,27 @@
//
// OCHamcrest - HCBaseMatcher.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <Foundation/Foundation.h>
#import <OCHamcrestIOS/HCMatcher.h>
#import <objc/objc-api.h> // Convenience header, to provide OBJC_EXPORT
/**
Base class for all HCMatcher implementations.
Most implementations can just implement @c -matches: and let
<code>-matches:describingMismatchTo:</code> call it. But if it makes more sense to generate the
mismatch description during the matching, override <code>-matches:describingMismatchTo:</code>
and have @c -matches: call it with a @c nil description.
@ingroup core
*/
@interface HCBaseMatcher : NSObject <HCMatcher>
@end

View File

@@ -0,0 +1,93 @@
//
// OCHamcrest - HCBoxNumber.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#ifdef __cplusplus
namespace hamcrest {
/**
Boxes a scalar value in an NSNumber, specialized per type.
@b Deprecated
@ingroup number_matchers
*/
template <typename T>
inline
NSNumber *boxNumber(T value) __attribute__((deprecated));
{ return nil; }
template <>
inline
NSNumber *boxNumber(BOOL value)
{ return [NSNumber numberWithBool:value]; }
template <>
inline
NSNumber *boxNumber(char value)
{ return [NSNumber numberWithChar:value]; }
template <>
inline
NSNumber *boxNumber(double value)
{ return [NSNumber numberWithDouble:value]; }
template <>
inline
NSNumber *boxNumber(float value)
{ return [NSNumber numberWithFloat:value]; }
template <>
inline
NSNumber *boxNumber(int value)
{ return [NSNumber numberWithInt:value]; }
template <>
inline
NSNumber *boxNumber(long value)
{ return [NSNumber numberWithLong:value]; }
template <>
inline
NSNumber *boxNumber(long long value)
{ return [NSNumber numberWithLongLong:value]; }
template <>
inline
NSNumber *boxNumber(short value)
{ return [NSNumber numberWithShort:value]; }
template <>
inline
NSNumber *boxNumber(unsigned char value)
{ return [NSNumber numberWithUnsignedChar:value]; }
template <>
inline
NSNumber *boxNumber(unsigned int value)
{ return [NSNumber numberWithUnsignedInt:value]; }
template <>
inline
NSNumber *boxNumber(unsigned long value)
{ return [NSNumber numberWithUnsignedLong:value]; }
template <>
inline
NSNumber *boxNumber(unsigned long long value)
{ return [NSNumber numberWithUnsignedLongLong:value]; }
template <>
inline
NSNumber *boxNumber(unsigned short value)
{ return [NSNumber numberWithUnsignedShort:value]; }
} // namespace hamcrest
#endif // __cplusplus

View File

@@ -0,0 +1,23 @@
//
// OCHamcrest - HCCollectMatchers.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <Foundation/Foundation.h>
#import <objc/objc-api.h>
#import <stdarg.h>
@protocol HCMatcher;
/**
Returns an array of matchers from a variable-length comma-separated list terminated by @c nil.
@ingroup helpers
*/
OBJC_EXPORT NSMutableArray *HCCollectMatchers(id item1, va_list args);

View File

@@ -0,0 +1,43 @@
//
// OCHamcrest - HCConformsToProtocol.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Todd Farrell
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCConformsToProtocol : HCBaseMatcher
{
Protocol *theProtocol;
}
+ (id)conformsToProtocol:(Protocol *)protocol;
- (id)initWithProtocol:(Protocol *)protocol;
@end
OBJC_EXPORT id<HCMatcher> HC_conformsTo(Protocol *aProtocol);
OBJC_EXPORT id<HCMatcher> HC_conformsToProtocol(Protocol *aProtocol) __attribute__((deprecated));
/**
conformsTo(aProtocol) -
Matches if object conforms to a given protocol.
@param aProtocol The protocol to compare against as the expected protocol.
This matcher checks whether the evaluated object conforms to @a aProtocol.
Example:
@li @ref conformsTo(\@protocol(NSObject))
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_conformsTo instead.)
@ingroup object_matchers
*/
#ifdef HC_SHORTHAND
#define conformsTo HC_conformsTo
#endif

View File

@@ -0,0 +1,50 @@
//
// OCHamcrest - HCDescribedAs.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCDescribedAs : HCBaseMatcher
{
NSString *descriptionTemplate;
id<HCMatcher> matcher;
NSArray *values;
}
+ (id)describedAs:(NSString *)description
forMatcher:(id<HCMatcher>)aMatcher
overValues:(NSArray *)templateValues;
- (id)initWithDescription:(NSString *)description
forMatcher:(id<HCMatcher>)aMatcher
overValues:(NSArray *)templateValues;
@end
OBJC_EXPORT id<HCMatcher> HC_describedAs(NSString *description, id<HCMatcher> matcher, ...) NS_REQUIRES_NIL_TERMINATION;
/**
describedAs(description, matcher, ...) -
Adds custom failure description to a given matcher.
@param description Overrides the matcher's description.
@param matcher,... The matcher to satisfy, followed by a comma-separated list of substitution values ending with @c nil.
The description may contain substitution placeholders \%0, \%1, etc. These will be replaced by
any values that follow the matcher.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_describedAs instead.)
@ingroup decorator_matchers
*/
#ifdef HC_SHORTHAND
#define describedAs HC_describedAs
#endif

View File

@@ -0,0 +1,48 @@
//
// OCHamcrest - HCDescription.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <Foundation/Foundation.h>
/**
A description of an HCMatcher.
An HCMatcher will describe itself to a description which can later be used for reporting.
@ingroup core
*/
@protocol HCDescription
/**
Appends some plain text to the description.
@return @c self, for chaining.
*/
- (id<HCDescription>)appendText:(NSString *)text;
/**
Appends description of given value to @c self.
If the value implements the @ref HCSelfDescribing protocol, then it will be used.
@return @c self, for chaining.
*/
- (id<HCDescription>)appendDescriptionOf:(id)value;
/**
Appends a list of objects to the description.
@return @c self, for chaining.
*/
- (id<HCDescription>)appendList:(NSArray *)values
start:(NSString *)start
separator:(NSString *)separator
end:(NSString *)end;
@end

View File

@@ -0,0 +1,63 @@
//
// OCHamcrest - HCHasCount.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCHasCount : HCBaseMatcher
{
id<HCMatcher> countMatcher;
}
+ (id)hasCount:(id<HCMatcher>)matcher;
- (id)initWithCount:(id<HCMatcher>)matcher;
@end
OBJC_EXPORT id<HCMatcher> HC_hasCount(id<HCMatcher> matcher);
/**
hasCount(aMatcher) -
Matches if object's @c -count satisfies a given matcher.
@param aMatcher The matcher to satisfy.
This matcher invokes @c -count on the evaluated object to get the number of elements it
contains, passing the result to @a aMatcher for evaluation.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_hasCount instead.)
@ingroup collection_matchers
*/
#ifdef HC_SHORTHAND
#define hasCount HC_hasCount
#endif
OBJC_EXPORT id<HCMatcher> HC_hasCountOf(NSUInteger count);
/**
hasCountOf(value) -
Matches if object's @c -count equals a given value.
@param value @c NSUInteger value to compare against as the expected value.
This matcher invokes @c -count on the evaluated object to get the number of elements it
contains, comparing the result to @a value for equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_hasCountOf instead.)
@ingroup collection_matchers
*/
#ifdef HC_SHORTHAND
#define hasCountOf HC_hasCountOf
#endif

View File

@@ -0,0 +1,44 @@
//
// OCHamcrest - HCHasDescription.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCInvocationMatcher.h>
@interface HCHasDescription : HCInvocationMatcher
+ (id)hasDescription:(id<HCMatcher>)descriptionMatcher;
- (id)initWithDescription:(id<HCMatcher>)descriptionMatcher;
@end
OBJC_EXPORT id<HCMatcher> HC_hasDescription(id match);
/**
hasDescription(aMatcher) -
Matches if object's @c -description satisfies a given matcher.
@param aMatcher The matcher to satisfy, or an expected value for @ref equalTo matching.
This matcher invokes @c -description on the evaluated object to get its description, passing the
result to a given matcher for evaluation. If the @a aMatcher argument is not a matcher, it is
implicitly wrapped in an @ref equalTo matcher to check for equality.
Examples:
@li @ref hasDescription(@ref startsWith(\@"foo"))
@li @ref hasDescription(\@"bar")
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_hasDescription instead.)
@ingroup object_matchers
*/
#ifdef HC_SHORTHAND
#define hasDescription HC_hasDescription
#endif

View File

@@ -0,0 +1,49 @@
//
// OCHamcrest - HCHasProperty.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Justin Shacklette
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCHasProperty : HCBaseMatcher
{
NSString *propertyName;
id<HCMatcher> valueMatcher;
}
+ (id)hasProperty:(NSString *)property value:(id<HCMatcher>)aValueMatcher;
- (id)initWithProperty:(NSString *)property value:(id<HCMatcher>)aValueMatcher;
@end
OBJC_EXPORT id<HCMatcher> HC_hasProperty(NSString *name, id valueMatch);
/**
hasProperty(name, valueMatcher) -
Matches if object has a method of a given name whose return value satisfies a given matcher.
@param name The name of a method without arguments that returns an object.
@param valueMatcher The matcher to satisfy for the return value, or an expected value for @ref equalTo matching.
This matcher first checks if the evaluated object has a method with a name matching the given
@c name. If so, it invokes the method and sees if the returned value satisfies @c valueMatcher.
While this matcher is called "hasProperty", it's useful for checking the results of any simple
methods, not just properties.
Examples:
@li @ref hasProperty(\@"firstName", \@"Joe")
@li @ref hasProperty(\@"firstName", startsWith(\@"J"))
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_hasProperty instead.)
@ingroup object_matchers
*/
#ifdef HC_SHORTHAND
#define hasProperty HC_hasProperty
#endif

View File

@@ -0,0 +1,57 @@
//
// OCHamcrest - HCInvocationMatcher.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
/**
Supporting class for matching a feature of an object.
Tests whether the result of passing a given invocation to the value satisfies a given matcher.
@ingroup helpers
*/
@interface HCInvocationMatcher : HCBaseMatcher
{
NSInvocation *invocation;
id<HCMatcher> subMatcher;
BOOL shortMismatchDescription;
}
/**
Determines whether a mismatch will be described in short form.
Default is long form, which describes the object, the name of the invocation, and the
sub-matcher's mismatch diagnosis. Short form only has the sub-matcher's mismatch diagnosis.
*/
@property (nonatomic, assign) BOOL shortMismatchDescription;
/**
Helper method for creating an invocation.
A class is specified only so we can determine the method signature.
*/
+ (NSInvocation *)invocationForSelector:(SEL)selector onClass:(Class)aClass;
/**
Returns an HCInvocationMatcher object initialized with an invocation and a matcher.
*/
- (id)initWithInvocation:(NSInvocation *)anInvocation matching:(id<HCMatcher>)aMatcher;
/**
Invokes stored invocation on given item and returns the result.
*/
- (id)invokeOn:(id)item;
/**
Returns string representation of the invocation's selector.
*/
- (NSString *)stringFromSelector;
@end

View File

@@ -0,0 +1,54 @@
//
// OCHamcrest - HCIs.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCIs : HCBaseMatcher
{
id<HCMatcher> matcher;
}
+ (id)is:(id<HCMatcher>)aMatcher;
- (id)initWithMatcher:(id<HCMatcher>)aMatcher;
@end
OBJC_EXPORT id<HCMatcher> HC_is(id match);
/**
is(aMatcher) -
Decorates another matcher, or provides a shortcut to the frequently used @ref is(equalTo(x)).
@param aMatcher The matcher to satisfy, or an expected value for @ref equalTo matching.
This matcher compares the evaluated object to the given matcher.
If the @a aMatcher argument is a matcher, its behavior is retained, but the test may be more
expressive. For example:
@li <code>@ref assertThatInt(value, equalToInt(5))</code>
@li <code>@ref assertThatInt(value, is(equalToInt(5)))</code>
If the @a aMatcher argument is not a matcher, it is wrapped in an @ref equalTo matcher. This
makes the following statements equivalent:
@li <code>@ref assertThat(cheese, equalTo(smelly))</code>
@li <code>@ref assertThat(cheese, is(equalTo(smelly)))</code>
@li <code>@ref assertThat(cheese, is(smelly))</code>
Choose the style that makes your expression most readable. This will vary depending on context.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_is instead.)
@ingroup decorator_matchers
*/
#ifdef HC_SHORTHAND
#define is HC_is
#endif

View File

@@ -0,0 +1,63 @@
//
// OCHamcrest - HCIsAnything.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCIsAnything : HCBaseMatcher
{
NSString *description;
}
+ (id)isAnything;
+ (id)isAnythingWithDescription:(NSString *)aDescription;
- (id)init;
- (id)initWithDescription:(NSString *)aDescription;
@end
OBJC_EXPORT id<HCMatcher> HC_anything(void);
/**
Matches anything.
This matcher always evaluates to @c YES. Specify this in composite matchers when the value of a
particular element is unimportant.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_anything instead.)
@ingroup logical_matchers
*/
#ifdef HC_SHORTHAND
#define anything() HC_anything()
#endif
OBJC_EXPORT id<HCMatcher> HC_anythingWithDescription(NSString *aDescription);
/**
anythingWithDescription(description) -
Matches anything.
@param description A string used to describe this matcher.
This matcher always evaluates to @c YES. Specify this in collection matchers when the value of a
particular element in a collection is unimportant.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_anything instead.)
@ingroup logical_matchers
*/
#ifdef HC_SHORTHAND
#define anythingWithDescription HC_anythingWithDescription
#endif

View File

@@ -0,0 +1,47 @@
//
// OCHamcrest - HCIsCloseTo.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCIsCloseTo : HCBaseMatcher
{
double value;
double delta;
}
+ (id)isCloseTo:(double)aValue within:(double)aDelta;
- (id)initWithValue:(double)aValue delta:(double)aDelta;
@end
OBJC_EXPORT id<HCMatcher> HC_closeTo(double aValue, double aDelta);
/**
closeTo(aValue, aDelta) -
Matches if object is a number close to a given value, within a given delta.
@param aValue The @c double value to compare against as the expected value.
@param aDelta The @c double maximum delta between the values for which the numbers are considered close.
This matcher invokes @c -doubleValue on the evaluated object to get its value as a @c double.
The result is compared against @a aValue to see if the difference is within a positive @a aDelta.
Example:
@li @ref closeTo(3.0, 0.25)
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_closeTo instead.)
@ingroup number_matchers
*/
#ifdef HC_SHORTHAND
#define closeTo HC_closeTo
#endif

View File

@@ -0,0 +1,69 @@
//
// OCHamcrest - HCIsCollectionContaining.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCIsCollectionContaining : HCBaseMatcher
{
id<HCMatcher> elementMatcher;
}
+ (id)isCollectionContaining:(id<HCMatcher>)anElementMatcher;
- (id)initWithMatcher:(id<HCMatcher>)anElementMatcher;
@end
OBJC_EXPORT id<HCMatcher> HC_hasItem(id itemMatch);
/**
hasItem(aMatcher) -
Matches if any element of collection satisfies a given matcher.
@param aMatcher The matcher to satisfy, or an expected value for @ref equalTo matching.
This matcher iterates the evaluated collection, searching for any element that satisfies a
given matcher. If a matching element is found, @c hasItem is satisfied.
If the @a aMatcher argument is not a matcher, it is implicitly wrapped in an @ref equalTo
matcher to check for equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_hasItem instead.)
@ingroup collection_matchers
*/
#ifdef HC_SHORTHAND
#define hasItem HC_hasItem
#endif
OBJC_EXPORT id<HCMatcher> HC_hasItems(id itemMatch, ...) NS_REQUIRES_NIL_TERMINATION;
/**
hasItems(firstMatcher, ...) -
Matches if all of the given matchers are satisfied by any elements of the collection.
@param firstMatcher,... A comma-separated list of matchers ending with @c nil.
This matcher iterates the given matchers, searching for any elements in the evaluated collection
that satisfy them. If each matcher is satisfied, then @c hasItems is satisfied.
Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c hasItems instead.)
@ingroup collection_matchers
*/
#ifdef HC_SHORTHAND
#define hasItems HC_hasItems
#endif

View File

@@ -0,0 +1,47 @@
//
// OCHamcrest - HCIsCollectionContainingInAnyOrder.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCIsCollectionContainingInAnyOrder : HCBaseMatcher
{
NSMutableArray *matchers;
}
+ (id)isCollectionContainingInAnyOrder:(NSMutableArray *)itemMatchers;
- (id)initWithMatchers:(NSMutableArray *)itemMatchers;
@end
OBJC_EXPORT id<HCMatcher> HC_containsInAnyOrder(id itemMatch, ...) NS_REQUIRES_NIL_TERMINATION;
/**
containsInAnyOrder(firstMatcher, ...) -
Matches if collection's elements, in any order, satisfy a given list of matchers.
@param firstMatcher,... A comma-separated list of matchers ending with @c nil.
This matcher iterates the evaluated collection, seeing if each element satisfies any of the
given matchers. The matchers are tried from left to right, and when a satisfied matcher is
found, it is no longer a candidate for the remaining elements. If a one-to-one correspondence is
established between elements and matchers, @c containsInAnyOrder is satisfied.
Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_containsInAnyOrder instead.)
@ingroup collection_matchers
*/
#ifdef HC_SHORTHAND
#define containsInAnyOrder HC_containsInAnyOrder
#endif

View File

@@ -0,0 +1,45 @@
//
// OCHamcrest - HCIsCollectionContainingInOrder.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCIsCollectionContainingInOrder : HCBaseMatcher
{
NSArray *matchers;
}
+ (id)isCollectionContainingInOrder:(NSArray *)itemMatchers;
- (id)initWithMatchers:(NSArray *)itemMatchers;
@end
OBJC_EXPORT id<HCMatcher> HC_contains(id itemMatch, ...) NS_REQUIRES_NIL_TERMINATION;
/**
contains(firstMatcher, ...) -
Matches if collection's elements satisfy a given list of matchers, in order.
@param firstMatcher,... A comma-separated list of matchers ending with @c nil.
This matcher iterates the evaluated collection and a given list of matchers, seeing if each
element satisfies its corresponding matcher.
Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_contains instead.)
@ingroup collection_matchers
*/
#ifdef HC_SHORTHAND
#define contains HC_contains
#endif

View File

@@ -0,0 +1,52 @@
//
// OCHamcrest - HCIsCollectionOnlyContaining.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCIsCollectionOnlyContaining : HCBaseMatcher
{
id<HCMatcher> matcher;
}
+ (id)isCollectionOnlyContaining:(id<HCMatcher>)aMatcher;
- (id)initWithMatcher:(id<HCMatcher>)aMatcher;
@end
OBJC_EXPORT id<HCMatcher> HC_onlyContains(id itemMatch, ...) NS_REQUIRES_NIL_TERMINATION;
/**
onlyContains(firstMatcher, ...) -
Matches if each element of collection satisfies any of the given matchers.
@param firstMatcher,... A comma-separated list of matchers ending with @c nil.
This matcher iterates the evaluated collection, confirming whether each element satisfies any of
the given matchers.
Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
equality.
Example:
@par
@ref onlyContains(startsWith(@"Jo"), nil)
will match a collection [@"Jon", @"John", @"Johann"].
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_onlyContains instead.)
@ingroup collection_matchers
*/
#ifdef HC_SHORTHAND
#define onlyContains HC_onlyContains
#endif

View File

@@ -0,0 +1,54 @@
//
// OCHamcrest - HCIsDictionaryContaining.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCIsDictionaryContaining : HCBaseMatcher
{
id<HCMatcher> keyMatcher;
id<HCMatcher> valueMatcher;
}
+ (id)isDictionaryContainingKey:(id<HCMatcher>)aKeyMatcher
value:(id<HCMatcher>)aValueMatcher;
- (id)initWithKeyMatcher:(id<HCMatcher>)aKeyMatcher
valueMatcher:(id<HCMatcher>)aValueMatcher;
@end
OBJC_EXPORT id<HCMatcher> HC_hasEntry(id keyMatch, id valueMatch);
/**
hasEntry(keyMatcher, valueMatcher) -
Matches if dictionary contains key-value entry satisfying a given pair of matchers.
@param keyMatcher The matcher to satisfy for the key, or an expected value for @ref equalTo matching.
@param valueMatcher The matcher to satisfy for the value, or an expected value for @ref equalTo matching.
This matcher iterates the evaluated dictionary, searching for any key-value entry that satisfies
@a keyMatcher and @a valueMatcher. If a matching entry is found, @c hasEntry is satisfied.
Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
equality.
Examples:
@li @ref hasEntry(@ref equalTo(@"foo"), equalTo(@"bar"))
@li @ref hasEntry(@"foo", @"bar")
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_hasEntry instead.)
@ingroup collection_matchers
*/
#ifdef HC_SHORTHAND
#define hasEntry HC_hasEntry
#endif

View File

@@ -0,0 +1,53 @@
//
// OCHamcrest - HCIsDictionaryContainingEntries.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCIsDictionaryContainingEntries : HCBaseMatcher
{
NSArray *keys;
NSArray *valueMatchers;
}
+ (id)isDictionaryContainingKeys:(NSArray *)theKeys
valueMatchers:(NSArray *)theValueMatchers;
- (id)initWithKeys:(NSArray *)theKeys
valueMatchers:(NSArray *)theValueMatchers;
@end
OBJC_EXPORT id<HCMatcher> HC_hasEntries(id keysAndValueMatch, ...) NS_REQUIRES_NIL_TERMINATION;
/**
hasEntries(firstKey, valueMatcher, ...) -
Matches if dictionary contains entries satisfying a list of alternating keys and their value
matchers.
@param firstKey A key (not a matcher) to look up.
@param valueMatcher,... The matcher to satisfy for the value, or an expected value for @ref equalTo matching.
Note that the keys must be actual keys, not matchers. Any value argument that is not a matcher
is implicitly wrapped in an @ref equalTo matcher to check for equality. The list must end with
@c nil.
Examples:
@li @ref hasEntries(@"first", equalTo(@"Jon"), @"last", equalTo(@"Reid"), nil)
@li @ref hasEntries(@"first", @"Jon", @"last", @"Reid", nil)
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_hasEntry instead.)
@ingroup collection_matchers
*/
#ifdef HC_SHORTHAND
#define hasEntries HC_hasEntries
#endif

View File

@@ -0,0 +1,49 @@
//
// OCHamcrest - HCIsDictionaryContainingKey.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCIsDictionaryContainingKey : HCBaseMatcher
{
id<HCMatcher> keyMatcher;
}
+ (id)isDictionaryContainingKey:(id<HCMatcher>)theKeyMatcher;
- (id)initWithKeyMatcher:(id<HCMatcher>)theKeyMatcher;
@end
OBJC_EXPORT id<HCMatcher> HC_hasKey(id keyMatch);
/**
hasKey(keyMatcher) -
Matches if dictionary contains an entry whose key satisfies a given matcher.
@param keyMatcher The matcher to satisfy for the key, or an expected value for @ref equalTo matching.
This matcher iterates the evaluated dictionary, searching for any key-value entry whose key
satisfies the given matcher. If a matching entry is found, @c hasKey is satisfied.
Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_hasKey instead.)
Examples:
@li @ref hasEntry(equalTo(@"foo"))
@li @ref hasEntry(@"foo")
@ingroup collection_matchers
*/
#ifdef HC_SHORTHAND
#define hasKey HC_hasKey
#endif

View File

@@ -0,0 +1,49 @@
//
// OCHamcrest - HCIsDictionaryContainingValue.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCIsDictionaryContainingValue : HCBaseMatcher
{
id<HCMatcher> valueMatcher;
}
+ (id)isDictionaryContainingValue:(id<HCMatcher>)theValueMatcher;
- (id)initWithValueMatcher:(id<HCMatcher>)theValueMatcher;
@end
OBJC_EXPORT id<HCMatcher> HC_hasValue(id valueMatch);
/**
hasValue(valueMatcher) -
Matches if dictionary contains an entry whose value satisfies a given matcher.
@param valueMatcher The matcher to satisfy for the value, or an expected value for @ref equalTo matching.
This matcher iterates the evaluated dictionary, searching for any key-value entry whose value
satisfies the given matcher. If a matching entry is found, @c hasValue is satisfied.
Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
equality.
Examples:
@li @ref hasValue(equalTo(@"bar"))
@li @ref hasValue(@"bar")
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_hasValue instead.)
@ingroup collection_matchers
*/
#ifdef HC_SHORTHAND
#define hasValue HC_hasValue
#endif

View File

@@ -0,0 +1,36 @@
//
// OCHamcrest - HCIsEmptyCollection.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCHasCount.h>
@interface HCIsEmptyCollection : HCHasCount
+ (id)isEmptyCollection;
- (id)init;
@end
OBJC_EXPORT id<HCMatcher> HC_empty(void);
/**
Matches empty collection.
This matcher invokes @c -count on the evaluated object to determine if the number of elements it
contains is zero.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_empty instead.)
@ingroup collection_matchers
*/
#ifdef HC_SHORTHAND
#define empty() HC_empty()
#endif

View File

@@ -0,0 +1,44 @@
//
// OCHamcrest - HCIsEqual.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCIsEqual : HCBaseMatcher
{
id object;
}
+ (id)isEqualTo:(id)anObject;
- (id)initEqualTo:(id)anObject;
@end
OBJC_EXPORT id<HCMatcher> HC_equalTo(id object);
/**
equalTo(anObject) -
Matches if object is equal to a given object.
@param anObject The object to compare against as the expected value.
This matcher compares the evaluated object to @a anObject for equality, as determined by the
@c -isEqual: method.
If @a anObject is @c nil, the matcher will successfully match @c nil.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_equalTo instead.)
@ingroup object_matchers
*/
#ifdef HC_SHORTHAND
#define equalTo HC_equalTo
#endif

View File

@@ -0,0 +1,49 @@
//
// OCHamcrest - HCIsEqualIgnoringCase.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCIsEqualIgnoringCase : HCBaseMatcher
{
NSString *string;
}
+ (id)isEqualIgnoringCase:(NSString *)aString;
- (id)initWithString:(NSString *)aString;
@end
OBJC_EXPORT id<HCMatcher> HC_equalToIgnoringCase(NSString *aString);
/**
equalToIgnoringCase(aString) -
Matches if object is a string equal to a given string, ignoring case differences.
@param aString The string to compare against as the expected value. This value must not be @c nil.
This matcher first checks whether the evaluated object is a string. If so, it compares it with
@a aString, ignoring differences of case.
Example:
@par
@ref equalToIgnoringCase(@"hello world")
will match "heLLo WorlD".
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_equalToIgnoringCase instead.)
@ingroup text_matchers
*/
#ifdef HC_SHORTHAND
#define equalToIgnoringCase HC_equalToIgnoringCase
#endif

View File

@@ -0,0 +1,50 @@
//
// OCHamcrest - HCIsEqualIgnoringWhiteSpace.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCIsEqualIgnoringWhiteSpace : HCBaseMatcher
{
NSString *originalString;
NSString *strippedString;
}
+ (id)isEqualIgnoringWhiteSpace:(NSString *)aString;
- (id)initWithString:(NSString *)aString;
@end
OBJC_EXPORT id<HCMatcher> HC_equalToIgnoringWhiteSpace(NSString *aString);
/**
equalToIgnoringWhiteSpace(aString) -
Matches if object is a string equal to a given string, ignoring differences in whitespace.
@param aString The string to compare against as the expected value. This value must not be @c nil.
This matcher first checks whether the evaluated object is a string. If so, it compares it with
@a aString, ignoring differences in runs of whitespace.
Example:
@par
@ref equalToIgnoringWhiteSpace(@"hello world")
will match @verbatim "hello world" @endverbatim
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_equalToIgnoringWhiteSpace instead.)
@ingroup text_matchers
*/
#ifdef HC_SHORTHAND
#define equalToIgnoringWhiteSpace HC_equalToIgnoringWhiteSpace
#endif

View File

@@ -0,0 +1,325 @@
//
// OCHamcrest - HCIsEqualToNumber.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
OBJC_EXPORT id<HCMatcher> HC_equalToBool(BOOL value);
/**
equalToBool(value) -
Matches if object is equal to @c NSNumber created from a @c BOOL.
@param value The @c BOOL value from which to create an @c NSNumber.
This matcher creates an @c NSNumber object from a @c BOOL @a value and compares the evaluated
object to it for equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_equalToBool instead.)
@ingroup primitive_number_matchers
*/
#ifdef HC_SHORTHAND
#define equalToBool HC_equalToBool
#endif
OBJC_EXPORT id<HCMatcher> HC_equalToChar(char value);
/**
equalToChar(value) -
Matches if object is equal to @c NSNumber created from a @c char.
@param value The @c char value from which to create an @c NSNumber.
This matcher creates an @c NSNumber object from a @c char @a value and compares the evaluated
object to it for equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_equalToChar instead.)
@ingroup primitive_number_matchers
*/
#ifdef HC_SHORTHAND
#define equalToChar HC_equalToChar
#endif
OBJC_EXPORT id<HCMatcher> HC_equalToDouble(double value);
/**
equalToDouble(value) -
Matches if object is equal to @c NSNumber created from a @c double.
@param value The @c double value from which to create an @c NSNumber.
This matcher creates an @c NSNumber object from a @c double @a value and compares the evaluated
object to it for equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_equalToDouble instead.)
@ingroup primitive_number_matchers
*/
#ifdef HC_SHORTHAND
#define equalToDouble HC_equalToDouble
#endif
OBJC_EXPORT id<HCMatcher> HC_equalToFloat(float value);
/**
equalToFloat(value) -
Matches if object is equal to @c NSNumber created from a @c float.
@param value The @c float value from which to create an @c NSNumber.
This matcher creates an @c NSNumber object from a @c float @a value and compares the evaluated
object to it for equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_equalToFloat instead.)
@ingroup primitive_number_matchers
*/
#ifdef HC_SHORTHAND
#define equalToFloat HC_equalToFloat
#endif
OBJC_EXPORT id<HCMatcher> HC_equalToInt(int value);
/**
equalToInt(value) -
Matches if object is equal to @c NSNumber created from an @c int.
@param value The @c int value from which to create an @c NSNumber.
This matcher creates an @c NSNumber object from a @c int @a value and compares the evaluated
object to it for equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_equalToInt instead.)
@ingroup primitive_number_matchers
*/
#ifdef HC_SHORTHAND
#define equalToInt HC_equalToInt
#endif
OBJC_EXPORT id<HCMatcher> HC_equalToLong(long value);
/**
equalToLong(value) -
Matches if object is equal to @c NSNumber created from a @c long.
@param value The @c long value from which to create an @c NSNumber.
This matcher creates an @c NSNumber object from a @c long @a value and compares the evaluated
object to it for equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_equalToLong instead.)
@ingroup primitive_number_matchers
*/
#ifdef HC_SHORTHAND
#define equalToLong HC_equalToLong
#endif
OBJC_EXPORT id<HCMatcher> HC_equalToLongLong(long long value);
/**
equalToLongLong(value) -
Matches if object is equal to @c NSNumber created from a <code>long long</code>.
@param value The <code>long long</code> value from which to create an @c NSNumber.
This matcher creates an @c NSNumber object from a <code>long long</code> @a value and compares
the evaluated object to it for equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_equalToLongLong instead.)
@ingroup primitive_number_matchers
*/
#ifdef HC_SHORTHAND
#define equalToLongLong HC_equalToLongLong
#endif
OBJC_EXPORT id<HCMatcher> HC_equalToShort(short value);
/**
equalToShort(value) -
Matches if object is equal to @c NSNumber created from a @c short.
@param value The @c short value from which to create an @c NSNumber.
This matcher creates an @c NSNumber object from a @c short @a value and compares the evaluated
object to it for equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_equalToShort instead.)
@ingroup primitive_number_matchers
*/
#ifdef HC_SHORTHAND
#define equalToShort HC_equalToShort
#endif
OBJC_EXPORT id<HCMatcher> HC_equalToUnsignedChar(unsigned char value);
/**
equalToUnsignedChar(value) -
Matches if object is equal to @c NSNumber created from an <code>unsigned char</code>.
@param value The <code>unsigned char</code> value from which to create an @c NSNumber.
This matcher creates an @c NSNumber object from an <code>unsigned char</code> @a value and
compares the evaluated object to it for equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_equalToUnsignedChar instead.)
@ingroup primitive_number_matchers
*/
#ifdef HC_SHORTHAND
#define equalToUnsignedChar HC_equalToUnsignedChar
#endif
OBJC_EXPORT id<HCMatcher> HC_equalToUnsignedInt(unsigned int value);
/**
equalToUnsignedInt(value) -
Matches if object is equal to @c NSNumber created from an <code>unsigned int</code>.
@param value The <code>unsigned int</code> value from which to create an @c NSNumber.
This matcher creates an @c NSNumber object from an <code>unsigned int</code> @a value and
compares the evaluated object to it for equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_equalToUnsignedInt instead.)
@ingroup primitive_number_matchers
*/
#ifdef HC_SHORTHAND
#define equalToUnsignedInt HC_equalToUnsignedInt
#endif
OBJC_EXPORT id<HCMatcher> HC_equalToUnsignedLong(unsigned long value);
/**
equalToUnsignedLong(value) -
Matches if object is equal to @c NSNumber created from an <code>unsigned long</code>.
@param value The <code>unsigned long</code> value from which to create an @c NSNumber.
This matcher creates an @c NSNumber object from an <code>unsigned long</code> @a value and
compares the evaluated object to it for equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_equalToUnsignedLong instead.)
@ingroup primitive_number_matchers
*/
#ifdef HC_SHORTHAND
#define equalToUnsignedLong HC_equalToUnsignedLong
#endif
OBJC_EXPORT id<HCMatcher> HC_equalToUnsignedLongLong(unsigned long long value);
/**
equalToUnsignedLongLong(value) -
Matches if object is equal to @c NSNumber created from an <code>unsigned long long</code>.
@param value The <code>unsigned long long</code> value from which to create an @c NSNumber.
This matcher creates an @c NSNumber object from an <code>unsigned long long</code> @a value and
compares the evaluated object to it for equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_equalToUnsignedLongLong instead.)
@ingroup primitive_number_matchers
*/
#ifdef HC_SHORTHAND
#define equalToUnsignedLongLong HC_equalToUnsignedLongLong
#endif
OBJC_EXPORT id<HCMatcher> HC_equalToUnsignedShort(unsigned short value);
/**
equalToUnsignedShort(value) -
Matches if object is equal to @c NSNumber created from an <code>unsigned short</code>.
@param value The <code>unsigned short</code> value from which to create an @c NSNumber.
This matcher creates an @c NSNumber object from an <code>unsigned short</code> @a value and
compares the evaluated object to it for equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_equalToUnsignedShort instead.)
@ingroup primitive_number_matchers
*/
#ifdef HC_SHORTHAND
#define equalToUnsignedShort HC_equalToUnsignedShort
#endif
OBJC_EXPORT id<HCMatcher> HC_equalToInteger(NSInteger value);
/**
equalToInteger(value) -
Matches if object is equal to @c NSNumber created from an @c NSInteger.
@param value The @c NSInteger value from which to create an @c NSNumber.
This matcher creates an @c NSNumber object from an @c NSInteger @a value and compares the
evaluated object to it for equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_equalToInteger instead.)
@ingroup primitive_number_matchers
*/
#ifdef HC_SHORTHAND
#define equalToInteger HC_equalToInteger
#endif
OBJC_EXPORT id<HCMatcher> HC_equalToUnsignedInteger(NSUInteger value);
/**
equalToUnsignedInteger(value) -
Matches if object is equal to @c NSNumber created from an @c NSUInteger.
@param value The @c NSUInteger value from which to create an @c NSNumber.
This matcher creates an @c NSNumber object from an @c NSUInteger @a value and compares the
evaluated object to it for equality.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_equalToUnsignedInteger instead.)
@ingroup primitive_number_matchers
*/
#ifdef HC_SHORTHAND
#define equalToUnsignedInteger HC_equalToUnsignedInteger
#endif

View File

@@ -0,0 +1,42 @@
//
// OCHamcrest - HCIsIn.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCIsIn : HCBaseMatcher
{
id collection;
}
+ (id)isInCollection:(id)aCollection;
- (id)initWithCollection:(id)aCollection;
@end
OBJC_EXPORT id<HCMatcher> HC_isIn(id aCollection);
/**
isIn(aCollection) -
Matches if evaluated object is present in a given collection.
@param aCollection The collection to search.
This matcher invokes @c -containsObject: on @a aCollection to determine if the evaluated object
is an element of the collection.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_isIn instead.)
@ingroup collection_matchers
*/
#ifdef HC_SHORTHAND
#define isIn HC_isIn
#endif

View File

@@ -0,0 +1,45 @@
//
// OCHamcrest - HCIsInstanceOf.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCIsInstanceOf : HCBaseMatcher
{
Class theClass;
}
+ (id)isInstanceOf:(Class)type;
- (id)initWithType:(Class)type;
@end
OBJC_EXPORT id<HCMatcher> HC_instanceOf(Class aClass);
/**
instanceOf(aClass) -
Matches if object is an instance of, or inherits from, a given class.
@param aClass The class to compare against as the expected class.
This matcher checks whether the evaluated object is an instance of @a aClass or an instance of
any class that inherits from @a aClass.
Example:
@li @ref instanceOf([NSString class])
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_instanceOf instead.)
@ingroup object_matchers
*/
#ifdef HC_SHORTHAND
#define instanceOf HC_instanceOf
#endif

View File

@@ -0,0 +1,47 @@
//
// OCHamcrest - HCIsNil.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCIsNil : HCBaseMatcher
+ (id)isNil;
@end
OBJC_EXPORT id<HCMatcher> HC_nilValue(void);
/**
Matches if object is @c nil.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_nilValue instead.)
@ingroup object_matchers
*/
#ifdef HC_SHORTHAND
#define nilValue() HC_nilValue()
#endif
OBJC_EXPORT id<HCMatcher> HC_notNilValue(void);
/**
Matches if object is not @c nil.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_notNilValue instead.)
@ingroup object_matchers
*/
#ifdef HC_SHORTHAND
#define notNilValue() HC_notNilValue()
#endif

View File

@@ -0,0 +1,47 @@
//
// OCHamcrest - HCIsNot.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCIsNot : HCBaseMatcher
{
id<HCMatcher> matcher;
}
+ (id)isNot:(id<HCMatcher>)aMatcher;
- (id)initNot:(id<HCMatcher>)aMatcher;
@end
OBJC_EXPORT id<HCMatcher> HC_isNot(id aMatcher);
/**
isNot(aMatcher) -
Inverts the given matcher to its logical negation.
@param aMatcher The matcher to negate.
This matcher compares the evaluated object to the negation of the given matcher. If the
@a aMatcher argument is not a matcher, it is implicitly wrapped in an @ref equalTo matcher to
check for equality, and thus matches for inequality.
Examples:
@li <code>@ref assertThat(cheese, isNot(equalTo(smelly)))</code>
@li <code>@ref assertThat(cheese, isNot(smelly))</code>
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_isNot instead.)
@ingroup logical_matchers
*/
#ifdef HC_SHORTHAND
#define isNot HC_isNot
#endif

View File

@@ -0,0 +1,42 @@
//
// OCHamcrest - HCIsSame.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCIsSame : HCBaseMatcher
{
id object;
}
+ (id)isSameAs:(id)anObject;
- (id)initSameAs:(id)anObject;
@end
OBJC_EXPORT id<HCMatcher> HC_sameInstance(id object);
/**
sameInstance(anObject) -
Matches if evaluated object is the same instance as a given object.
@param anObject The object to compare against as the expected value.
This matcher compares the address of the evaluated object to determine if it is the same object
as @a anObject.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_sameInstance instead.)
@ingroup object_matchers
*/
#ifdef HC_SHORTHAND
#define sameInstance HC_sameInstance
#endif

View File

@@ -0,0 +1,56 @@
//
// OCHamcrest - HCMatcher.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import "HCSelfDescribing.h"
/**
A matcher over acceptable values.
A matcher is able to describe itself to give feedback when it fails.
HCMatcher implementations should @b not directly implement this protocol.
Instead, @b extend the HCBaseMatcher class, which will ensure that the HCMatcher API can grow
to support new features and remain compatible with all HCMatcher implementations.
@ingroup core
*/
@protocol HCMatcher <HCSelfDescribing>
/**
Evaluates the matcher for argument @a item.
@param item The object against which the matcher is evaluated.
@return @c YES if @a item matches, otherwise @c NO.
*/
- (BOOL)matches:(id)item;
/**
Evaluates the matcher for argument @a item.
@param item The object against which the matcher is evaluated.
@param mismatchDescription The description to be built or appended to if @a item does not match.
@return @c YES if @a item matches, otherwise @c NO.
*/
- (BOOL)matches:(id)item describingMismatchTo:(id<HCDescription>)mismatchDescription;
/**
Generates a description of why the matcher has not accepted the item.
The description will be part of a larger description of why a matching failed, so it should be
concise.
This method assumes that @c matches:item is false, but will not check this.
@param item The item that the HCMatcher has rejected.
@param mismatchDescription The description to be built or appended to.
*/
- (void)describeMismatchOf:(id)item to:(id<HCDescription>)mismatchDescription;
@end

View File

@@ -0,0 +1,387 @@
//
// OCHamcrest - HCNumberAssert.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <Foundation/Foundation.h>
@protocol HCMatcher;
OBJC_EXPORT void HC_assertThatBoolWithLocation(id testCase, BOOL actual,
id<HCMatcher> matcher, const char* fileName, int lineNumber);
#define HC_assertThatBool(actual, matcher) \
HC_assertThatBoolWithLocation(self, actual, matcher, __FILE__, __LINE__)
/**
assertThatBool(actual, matcher) -
Asserts that @c BOOL actual value, converted to an @c NSNumber, satisfies matcher.
@param actual The @c BOOL value to convert to an @c NSNumber for evaluation.
@param matcher The matcher to satisfy as the expected condition.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_assertThatBool instead.)
@ingroup integration_numeric
*/
#ifdef HC_SHORTHAND
#define assertThatBool HC_assertThatBool
#endif
#pragma mark -
OBJC_EXPORT void HC_assertThatCharWithLocation(id testCase, char actual,
id<HCMatcher> matcher, const char* fileName, int lineNumber);
#define HC_assertThatChar(actual, matcher) \
HC_assertThatCharWithLocation(self, actual, matcher, __FILE__, __LINE__)
/**
assertThatChar(actual, matcher) -
Asserts that @c char actual value, converted to an @c NSNumber, satisfies matcher.
@param actual The @c char value to convert to an @c NSNumber for evaluation.
@param matcher The matcher to satisfy as the expected condition.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_assertThatChar instead.)
@ingroup integration_numeric
*/
#ifdef HC_SHORTHAND
#define assertThatChar HC_assertThatChar
#endif
#pragma mark -
OBJC_EXPORT void HC_assertThatDoubleWithLocation(id testCase, double actual,
id<HCMatcher> matcher, const char* fileName, int lineNumber);
#define HC_assertThatDouble(actual, matcher) \
HC_assertThatDoubleWithLocation(self, actual, matcher, __FILE__, __LINE__)
/**
HC_assertThatDouble(actual, matcher) -
Asserts that @c double actual value, converted to an @c NSNumber, satisfies matcher.
@param actual The @c double value to convert to an @c NSNumber for evaluation.
@param matcher The matcher to satisfy as the expected condition.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_assertThatDouble instead.)
@ingroup integration_numeric
*/
#ifdef HC_SHORTHAND
#define assertThatDouble HC_assertThatDouble
#endif
#pragma mark -
OBJC_EXPORT void HC_assertThatFloatWithLocation(id testCase, float actual,
id<HCMatcher> matcher, const char* fileName, int lineNumber);
#define HC_assertThatFloat(actual, matcher) \
HC_assertThatFloatWithLocation(self, actual, matcher, __FILE__, __LINE__)
/**
assertThatFloat(actual, matcher) -
Asserts that @c float actual value, converted to an @c NSNumber, satisfies matcher.
@param actual The @c float value to convert to an @c NSNumber for evaluation.
@param matcher The matcher to satisfy as the expected condition.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_assertThatFloat instead.)
@ingroup integration_numeric
*/
#ifdef HC_SHORTHAND
#define assertThatFloat HC_assertThatFloat
#endif
#pragma mark -
OBJC_EXPORT void HC_assertThatIntWithLocation(id testCase, int actual,
id<HCMatcher> matcher, const char* fileName, int lineNumber);
#define HC_assertThatInt(actual, matcher) \
HC_assertThatIntWithLocation(self, actual, matcher, __FILE__, __LINE__)
/**
assertThatInt(actual, matcher) -
Asserts that @c int actual value, converted to an @c NSNumber, satisfies matcher.
@param actual The @c int value to convert to an @c NSNumber for evaluation.
@param matcher The matcher to satisfy as the expected condition.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_assertThatInt instead.)
@ingroup integration_numeric
*/
#ifdef HC_SHORTHAND
#define assertThatInt HC_assertThatInt
#endif
#pragma mark -
OBJC_EXPORT void HC_assertThatLongWithLocation(id testCase, long actual,
id<HCMatcher> matcher, const char* fileName, int lineNumber);
#define HC_assertThatLong(actual, matcher) \
HC_assertThatLongWithLocation(self, actual, matcher, __FILE__, __LINE__)
/**
assertThatLong(actual, matcher) -
Asserts that @c long actual value, converted to an @c NSNumber, satisfies matcher.
@param actual The @c long value to convert to an @c NSNumber for evaluation.
@param matcher The matcher to satisfy as the expected condition.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_assertThatLong instead.)
@ingroup integration_numeric
*/
#ifdef HC_SHORTHAND
#define assertThatLong HC_assertThatLong
#endif
#pragma mark -
OBJC_EXPORT void HC_assertThatLongLongWithLocation(id testCase, long long actual,
id<HCMatcher> matcher, const char* fileName, int lineNumber);
#define HC_assertThatLongLong(actual, matcher) \
HC_assertThatLongLongWithLocation(self, actual, matcher, __FILE__, __LINE__)
/**
assertThatLongLong(actual, matcher) -
Asserts that <code>long long</code> actual value, converted to an @c NSNumber, satisfies
matcher.
@param actual The <code>long long</code> value to convert to an @c NSNumber for evaluation.
@param matcher The matcher to satisfy as the expected condition.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_assertThatLongLong instead.)
@ingroup integration_numeric
*/
#ifdef HC_SHORTHAND
#define assertThatLongLong HC_assertThatLongLong
#endif
#pragma mark -
OBJC_EXPORT void HC_assertThatShortWithLocation(id testCase, short actual,
id<HCMatcher> matcher, const char* fileName, int lineNumber);
#define HC_assertThatShort(actual, matcher) \
HC_assertThatShortWithLocation(self, actual, matcher, __FILE__, __LINE__)
/**
assertThatShort(actual, matcher) -
Asserts that @c short actual value, converted to an @c NSNumber, satisfies matcher.
@param actual The @c short value to convert to an @c NSNumber for evaluation.
@param matcher The matcher to satisfy as the expected condition.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_assertThatShort instead.)
@ingroup integration_numeric
*/
#ifdef HC_SHORTHAND
#define assertThatShort HC_assertThatShort
#endif
#pragma mark -
OBJC_EXPORT void HC_assertThatUnsignedCharWithLocation(id testCase, unsigned char actual,
id<HCMatcher> matcher, const char* fileName, int lineNumber);
#define HC_assertThatUnsignedChar(actual, matcher) \
HC_assertThatUnsignedCharWithLocation(self, actual, matcher, __FILE__, __LINE__)
/**
assertThatUnsignedChar(actual, matcher) -
Asserts that <code>unsigned char</code> actual value, converted to an @c NSNumber, satisfies
matcher.
@param actual The <code>unsigned char</code> value to convert to an @c NSNumber for evaluation.
@param matcher The matcher to satisfy as the expected condition.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_assertThatUnsignedChar instead.)
@ingroup integration_numeric
*/
#ifdef HC_SHORTHAND
#define assertThatUnsignedChar HC_assertThatUnsignedChar
#endif
#pragma mark -
OBJC_EXPORT void HC_assertThatUnsignedIntWithLocation(id testCase, unsigned int actual,
id<HCMatcher> matcher, const char* fileName, int lineNumber);
#define HC_assertThatUnsignedInt(actual, matcher) \
HC_assertThatUnsignedIntWithLocation(self, actual, matcher, __FILE__, __LINE__)
/**
assertThatUnsignedInt(actual, matcher) -
Asserts that <code>unsigned int</code> actual value, converted to an @c NSNumber, satisfies
matcher.
@param actual The <code>unsigned int</code> value to convert to an @c NSNumber for evaluation @param matcher The matcher to satisfy as the expected condition.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_assertThatUnsignedInt instead.)
@ingroup integration_numeric
*/
#ifdef HC_SHORTHAND
#define assertThatUnsignedInt HC_assertThatUnsignedInt
#endif
#pragma mark -
OBJC_EXPORT void HC_assertThatUnsignedLongWithLocation(id testCase, unsigned long actual,
id<HCMatcher> matcher, const char* fileName, int lineNumber);
#define HC_assertThatUnsignedLong(actual, matcher) \
HC_assertThatUnsignedLongWithLocation(self, actual, matcher, __FILE__, __LINE__)
/**
assertThatUnsignedLong(actual, matcher) -
Asserts that <code>unsigned long</code> actual value, converted to an @c NSNumber, satisfies
matcher.
@param actual The <code>unsigned long</code> value to convert to an @c NSNumber for evaluation @param matcher The matcher to satisfy as the expected condition.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_assertThatUnsignedLong instead.)
@ingroup integration_numeric
*/
#ifdef HC_SHORTHAND
#define assertThatUnsignedLong HC_assertThatUnsignedLong
#endif
#pragma mark -
OBJC_EXPORT void HC_assertThatUnsignedLongLongWithLocation(id testCase, unsigned long long actual,
id<HCMatcher> matcher, const char* fileName, int lineNumber);
#define HC_assertThatUnsignedLongLong(actual, matcher) \
HC_assertThatUnsignedLongLongWithLocation(self, actual, matcher, __FILE__, __LINE__)
/**
assertThatUnsignedLongLong(actual, matcher) -
Asserts that <code>unsigned long long</code> actual value, converted to an @c NSNumber,
satisfies matcher.
@param actual The <code>unsigned long long</code> value to convert to an @c NSNumber for evaluation @param matcher The matcher to satisfy as the expected condition.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_assertThatUnsignedLongLong instead.)
@ingroup integration_numeric
*/
#ifdef HC_SHORTHAND
#define assertThatUnsignedLongLong HC_assertThatUnsignedLongLong
#endif
#pragma mark -
OBJC_EXPORT void HC_assertThatUnsignedShortWithLocation(id testCase, unsigned short actual,
id<HCMatcher> matcher, const char* fileName, int lineNumber);
#define HC_assertThatUnsignedShort(actual, matcher) \
HC_assertThatUnsignedShortWithLocation(self, actual, matcher, __FILE__, __LINE__)
/**
assertThatUnsignedShort(actual, matcher) -
Asserts that <code>unsigned short</code> actual value, converted to an @c NSNumber, satisfies
matcher.
@param actual The <code>unsigned short</code> value to convert to an @c NSNumber for evaluation @param matcher The matcher to satisfy as the expected condition.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_assertThatUnsignedShort instead.)
@ingroup integration_numeric
*/
#ifdef HC_SHORTHAND
#define assertThatUnsignedShort HC_assertThatUnsignedShort
#endif
#pragma mark -
OBJC_EXPORT void HC_assertThatIntegerWithLocation(id testCase, NSInteger actual,
id<HCMatcher> matcher, const char* fileName, int lineNumber);
#define HC_assertThatInteger(actual, matcher) \
HC_assertThatIntegerWithLocation(self, actual, matcher, __FILE__, __LINE__)
/**
assertThatInteger(actual, matcher) -
Asserts that @c NSInteger actual value, converted to an @c NSNumber, satisfies matcher.
@param actual The @c NSInteger value to convert to an @c NSNumber for evaluation.
@param matcher The matcher to satisfy as the expected condition.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_assertThatInteger instead.)
@ingroup integration_numeric
*/
#ifdef HC_SHORTHAND
#define assertThatInteger HC_assertThatInteger
#endif
#pragma mark -
OBJC_EXPORT void HC_assertThatUnsignedIntegerWithLocation(id testCase, NSUInteger actual,
id<HCMatcher> matcher, const char* fileName, int lineNumber);
#define HC_assertThatUnsignedInteger(actual, matcher) \
HC_assertThatUnsignedIntegerWithLocation(self, actual, matcher, __FILE__, __LINE__)
/**
assertThatUnsignedInteger(actual, matcher) -
Asserts that @c NSUInteger actual value, converted to an @c NSNumber, satisfies matcher.
@param actual The @c NSUInteger value to convert to an @c NSNumber for evaluation.
@param matcher The matcher to satisfy as the expected condition.
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_assertThatUnsignedInteger instead.)
@ingroup integration_numeric
*/
#ifdef HC_SHORTHAND
#define assertThatUnsignedInteger HC_assertThatUnsignedInteger
#endif

View File

@@ -0,0 +1,115 @@
//
// OCHamcrest - HCOrderingComparison.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCOrderingComparison : HCBaseMatcher
{
id expected;
NSComparisonResult minCompare;
NSComparisonResult maxCompare;
NSString *comparisonDescription;
}
+ (id)compare:(id)expectedValue
minCompare:(NSComparisonResult)min
maxCompare:(NSComparisonResult)max
comparisonDescription:(NSString *)comparisonDescription;
- (id)initComparing:(id)expectedValue
minCompare:(NSComparisonResult)min
maxCompare:(NSComparisonResult)max
comparisonDescription:(NSString *)comparisonDescription;
@end
OBJC_EXPORT id<HCMatcher> HC_greaterThan(id expected);
/**
greaterThan(aNumber) -
Matches if object is greater than a given number.
@param aNumber The @c NSNumber to compare against.
Example:
@li @ref greaterThan(\@5)
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_greaterThan instead.)
@ingroup number_matchers
*/
#ifdef HC_SHORTHAND
#define greaterThan HC_greaterThan
#endif
OBJC_EXPORT id<HCMatcher> HC_greaterThanOrEqualTo(id expected);
/**
greaterThanOrEqualTo(aNumber) -
Matches if object is greater than or equal to a given number.
@param aNumber The @c NSNumber to compare against.
Example:
@li @ref greaterThanOrEqualTo(\@5)
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_greaterThanOrEqualTo instead.)
@ingroup number_matchers
*/
#ifdef HC_SHORTHAND
#define greaterThanOrEqualTo HC_greaterThanOrEqualTo
#endif
OBJC_EXPORT id<HCMatcher> HC_lessThan(id expected);
/**
lessThan(aNumber) -
Matches if object is less than a given number.
@param aNumber The @c NSNumber to compare against.
Example:
@li @ref lessThan(\@5)
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_lessThan instead.)
@ingroup number_matchers
*/
#ifdef HC_SHORTHAND
#define lessThan HC_lessThan
#endif
OBJC_EXPORT id<HCMatcher> HC_lessThanOrEqualTo(id expected);
/**
lessThanOrEqualTo(aNumber) -
Matches if object is less than or equal to a given number.
@param aNumber The @c NSNumber to compare against.
Example:
@li @ref lessThanOrEqualTo(\@5)
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_lessThanOrEqualTo instead.)
@ingroup number_matchers
*/
#ifdef HC_SHORTHAND
#define lessThanOrEqualTo HC_lessThanOrEqualTo
#endif

View File

@@ -0,0 +1,19 @@
//
// OCHamcrest - HCRequireNonNilObject.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <Foundation/Foundation.h>
#import <objc/objc-api.h>
/**
Throws an NSException if @a obj is @c nil.
@ingroup helpers
*/
OBJC_EXPORT void HCRequireNonNilObject(id obj);

View File

@@ -0,0 +1,21 @@
//
// OCHamcrest - HCRequireNonNilString.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <Foundation/Foundation.h>
#import <objc/objc-api.h>
/**
Throws an NSException if @a string is @c nil.
@b Deprecated: Use @ref HCRequireNonNilObject instead.
@ingroup helpers
*/
OBJC_EXPORT void HCRequireNonNilString(NSString *string) __attribute__((deprecated));

View File

@@ -0,0 +1,32 @@
//
// OCHamcrest - HCSelfDescribing.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <Foundation/Foundation.h>
@protocol HCDescription;
/**
The ability of an object to describe itself.
@ingroup core
*/
@protocol HCSelfDescribing <NSObject>
/**
Generates a description of the object.
The description may be part of a description of a larger object of which this is just a
component, so it should be worded appropriately.
@param description The description to be built or appended to.
*/
- (void)describeTo:(id<HCDescription>)description;
@end

View File

@@ -0,0 +1,45 @@
//
// OCHamcrest - HCStringContains.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCSubstringMatcher.h>
@interface HCStringContains : HCSubstringMatcher
+ (id)stringContains:(NSString *)aSubstring;
@end
OBJC_EXPORT id<HCMatcher> HC_containsString(NSString *aSubstring);
/**
containsString(aString) -
Matches if object is a string containing a given string.
@param aString The string to search for. This value must not be @c nil.
This matcher first checks whether the evaluated object is a string. If so, it checks whether it
contains @a aString.
Example:
@par
@ref containsString(@"def")
will match "abcdefg".
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_containsString instead.)
@ingroup text_matchers
*/
#ifdef HC_SHORTHAND
#define containsString HC_containsString
#endif

View File

@@ -0,0 +1,50 @@
//
// OCHamcrest - HCStringContainsInOrder.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCStringContainsInOrder : HCBaseMatcher
{
NSArray *substrings;
}
+ (id)containsInOrder:(NSArray *)substringList;
- (id)initWithSubstrings:(NSArray *)substringList;
@end
OBJC_EXPORT id<HCMatcher> HC_stringContainsInOrder(NSString *substring, ...) NS_REQUIRES_NIL_TERMINATION;
/**
stringContainsInOrder(firstString, ...) -
Matches if object is a string containing a given list of substrings in relative order.
@param firstString,... A comma-separated list of strings ending with @c nil.
This matcher first checks whether the evaluated object is a string. If so, it checks whether it
contains a given list of strings, in relative order to each other. The searches are performed
starting from the beginning of the evaluated string.
Example:
@par
@ref stringContainsInOrder(@"bc", @"fg", @"jkl", nil)
will match "abcdefghijklm".
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_stringContainsInOrder instead.)
@ingroup text_matchers
*/
#ifdef HC_SHORTHAND
#define stringContainsInOrder HC_stringContainsInOrder
#endif

View File

@@ -0,0 +1,43 @@
//
// OCHamcrest - HCStringDescription.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseDescription.h>
@protocol HCSelfDescribing;
/**
An HCDescription that is stored as a string.
@ingroup core
*/
@interface HCStringDescription : HCBaseDescription
{
NSMutableString *accumulator;
}
/**
Returns the description of an HCSelfDescribing object as a string.
@param selfDescribing The object to be described.
@return The description of the object.
*/
+ (NSString *)stringFrom:(id<HCSelfDescribing>)selfDescribing;
/**
Returns an empty description.
*/
+ (HCStringDescription *)stringDescription;
/**
Returns an initialized HCStringDescription object that is empty.
*/
- (id)init;
@end

View File

@@ -0,0 +1,45 @@
//
// OCHamcrest - HCStringEndsWith.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCSubstringMatcher.h>
@interface HCStringEndsWith : HCSubstringMatcher
+ (id)stringEndsWith:(NSString *)aSubstring;
@end
OBJC_EXPORT id<HCMatcher> HC_endsWith(NSString *aSubstring);
/**
endsWith(aString) -
Matches if object is a string ending with a given string.
@param aString The string to search for. This value must not be @c nil.
This matcher first checks whether the evaluated object is a string. If so, it checks if
@a aString matches the ending characters of the evaluated object.
Example:
@par
@ref endsWith(@"bar")
will match "foobar".
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_endsWith instead.)
@ingroup text_matchers
*/
#ifdef HC_SHORTHAND
#define endsWith HC_endsWith
#endif

View File

@@ -0,0 +1,45 @@
//
// OCHamcrest - HCStringStartsWith.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCSubstringMatcher.h>
@interface HCStringStartsWith : HCSubstringMatcher
+ (id)stringStartsWith:(NSString *)aSubstring;
@end
OBJC_EXPORT id<HCMatcher> HC_startsWith(NSString *aSubstring);
/**
startsWith(aString) -
Matches if object is a string starting with a given string.
@param aString The string to search for. This value must not be @c nil.
This matcher first checks whether the evaluated object is a string. If so, it checks if
@a aString matches the beginning characters of the evaluated object.
Example:
@par
@ref endsWith(@"foo")
will match "foobar".
(In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_startsWith instead.)
@ingroup text_matchers
*/
#ifdef HC_SHORTHAND
#define startsWith HC_startsWith
#endif

View File

@@ -0,0 +1,20 @@
//
// OCHamcrest - HCSubstringMatcher.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
@interface HCSubstringMatcher : HCBaseMatcher
{
NSString *substring;
}
- (id)initWithSubstring:(NSString *)aString;
@end

View File

@@ -0,0 +1,22 @@
//
// OCHamcrest - HCWrapInMatcher.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <objc/objc-api.h>
@protocol HCMatcher;
/**
Wraps argument in a matcher, if necessary.
@return The argument as-if if it is already a matcher, otherwise wrapped in an @ref equalTo matcher.
@ingroup helpers
*/
OBJC_EXPORT id<HCMatcher> HCWrapInMatcher(id matcherOrValue);

View File

@@ -0,0 +1,137 @@
//
// OCHamcrest - OCHamcrest.h
// Copyright 2012 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
/**
@defgroup library Matcher Library
Library of Matcher implementations.
*/
/**
@defgroup object_matchers Object Matchers
Matchers that inspect objects.
@ingroup library
*/
#import <OCHamcrestIOS/HCConformsToProtocol.h>
#import <OCHamcrestIOS/HCHasDescription.h>
#import <OCHamcrestIOS/HCHasProperty.h>
#import <OCHamcrestIOS/HCIsEqual.h>
#import <OCHamcrestIOS/HCIsInstanceOf.h>
#import <OCHamcrestIOS/HCIsNil.h>
#import <OCHamcrestIOS/HCIsSame.h>
/**
@defgroup collection_matchers Collection Matchers
Matchers of collections.
@ingroup library
*/
#import <OCHamcrestIOS/HCHasCount.h>
#import <OCHamcrestIOS/HCIsCollectionContaining.h>
#import <OCHamcrestIOS/HCIsCollectionContainingInAnyOrder.h>
#import <OCHamcrestIOS/HCIsCollectionContainingInOrder.h>
#import <OCHamcrestIOS/HCIsCollectionOnlyContaining.h>
#import <OCHamcrestIOS/HCIsDictionaryContaining.h>
#import <OCHamcrestIOS/HCIsDictionaryContainingEntries.h>
#import <OCHamcrestIOS/HCIsDictionaryContainingKey.h>
#import <OCHamcrestIOS/HCIsDictionaryContainingValue.h>
#import <OCHamcrestIOS/HCIsEmptyCollection.h>
#import <OCHamcrestIOS/HCIsIn.h>
/**
@defgroup number_matchers Number Matchers
Matchers that perform numeric comparisons.
@ingroup library
*/
#import <OCHamcrestIOS/HCIsCloseTo.h>
#import <OCHamcrestIOS/HCOrderingComparison.h>
/**
@defgroup primitive_number_matchers Primitive Number Matchers
Matchers for testing equality against primitive numeric types.
@ingroup number_matchers
*/
#import <OCHamcrestIOS/HCIsEqualToNumber.h>
/**
@defgroup text_matchers Text Matchers
Matchers that perform text comparisons.
@ingroup library
*/
#import <OCHamcrestIOS/HCIsEqualIgnoringCase.h>
#import <OCHamcrestIOS/HCIsEqualIgnoringWhiteSpace.h>
#import <OCHamcrestIOS/HCStringContains.h>
#import <OCHamcrestIOS/HCStringContainsInOrder.h>
#import <OCHamcrestIOS/HCStringEndsWith.h>
#import <OCHamcrestIOS/HCStringStartsWith.h>
/**
@defgroup logical_matchers Logical Matchers
Boolean logic using other matchers.
@ingroup library
*/
#import <OCHamcrestIOS/HCAllOf.h>
#import <OCHamcrestIOS/HCAnyOf.h>
#import <OCHamcrestIOS/HCIsAnything.h>
#import <OCHamcrestIOS/HCIsNot.h>
/**
@defgroup decorator_matchers Decorator Matchers
Matchers that decorate other matchers for better expression.
@ingroup library
*/
#import <OCHamcrestIOS/HCDescribedAs.h>
#import <OCHamcrestIOS/HCIs.h>
/**
@defgroup integration Unit Test Integration
*/
#import <OCHamcrestIOS/HCAssertThat.h>
/**
@defgroup integration_numeric Unit Tests of Primitive Numbers
Unit test integration for primitive numbers.
The @c assertThat&lt;Type&gt; macros convert the primitive actual value to an @c NSNumber,
passing that to the matcher for evaluation. If the matcher is not satisfied, an exception is
thrown describing the mismatch.
This family of macros is designed to integrate well with OCUnit and other unit testing
frameworks. Unmet assertions are reported as test failures. In Xcode, they can be clicked to
reveal the line of the assertion.
@ingroup integration
*/
#import <OCHamcrestIOS/HCNumberAssert.h>
/**
@defgroup core Core API
*/
/**
@defgroup helpers Helpers
Utilities for writing Matchers.
@ingroup core
*/

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>12C60</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>OCHamcrestIOS</string>
<key>CFBundleIdentifier</key>
<string>org.hamcrest.OCHamcrestIOS</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>OCHamcrestIOS</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.9</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.9</string>
<key>DTCompiler</key>
<string></string>
<key>DTPlatformBuild</key>
<string>4G2008a</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>12C37</string>
<key>DTSDKName</key>
<string>macosx10.8</string>
<key>DTXcode</key>
<string>0452</string>
<key>DTXcodeBuild</key>
<string>4G2008a</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2012 hamcrest.org</string>
</dict>
</plist>

View File

@@ -0,0 +1 @@
A

View File

@@ -0,0 +1 @@
Versions/Current/Headers

View File

@@ -0,0 +1 @@
Versions/Current/OCMockitoIOS

View File

@@ -0,0 +1 @@
Versions/Current/Resources

View File

@@ -0,0 +1,17 @@
//
// OCMockito - MKTBaseMockObject.h
// Copyright 2012 Jonathan M. Reid. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Source: https://github.com/jonreid/OCMockito
//
#import <Foundation/Foundation.h>
#import "MKTPrimitiveArgumentMatching.h"
@interface MKTBaseMockObject : NSProxy <MKTPrimitiveArgumentMatching>
- (id)init;
@end

View File

@@ -0,0 +1,22 @@
//
// OCMockito - MKTClassObjectMock.h
// Copyright 2012 Jonathan M. Reid. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Source: https://github.com/jonreid/OCMockito
//
// Created by: David Hart
//
#import "MKTBaseMockObject.h"
/**
Mock object of a given class object.
*/
@interface MKTClassObjectMock : MKTBaseMockObject
+ (id)mockForClass:(Class)aClass;
- (id)initWithClass:(Class)aClass;
@end

View File

@@ -0,0 +1,20 @@
//
// OCMockito - MKTObjectAndProtocolMock.h
// Copyright 2012 Jonathan M. Reid. See LICENSE.txt
//
// Created by: Kevin Lundberg
// Source: https://github.com/jonreid/OCMockito
//
#import "MKTProtocolMock.h"
/**
Mock object of a given class that also implements a given protocol.
*/
@interface MKTObjectAndProtocolMock : MKTProtocolMock
+ (id)mockForClass:(Class)aClass protocol:(Protocol *)protocol;
- (id)initWithClass:(Class)aClass protocol:(Protocol *)protocol;
@end

View File

@@ -0,0 +1,20 @@
//
// OCMockito - MKTObjectMock.h
// Copyright 2012 Jonathan M. Reid. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Source: https://github.com/jonreid/OCMockito
//
#import "MKTBaseMockObject.h"
/**
Mock object of a given class.
*/
@interface MKTObjectMock : MKTBaseMockObject
+ (id)mockForClass:(Class)aClass;
- (id)initWithClass:(Class)aClass;
@end

View File

@@ -0,0 +1,70 @@
//
// OCMockito - MKTOngoingStubbing.h
// Copyright 2012 Jonathan M. Reid. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Source: https://github.com/jonreid/OCMockito
//
#import <Foundation/Foundation.h>
#import "MKTPrimitiveArgumentMatching.h"
@class MKTInvocationContainer;
/**
Methods to invoke on @c given(methodCall) to return stubbed values.
*/
@interface MKTOngoingStubbing : NSObject <MKTPrimitiveArgumentMatching>
- (id)initWithInvocationContainer:(MKTInvocationContainer *)invocationContainer;
/// Stubs given object as return value.
- (MKTOngoingStubbing *)willReturn:(id)object;
/// Stubs given @c BOOL as return value.
- (MKTOngoingStubbing *)willReturnBool:(BOOL)value;
/// Stubs given @c char as return value.
- (MKTOngoingStubbing *)willReturnChar:(char)value;
/// Stubs given @c int as return value.
- (MKTOngoingStubbing *)willReturnInt:(int)value;
/// Stubs given @c short as return value.
- (MKTOngoingStubbing *)willReturnShort:(short)value;
/// Stubs given @c long as return value.
- (MKTOngoingStubbing *)willReturnLong:(long)value;
/// Stubs given <code>long long</code> as return value.
- (MKTOngoingStubbing *)willReturnLongLong:(long long)value;
/// Stubs given @c NSInteger as return value.
- (MKTOngoingStubbing *)willReturnInteger:(NSInteger)value;
/// Stubs given <code>unsigned char</code> as return value.
- (MKTOngoingStubbing *)willReturnUnsignedChar:(unsigned char)value;
/// Stubs given <code>unsigned int</code> as return value.
- (MKTOngoingStubbing *)willReturnUnsignedInt:(unsigned int)value;
/// Stubs given <code>unsigned short</code> as return value.
- (MKTOngoingStubbing *)willReturnUnsignedShort:(unsigned short)value;
/// Stubs given <code>unsigned long</code> as return value.
- (MKTOngoingStubbing *)willReturnUnsignedLong:(unsigned long)value;
/// Stubs given <code>unsigned long long</code> as return value.
- (MKTOngoingStubbing *)willReturnUnsignedLongLong:(unsigned long long)value;
/// Stubs given @c NSUInteger as return value.
- (MKTOngoingStubbing *)willReturnUnsignedInteger:(NSUInteger)value;
/// Stubs given @c float as return value.
- (MKTOngoingStubbing *)willReturnFloat:(float)value;
/// Stubs given @c double as return value.
- (MKTOngoingStubbing *)willReturnDouble:(double)value;
@end

View File

@@ -0,0 +1,50 @@
//
// OCMockito - MKTPrimitiveArgumentMatching.h
// Copyright 2012 Jonathan M. Reid. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Source: https://github.com/jonreid/OCMockito
//
@protocol HCMatcher;
/**
Ability to specify OCHamcrest matchers for primitive numeric arguments.
*/
@protocol MKTPrimitiveArgumentMatching
/**
Specifies OCHamcrest matcher for a specific argument of a method.
For methods arguments that take objects, just pass the matcher directly as a method call. But
for arguments that take primitive numeric types, call this to specify the matcher before passing
in a dummy value. Upon verification, the actual numeric argument received will be converted to
an NSNumber before being checked by the matcher.
The argument index is 0-based, so the first argument of a method has index 0.
Example:
@code
[[verify(mockArray) withMatcher:greaterThan([NSNumber numberWithInt:1]) forArgument:0]
removeObjectAtIndex:0];
@endcode
This verifies that @c removeObjectAtIndex: was called with a number greater than 1.
*/
- (id)withMatcher:(id <HCMatcher>)matcher forArgument:(NSUInteger)index;
/**
Specifies OCHamcrest matcher for the first argument of a method.
Equivalent to <code>withMatcher:matcher forArgument:0</code>.
Example:
@code
[[verify(mockArray) withMatcher:greaterThan([NSNumber numberWithInt:1]) forArgument:0]
removeObjectAtIndex:0];
@endcode
This verifies that @c removeObjectAtIndex: was called with a number greater than 1.
*/
- (id)withMatcher:(id <HCMatcher>)matcher;
@end

View File

@@ -0,0 +1,20 @@
//
// OCMockito - MKTProtocolMock.h
// Copyright 2012 Jonathan M. Reid. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Source: https://github.com/jonreid/OCMockito
//
#import "MKTBaseMockObject.h"
/**
Mock object implementing a given protocol.
*/
@interface MKTProtocolMock : MKTBaseMockObject
+ (id)mockForProtocol:(Protocol *)aProtocol;
- (id)initWithProtocol:(Protocol *)aProtocol;
@end

View File

@@ -0,0 +1,221 @@
//
// OCMockito - OCMockito.h
// Copyright 2012 Jonathan M. Reid. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Source: https://github.com/jonreid/OCMockito
//
#import <Foundation/Foundation.h>
#import "MKTClassObjectMock.h"
#import "MKTObjectMock.h"
#import "MKTObjectAndProtocolMock.h"
#import "MKTOngoingStubbing.h"
#import "MKTProtocolMock.h"
#import <objc/objc-api.h>
#define MKTMock(aClass) [MKTObjectMock mockForClass:aClass]
/**
Returns a mock object of a given class.
(In the event of a name clash, don't \#define @c MOCKITO_SHORTHAND and use the synonym
@c MKTMock instead.)
*/
#ifdef MOCKITO_SHORTHAND
#define mock(aClass) MKTMock(aClass)
#endif
#define MKTMockClass(aClass) [MKTClassObjectMock mockForClass:aClass]
/**
Returns a mock class object of a given class.
(In the event of a name clash, don't \#define @c MOCKITO_SHORTHAND and use the synonym
@c MKTMockClass instead.)
*/
#ifdef MOCKITO_SHORTHAND
#define mockClass(aClass) MKTMockClass(aClass)
#endif
#define MKTMockProtocol(aProtocol) [MKTProtocolMock mockForProtocol:aProtocol]
/**
Returns a mock object implementing a given protocol.
(In the event of a name clash, don't \#define @c MOCKITO_SHORTHAND and use the synonym
@c MKTMockProtocol instead.)
*/
#ifdef MOCKITO_SHORTHAND
#define mockProtocol(aProtocol) MKTMockProtocol(aProtocol)
#endif
#define MKTMockObjectAndProtocol(aClass, aProtocol) [MKTObjectAndProtocolMock mockForClass:aClass protocol:aProtocol]
/**
Returns a mock object of a given class that also implements a given protocol.
(In the event of a name clash, don't \#define @c MOCKITO_SHORTHAND and use the synonym
@c MKTMockObjectAndProtocol instead.)
*/
#ifdef MOCKITO_SHORTHAND
#define mockObjectAndProtocol(aClass, aProtocol) MKTMockObjectAndProtocol(aClass, aProtocol)
#endif
OBJC_EXPORT MKTOngoingStubbing *MKTGivenWithLocation(id testCase, const char *fileName, int lineNumber, ...);
#define MKTGiven(methodCall) MKTGivenWithLocation(self, __FILE__, __LINE__, methodCall)
/**
Enables method stubbing.
Use @c given when you want the mock to return particular value when particular method is called.
Example:
@li @ref [given([mockObject methodReturningString]) willReturn:@"foo"];
See @ref MKTOngoingStubbing for other methods to stub different types of return values.
(In the event of a name clash, don't \#define @c MOCKITO_SHORTHAND and use the synonym
@c MKTGiven instead.)
*/
#ifdef MOCKITO_SHORTHAND
#define given(methodCall) MKTGiven(methodCall)
#endif
OBJC_EXPORT id MKTVerifyWithLocation(id mock, id testCase, const char *fileName, int lineNumber);
#define MKTVerify(mock) MKTVerifyWithLocation(mock, self, __FILE__, __LINE__)
/**
Verifies certain behavior happened once.
@c verify checks that a method was invoked once, with arguments that match given OCHamcrest
matchers. If an argument is not a matcher, it is implicitly wrapped in an @c equalTo matcher to
check for equality.
Examples:
@code
[verify(mockObject) someMethod:startsWith(@"foo")];
[verify(mockObject) someMethod:@"bar"];
@endcode
@c verify(mockObject) is equivalent to
@code
verifyCount(mockObject, times(1))
@endcode
(In the event of a name clash, don't \#define @c MOCKITO_SHORTHAND and use the synonym
@c MKTVerify instead.)
*/
#ifdef MOCKITO_SHORTHAND
#undef verify
#define verify(mock) MKTVerify(mock)
#endif
OBJC_EXPORT id MKTVerifyCountWithLocation(id mock, id mode, id testCase, const char *fileName, int lineNumber);
#define MKTVerifyCount(mock, mode) MKTVerifyCountWithLocation(mock, mode, self, __FILE__, __LINE__)
/**
Verifies certain behavior happened a given number of times.
Examples:
@code
[verifyCount(mockObject, times(5)) someMethod:@"was called five times"];
[verifyCount(mockObject, never()) someMethod:@"was never called"];
@endcode
@c verifyCount checks that a method was invoked a given number of times, with arguments that
match given OCHamcrest matchers. If an argument is not a matcher, it is implicitly wrapped in an
@c equalTo matcher to check for equality.
(In the event of a name clash, don't \#define @c MOCKITO_SHORTHAND and use the synonym
@c MKTVerifyCount instead.)
*/
#ifdef MOCKITO_SHORTHAND
#define verifyCount(mock, mode) MKTVerifyCount(mock, mode)
#endif
OBJC_EXPORT id MKTTimes(NSUInteger wantedNumberOfInvocations);
/**
Verifies exact number of invocations.
Example:
@code
[verifyCount(mockObject, times(2)) someMethod:@"some arg"];
@endcode
(In the event of a name clash, don't \#define @c MOCKITO_SHORTHAND and use the synonym
@c MKTTimes instead.)
*/
#ifdef MOCKITO_SHORTHAND
#define times(wantedNumberOfInvocations) MKTTimes(wantedNumberOfInvocations)
#endif
OBJC_EXPORT id MKTNever(void);
/**
Verifies that interaction did not happen.
Example:
@code
[verifyCount(mockObject, never()) someMethod:@"some arg"];
@endcode
(In the event of a name clash, don't \#define @c MOCKITO_SHORTHAND and use the synonym
@c MKTNever instead.)
*/
#ifdef MOCKITO_SHORTHAND
#define never() MKTNever()
#endif
OBJC_EXPORT id MKTAtLeast(NSUInteger minimumWantedNumberOfInvocations);
/**
Verifies minimum number of invocations.
The verification will succeed if the specified invocation happened the number of times
specified or more.
Example:
@code
[verifyCount(mockObject, atLeast(2)) someMethod:@"some arg"];
@endcode
(In the event of a name clash, don't \#define @c MOCKITO_SHORTHAND and use the synonym
@c MKTAtLeast instead.)
*/
#ifdef MOCKITO_SHORTHAND
#define atLeast(minimumWantedNumberOfInvocations) MKTAtLeast(minimumWantedNumberOfInvocations)
#endif
OBJC_EXPORT id MKTAtLeastOnce(void);
/**
Verifies that interaction happened once or more.
Example:
@code
[verifyCount(mockObject, atLeastOnce()) someMethod:@"some arg"];
@endcode
(In the event of a name clash, don't \#define @c MOCKITO_SHORTHAND and use the synonym
@c MKTAtLeastOnce instead.)
*/
#ifdef MOCKITO_SHORTHAND
#define atLeastOnce() MKTAtLeastOnce()
#endif

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>12C60</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>OCMockitoIOS</string>
<key>CFBundleIdentifier</key>
<string>org.mockito.OCMockitoIOS</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>OCMockitoIOS</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.23</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string></string>
<key>DTPlatformBuild</key>
<string>4G2008a</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>12C37</string>
<key>DTSDKName</key>
<string>macosx10.8</string>
<key>DTXcode</key>
<string>0452</string>
<key>DTXcodeBuild</key>
<string>4G2008a</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2012 Jonathan M. Reid</string>
</dict>
</plist>

View File

@@ -0,0 +1 @@
A

View File

@@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */