├── Contributing.md ├── Contribution ├── Autodesk Form Corp Contrib Agmt for Open Source.docx └── Autodesk Form Ind Contrib Agmt for Open Source.docx ├── LICENSE.md ├── README.md ├── RolloutManager.podspec ├── RolloutManager ├── ADRolloutManager.h ├── ADRolloutManager.m ├── ADRolloutManagerDrawInstance.h └── ADRolloutManagerDrawInstance.m └── sample project ├── Podfile ├── Podfile.lock ├── Pods ├── Headers │ ├── Private │ │ └── OCMock │ │ │ ├── NSInvocation+OCMAdditions.h │ │ │ ├── NSMethodSignature+OCMAdditions.h │ │ │ ├── NSNotificationCenter+OCMAdditions.h │ │ │ ├── NSObject+OCMAdditions.h │ │ │ ├── NSValue+OCMAdditions.h │ │ │ ├── OCClassMockObject.h │ │ │ ├── OCMArg.h │ │ │ ├── OCMArgAction.h │ │ │ ├── OCMBlockArgCaller.h │ │ │ ├── OCMBlockCaller.h │ │ │ ├── OCMBoxedReturnValueProvider.h │ │ │ ├── OCMConstraint.h │ │ │ ├── OCMExceptionReturnValueProvider.h │ │ │ ├── OCMExpectationRecorder.h │ │ │ ├── OCMFunctions.h │ │ │ ├── OCMFunctionsPrivate.h │ │ │ ├── OCMIndirectReturnValueProvider.h │ │ │ ├── OCMInvocationExpectation.h │ │ │ ├── OCMInvocationMatcher.h │ │ │ ├── OCMInvocationStub.h │ │ │ ├── OCMLocation.h │ │ │ ├── OCMMacroState.h │ │ │ ├── OCMNotificationPoster.h │ │ │ ├── OCMObserverRecorder.h │ │ │ ├── OCMPassByRefSetter.h │ │ │ ├── OCMRealObjectForwarder.h │ │ │ ├── OCMRecorder.h │ │ │ ├── OCMReturnValueProvider.h │ │ │ ├── OCMStubRecorder.h │ │ │ ├── OCMVerifier.h │ │ │ ├── OCMock.h │ │ │ ├── OCMockObject.h │ │ │ ├── OCObserverMockObject.h │ │ │ ├── OCPartialMockObject.h │ │ │ └── OCProtocolMockObject.h │ └── Public │ │ └── OCMock │ │ ├── NSNotificationCenter+OCMAdditions.h │ │ ├── OCMArg.h │ │ ├── OCMConstraint.h │ │ ├── OCMFunctions.h │ │ ├── OCMLocation.h │ │ ├── OCMMacroState.h │ │ ├── OCMRecorder.h │ │ ├── OCMStubRecorder.h │ │ ├── OCMock.h │ │ └── OCMockObject.h ├── Manifest.lock ├── OCMock │ ├── License.txt │ ├── README.md │ └── Source │ │ └── OCMock │ │ ├── NSInvocation+OCMAdditions.h │ │ ├── NSInvocation+OCMAdditions.m │ │ ├── NSMethodSignature+OCMAdditions.h │ │ ├── NSMethodSignature+OCMAdditions.m │ │ ├── NSNotificationCenter+OCMAdditions.h │ │ ├── NSNotificationCenter+OCMAdditions.m │ │ ├── NSObject+OCMAdditions.h │ │ ├── NSObject+OCMAdditions.m │ │ ├── NSValue+OCMAdditions.h │ │ ├── NSValue+OCMAdditions.m │ │ ├── OCClassMockObject.h │ │ ├── OCClassMockObject.m │ │ ├── OCMArg.h │ │ ├── OCMArg.m │ │ ├── OCMArgAction.h │ │ ├── OCMArgAction.m │ │ ├── OCMBlockArgCaller.h │ │ ├── OCMBlockArgCaller.m │ │ ├── OCMBlockCaller.h │ │ ├── OCMBlockCaller.m │ │ ├── OCMBoxedReturnValueProvider.h │ │ ├── OCMBoxedReturnValueProvider.m │ │ ├── OCMConstraint.h │ │ ├── OCMConstraint.m │ │ ├── OCMExceptionReturnValueProvider.h │ │ ├── OCMExceptionReturnValueProvider.m │ │ ├── OCMExpectationRecorder.h │ │ ├── OCMExpectationRecorder.m │ │ ├── OCMFunctions.h │ │ ├── OCMFunctions.m │ │ ├── OCMFunctionsPrivate.h │ │ ├── OCMIndirectReturnValueProvider.h │ │ ├── OCMIndirectReturnValueProvider.m │ │ ├── OCMInvocationExpectation.h │ │ ├── OCMInvocationExpectation.m │ │ ├── OCMInvocationMatcher.h │ │ ├── OCMInvocationMatcher.m │ │ ├── OCMInvocationStub.h │ │ ├── OCMInvocationStub.m │ │ ├── OCMLocation.h │ │ ├── OCMLocation.m │ │ ├── OCMMacroState.h │ │ ├── OCMMacroState.m │ │ ├── OCMNotificationPoster.h │ │ ├── OCMNotificationPoster.m │ │ ├── OCMObserverRecorder.h │ │ ├── OCMObserverRecorder.m │ │ ├── OCMPassByRefSetter.h │ │ ├── OCMPassByRefSetter.m │ │ ├── OCMRealObjectForwarder.h │ │ ├── OCMRealObjectForwarder.m │ │ ├── OCMRecorder.h │ │ ├── OCMRecorder.m │ │ ├── OCMReturnValueProvider.h │ │ ├── OCMReturnValueProvider.m │ │ ├── OCMStubRecorder.h │ │ ├── OCMStubRecorder.m │ │ ├── OCMVerifier.h │ │ ├── OCMVerifier.m │ │ ├── OCMock.h │ │ ├── OCMockObject.h │ │ ├── OCMockObject.m │ │ ├── OCObserverMockObject.h │ │ ├── OCObserverMockObject.m │ │ ├── OCPartialMockObject.h │ │ ├── OCPartialMockObject.m │ │ ├── OCProtocolMockObject.h │ │ └── OCProtocolMockObject.m ├── Pods.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ │ └── Zrizi.xcuserdatad │ │ └── xcschemes │ │ ├── OCMock.xcscheme │ │ ├── Pods-RolloutManagerSampleAppTests.xcscheme │ │ └── xcschememanagement.plist └── Target Support Files │ ├── OCMock │ ├── OCMock-dummy.m │ ├── OCMock-prefix.pch │ └── OCMock.xcconfig │ └── Pods-RolloutManagerSampleAppTests │ ├── Pods-RolloutManagerSampleAppTests-acknowledgements.markdown │ ├── Pods-RolloutManagerSampleAppTests-acknowledgements.plist │ ├── Pods-RolloutManagerSampleAppTests-dummy.m │ ├── Pods-RolloutManagerSampleAppTests-frameworks.sh │ ├── Pods-RolloutManagerSampleAppTests-resources.sh │ ├── Pods-RolloutManagerSampleAppTests.debug.xcconfig │ └── Pods-RolloutManagerSampleAppTests.release.xcconfig ├── RolloutManagerSampleApp.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── Zrizi.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── Zrizi.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── RolloutManagerSampleApp.xcworkspace ├── contents.xcworkspacedata ├── xcshareddata │ └── xcschemes │ │ └── RolloutManagerSampleApp.xcscheme └── xcuserdata │ └── Zrizi.xcuserdatad │ ├── UserInterfaceState.xcuserstate │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ └── xcschememanagement.plist ├── RolloutManagerSampleApp ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m └── RolloutManagerSampleAppTests ├── Info.plist └── RolloutManagerSampleAppTests.m /Contributing.md: -------------------------------------------------------------------------------- 1 | ## How To Contribute 2 | 1. Fork the repository 3 | 2. Create your feature branch 4 | 3. Commit and push your work to the feature branch 5 | 4. Create a new Pull Request 6 | 7 | 8 | ## Guidelines 9 | * Please make sure to follow existing conventions and style in order to keep the code as readable as possible. 10 | * Please make sure your changes did not break the unit tests (Text in Xcode with Command + U / Product -> Test) 11 | * Please make sure to comment your changes 12 | * Please make sure to document public API's for other users to understand their purpose 13 | * Please make sure to update the readme file too if needed. 14 | * Try to add unit tests for your changes as well 15 | 16 | 17 | Before your code can be accepted into the project you must also sign the Contributor License Agreement (CLA). 18 | Please contact Asaf Shveki for a copy of the CLA or look in the Contribution folder. 19 | -------------------------------------------------------------------------------- /Contribution/Autodesk Form Corp Contrib Agmt for Open Source.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk/RolloutManager-iOS/0a861df5efaf8604676ad9559f912efb8dcff835/Contribution/Autodesk Form Corp Contrib Agmt for Open Source.docx -------------------------------------------------------------------------------- /Contribution/Autodesk Form Ind Contrib Agmt for Open Source.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk/RolloutManager-iOS/0a861df5efaf8604676ad9559f912efb8dcff835/Contribution/Autodesk Form Ind Contrib Agmt for Open Source.docx -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Autodesk Inc. http://www.autodesk.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rollout Manager 2 | RolloutManager is a component intended to help you roll out your features inside your app by defining variants and setting odds for each of them. 3 | 4 | The component includes many features like stickiness and default values management for your convenience. 5 | 6 | #### Support 7 | - Built for iOS 8 8 | - Tested on iOS 10.1 9 | 10 | ## Installation 11 | #### Cocoapods 12 | In your podfile put this line: 13 | ``` 14 | pod 'RolloutManager' 15 | ``` 16 | 17 | ## Usage 18 | 19 | #### Configuration 20 | ``` 21 | ADRolloutManager* rolloutManagerInstance = [ADRolloutManager new]; 22 | [rolloutManagerInstance setupWithConfiguration:]; 23 | ``` 24 | 25 | #### Usage 26 | ``` 27 | NSString* chosenVariant = [rolloutManagerInstance variantByExperimentId:@"experiment_01" 28 | defaultResult:@"experiment_01_variant_02"]; 29 | ``` 30 | or 31 | ``` 32 | NSString* chosenVariant = [rolloutManagerInstance variantByExperimentId:@"experiment_01" 33 | defaultResult:@"experiment_01_variant_02" 34 | customConditions:nil]; 35 | ``` 36 | 37 | #### Configuration Dictionary Structure 38 | The structure of the configuration dictionary that is consumed by the Rollout Manager consists of sub-dictionaries: 39 | 40 | 1. The experiment level, here we define the experiment unique name 41 | 1. The experiment options: 42 | 1. Settings, at this moment the Rollout Manager supports three options: 43 | 1. is_sticky - receives a YES\NO option. 44 | 1. supported_countries - receives a string of country codes separated by a comma (https://en.wikipedia.org/wiki/ISO_3166-1) 45 | 1. supported_languages - receives a string of languages separated by a comma (https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) 46 | 1. Variants, a dictionary of the variants names and their weights. 47 | 48 | **How does the Rollout Manager calculate it weights?** 49 | 50 | *Answer: Every experiment has variants with weights, the algorithm summarizes the weights and for each variant divide it's own weight with the summary of the experiment's weights. This defines the odds for the specific variant.* 51 | 52 | ``` 53 | // A configuration dictionary example 54 | NSDictionary* configuration = @{@"experiment_01":@{@"Settings":@{@"is_sticky":@(YES), 55 | @"supported_countries":@"US,IL", 56 | @"supported_languages":@"en,he"}, 57 | @"Variants":@{@"variant_01":@(70), 58 | @"variant_02":@(30)}}, 59 | @"experiment_02":@{@"Settings":@{@"is_sticky":@(NO), 60 | @"supported_languages":@"en,he"}}, 61 | @"Variants":@{@"variant_01":@(0), 62 | @"variant_02":@(100)}}}; 63 | ``` 64 | 65 | **The recommended way to create the dictionary is by using a local \ remote plist object!** 66 | 67 | 68 | ## Features Explanation 69 | 70 | #### The Features 71 | 1. Feature Rollout – distribute a feature to a specific percentage of users. 72 | For instance, you may release a feature only to 10% of the users, then change it to 40% and then to 100%. 73 | 74 | 2. Multiple variants support – you may roll out multiple features and set their allocation as well 75 | For instance, you can decide to release 3 different features to your users and decide what percentage of the users will get each of them. 76 | 77 | 3. Stickiness support – once a user got an experiment we can configure that he will get the same variant permanently until we delete the experiment. 78 | For instance, in case a user got the Variant A, he will keep getting it even if we change the allocation later. 79 | 80 | 4. Remote control – our Rollout Manager is controllable from a configuration file who is located on our S3 server. 81 | An example of usage – you may change the allocation of the variants you have set even after the app has been submitted to the store. 82 | 83 | 5. Remote filtering - it is possible to remotely control on which users will get an experiment. 84 | For instance, you may decide that you want the variants to be rolled only for english speakers from Canada. 85 | 86 | 6. Custom conditioning - any developer can add his own conditions for an experiment 87 | For example, if you want to check your user's permission level as a condition to get a value from an experiment. 88 | 89 | #### Edge Cases 90 | - Changing the allocation while the experiment is marked as sticky will not effect the users who already received the experiment, only new users. 91 | - Changing the allocation while the experiment is marked as non-sticky might change the current variants for users. 92 | - Changing from sticky experiment to a non-sticky will cancel the stickiness, a user that got a variant in the past might get a different variant after the change. 93 | - Changing from non-sticky experiment to a sticky experiment will just make the current users who got a variant to remain sticky even if we change the variant allocation 94 | - Deleting an experiment from S3 will force the default value for the occurrences of the experiment in the code 95 | - A user that has eliminated from the experiment due to a remote filter will receive the default value you indicate in the code. 96 | - When removing an existing variant from an experiment, although the experiment stated as sticky, we will draw the user again to a different variant. 97 | 98 | 99 | ## Contributing 100 | See [Contributing](./Contributing.md) page. 101 | 102 | 103 | ## Contact 104 | [Asaf Shveki](https://github.com/shvekiasaf) 105 | 106 | 107 | ## Good Luck! 108 | Let the AutoCAD Mobile team know if you need any further explanation :innocent:. 109 | 110 | And of course, submit issues if you have any idea for improvements. 111 | 112 | -------------------------------------------------------------------------------- /RolloutManager.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = "RolloutManager" 4 | s.version = "0.2.4" 5 | s.summary = "AutoCAD Mobile component that rollout features gradualy" 6 | s.homepage = "http://www.autodesk.com" 7 | s.license = { :type => "MIT", :file => "LICENCE.md" } 8 | s.author = { "Asaf Shveki" => "asaf.shveki@autodesk.com" } 9 | s.source = { :git => "https://github.com/Autodesk/RolloutManager-iOS.git", :tag => '0.2.4' } 10 | s.platform = :ios, '8.0' 11 | s.source_files = 'RolloutManager/**/*.{h,m}' 12 | s.frameworks = 'Foundation' 13 | s.requires_arc = true 14 | 15 | end 16 | -------------------------------------------------------------------------------- /RolloutManager/ADRolloutManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // ADRolloutManager.h 3 | // AD360Helpers-iOS 4 | // 5 | // Created by Itai Shayovitz on 26/09/2016. 6 | // Copyright © 2016 Autodesk. All rights reserved. 7 | // 8 | #ifndef AD_ROLLOUT_MANAGER_H 9 | #define AD_ROLLOUT_MANAGER_H 10 | 11 | #import 12 | 13 | @interface ADRolloutManager : NSObject 14 | 15 | - (void)setupWithConfiguration:(NSDictionary*)confDictionary; 16 | 17 | - (void)setupWithConfiguration:(NSDictionary*)confDictionary 18 | userDefaults:(NSUserDefaults*) userDefaults 19 | userPreferedLanguage:(NSString*)preferedLanguage 20 | userCurrentLocale:(NSLocale*)userLocale; 21 | 22 | /** 23 | * @brief Return a random variant for requested feature, according to configured percents 24 | * @discussion The user will be allocated a variant only if the feature is active. Otherwise the `defaultResult` will be returned 25 | * @param experimentId The id as it's appear in the configuration dictionary 26 | * @param defaultResult The default result in case the experiment conditions aren't met: 27 | * * Experiment doesn't exist 28 | * * custom conditions are met 29 | * * remote conditions (filtering) are met 30 | * @return Variant name concatinated to experiment name 31 | */ 32 | - (NSString*)variantByExperimentId:(NSString*)experimentId defaultResult:(NSString*)defaultResult; 33 | 34 | 35 | /** 36 | * @brief Return a random variant for requested feature, according to configured percents 37 | * @discussion The user will be allocated a variant only if the feature is active. Otherwise the `defaultResult` will be returned 38 | * @param experimentId The id as it's appear in the configuration dictionary 39 | * @param defaultResult The default result in case the experiment conditions aren't met: 40 | * * Experiment doesn't exist 41 | * * custom conditions are met 42 | * * remote conditions (filtering) are met 43 | * @param customConditionsBlock Custom conditions block you may use to enter limits for getting into the experiment 44 | * @return Variant name concatinated to experiment name 45 | */ 46 | - (NSString*)variantByExperimentId:(NSString*)experimentId defaultResult:(NSString*)defaultResult customConditions:(BOOL (^)())customConditionsBlock; 47 | 48 | - (void)removeExperimentDrawIfExisted:(NSString*)experimentId; 49 | 50 | @end 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /RolloutManager/ADRolloutManagerDrawInstance.h: -------------------------------------------------------------------------------- 1 | // 2 | // ADRolloutManagerDrawInstance.h 3 | // AD360Helpers-iOS 4 | // 5 | // Created by Asaf Shveki on 08/11/2016. 6 | // Copyright © 2016 Autodesk. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ADRolloutManagerDrawInstance : NSObject 12 | 13 | @property (nonatomic, strong) NSString* chosenVariant; 14 | @property (nonatomic, strong) NSNumber* randomNumber; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /RolloutManager/ADRolloutManagerDrawInstance.m: -------------------------------------------------------------------------------- 1 | // 2 | // ADRolloutManagerDrawInstance.m 3 | // AD360Helpers-iOS 4 | // 5 | // Created by Asaf Shveki on 08/11/2016. 6 | // Copyright © 2016 Autodesk. All rights reserved. 7 | // 8 | 9 | #import "ADRolloutManagerDrawInstance.h" 10 | 11 | @implementation ADRolloutManagerDrawInstance 12 | @end 13 | -------------------------------------------------------------------------------- /sample project/Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs.git' 2 | 3 | platform :ios, ‘8.0’ 4 | inhibit_all_warnings! 5 | 6 | target 'RolloutManagerSampleAppTests' do 7 | pod 'OCMock' 8 | end 9 | 10 | -------------------------------------------------------------------------------- /sample project/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - OCMock (3.3.1) 3 | 4 | DEPENDENCIES: 5 | - OCMock 6 | 7 | SPEC CHECKSUMS: 8 | OCMock: f3f61e6eaa16038c30caa5798c5e49d3307b6f22 9 | 10 | PODFILE CHECKSUM: 914add0a200eaa8b87e14f2e05733f13617271f0 11 | 12 | COCOAPODS: 1.1.1 13 | -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/NSInvocation+OCMAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/NSInvocation+OCMAdditions.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/NSMethodSignature+OCMAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/NSMethodSignature+OCMAdditions.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/NSNotificationCenter+OCMAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/NSNotificationCenter+OCMAdditions.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/NSObject+OCMAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/NSObject+OCMAdditions.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/NSValue+OCMAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/NSValue+OCMAdditions.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCClassMockObject.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCClassMockObject.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMArg.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMArg.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMArgAction.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMArgAction.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMBlockArgCaller.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMBlockArgCaller.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMBlockCaller.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMBlockCaller.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMBoxedReturnValueProvider.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMBoxedReturnValueProvider.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMConstraint.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMExceptionReturnValueProvider.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMExceptionReturnValueProvider.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMExpectationRecorder.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMExpectationRecorder.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMFunctions.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMFunctions.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMFunctionsPrivate.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMFunctionsPrivate.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMIndirectReturnValueProvider.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMIndirectReturnValueProvider.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMInvocationExpectation.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMInvocationExpectation.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMInvocationMatcher.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMInvocationMatcher.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMInvocationStub.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMInvocationStub.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMLocation.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMLocation.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMMacroState.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMMacroState.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMNotificationPoster.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMNotificationPoster.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMObserverRecorder.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMObserverRecorder.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMPassByRefSetter.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMPassByRefSetter.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMRealObjectForwarder.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMRealObjectForwarder.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMRecorder.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMRecorder.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMReturnValueProvider.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMReturnValueProvider.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMStubRecorder.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMStubRecorder.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMVerifier.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMVerifier.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMock.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMock.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCMockObject.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMockObject.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCObserverMockObject.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCObserverMockObject.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCPartialMockObject.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCPartialMockObject.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Private/OCMock/OCProtocolMockObject.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCProtocolMockObject.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Public/OCMock/NSNotificationCenter+OCMAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/NSNotificationCenter+OCMAdditions.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Public/OCMock/OCMArg.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMArg.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Public/OCMock/OCMConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMConstraint.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Public/OCMock/OCMFunctions.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMFunctions.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Public/OCMock/OCMLocation.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMLocation.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Public/OCMock/OCMMacroState.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMMacroState.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Public/OCMock/OCMRecorder.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMRecorder.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Public/OCMock/OCMStubRecorder.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMStubRecorder.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Public/OCMock/OCMock.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMock.h -------------------------------------------------------------------------------- /sample project/Pods/Headers/Public/OCMock/OCMockObject.h: -------------------------------------------------------------------------------- 1 | ../../../OCMock/Source/OCMock/OCMockObject.h -------------------------------------------------------------------------------- /sample project/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - OCMock (3.3.1) 3 | 4 | DEPENDENCIES: 5 | - OCMock 6 | 7 | SPEC CHECKSUMS: 8 | OCMock: f3f61e6eaa16038c30caa5798c5e49d3307b6f22 9 | 10 | PODFILE CHECKSUM: 914add0a200eaa8b87e14f2e05733f13617271f0 11 | 12 | COCOAPODS: 1.1.1 13 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/License.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/README.md: -------------------------------------------------------------------------------- 1 | OCMock 2 | ====== 3 | 4 | OCMock is an Objective-C implementation of mock objects. 5 | 6 | For downloads, documentation, and support please visit [ocmock.org][]. 7 | 8 | [![Build Status](https://travis-ci.org/erikdoe/ocmock.svg?branch=master)](https://travis-ci.org/erikdoe/ocmock) 9 | 10 | [ocmock.org]: http://ocmock.org/ 11 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/NSInvocation+OCMAdditions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface NSInvocation(OCMAdditions) 20 | 21 | + (NSInvocation *)invocationForBlock:(id)block withArguments:(NSArray *)arguments; 22 | 23 | - (void)retainObjectArgumentsExcludingObject:(id)objectToExclude; 24 | 25 | - (id)getArgumentAtIndexAsObject:(NSInteger)argIndex; 26 | 27 | - (NSString *)invocationDescription; 28 | 29 | - (NSString *)argumentDescriptionAtIndex:(NSInteger)argIndex; 30 | 31 | - (NSString *)objectDescriptionAtIndex:(NSInteger)anInt; 32 | - (NSString *)charDescriptionAtIndex:(NSInteger)anInt; 33 | - (NSString *)unsignedCharDescriptionAtIndex:(NSInteger)anInt; 34 | - (NSString *)intDescriptionAtIndex:(NSInteger)anInt; 35 | - (NSString *)unsignedIntDescriptionAtIndex:(NSInteger)anInt; 36 | - (NSString *)shortDescriptionAtIndex:(NSInteger)anInt; 37 | - (NSString *)unsignedShortDescriptionAtIndex:(NSInteger)anInt; 38 | - (NSString *)longDescriptionAtIndex:(NSInteger)anInt; 39 | - (NSString *)unsignedLongDescriptionAtIndex:(NSInteger)anInt; 40 | - (NSString *)longLongDescriptionAtIndex:(NSInteger)anInt; 41 | - (NSString *)unsignedLongLongDescriptionAtIndex:(NSInteger)anInt; 42 | - (NSString *)doubleDescriptionAtIndex:(NSInteger)anInt; 43 | - (NSString *)floatDescriptionAtIndex:(NSInteger)anInt; 44 | - (NSString *)structDescriptionAtIndex:(NSInteger)anInt; 45 | - (NSString *)pointerDescriptionAtIndex:(NSInteger)anInt; 46 | - (NSString *)cStringDescriptionAtIndex:(NSInteger)anInt; 47 | - (NSString *)selectorDescriptionAtIndex:(NSInteger)anInt; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/NSMethodSignature+OCMAdditions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface NSMethodSignature(OCMAdditions) 20 | 21 | + (NSMethodSignature *)signatureForDynamicPropertyAccessedWithSelector:(SEL)selector inClass:(Class)aClass; 22 | + (NSMethodSignature *)signatureForBlock:(id)block; 23 | 24 | - (BOOL)usesSpecialStructureReturn; 25 | 26 | - (NSString *)fullTypeString; 27 | - (const char *)fullObjCTypes; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/NSMethodSignature+OCMAdditions.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "NSMethodSignature+OCMAdditions.h" 18 | #import "OCMFunctionsPrivate.h" 19 | #import 20 | 21 | 22 | @implementation NSMethodSignature(OCMAdditions) 23 | 24 | #pragma mark Signatures for dynamic properties 25 | 26 | + (NSMethodSignature *)signatureForDynamicPropertyAccessedWithSelector:(SEL)selector inClass:(Class)aClass 27 | { 28 | BOOL isGetter = YES; 29 | objc_property_t property = [self propertyMatchingSelector:selector inClass:aClass isGetter:&isGetter]; 30 | if(property == NULL) 31 | return nil; 32 | 33 | const char *propertyAttributesString = property_getAttributes(property); 34 | NSArray *propertyAttributes = [[NSString stringWithCString:propertyAttributesString 35 | encoding:NSASCIIStringEncoding] componentsSeparatedByString:@","]; 36 | NSString *typeStr = nil; 37 | BOOL isDynamic = NO; 38 | for(NSString *attribute in propertyAttributes) 39 | { 40 | if([attribute isEqualToString:@"D"]) 41 | isDynamic = YES; 42 | else if([attribute hasPrefix:@"T"]) 43 | typeStr = [attribute substringFromIndex:1]; 44 | } 45 | 46 | if(!isDynamic) 47 | return nil; 48 | 49 | NSRange r = [typeStr rangeOfString:@"\""]; // incomplete workaround to deal with structs 50 | if(r.location != NSNotFound) 51 | typeStr = [typeStr substringToIndex:r.location]; 52 | 53 | NSString *sigStringFormat = isGetter ? @"%@@:" : @"v@:%@"; 54 | const char *sigCString = [[NSString stringWithFormat:sigStringFormat, typeStr] cStringUsingEncoding:NSASCIIStringEncoding]; 55 | return [NSMethodSignature signatureWithObjCTypes:sigCString]; 56 | } 57 | 58 | 59 | + (objc_property_t)propertyMatchingSelector:(SEL)selector inClass:(Class)aClass isGetter:(BOOL *)isGetterPtr 60 | { 61 | NSString *propertyName = NSStringFromSelector(selector); 62 | 63 | // first try selector as is aassuming it's a getter 64 | objc_property_t property = class_getProperty(aClass, [propertyName cStringUsingEncoding:NSASCIIStringEncoding]); 65 | if(property != NULL) 66 | { 67 | *isGetterPtr = YES; 68 | return property; 69 | } 70 | 71 | // try setter next if selector starts with "set" 72 | if([propertyName hasPrefix:@"set"]) 73 | { 74 | propertyName = [propertyName substringFromIndex:@"set".length]; 75 | propertyName = [propertyName stringByReplacingCharactersInRange:NSMakeRange(0, 1) withString:[[propertyName substringToIndex:1] lowercaseString]]; 76 | if([propertyName hasSuffix:@":"]) 77 | propertyName = [propertyName substringToIndex:[propertyName length] - 1]; 78 | 79 | property = class_getProperty(aClass, [propertyName cStringUsingEncoding:NSASCIIStringEncoding]); 80 | if(property != NULL) 81 | { 82 | *isGetterPtr = NO; 83 | return property; 84 | } 85 | } 86 | 87 | // search through properties with custom getter/setter that corresponds to selector 88 | unsigned int propertiesCount = 0; 89 | objc_property_t *allProperties = class_copyPropertyList(aClass, &propertiesCount); 90 | for(unsigned int i = 0 ; i < propertiesCount; i++) 91 | { 92 | NSArray *propertyAttributes = [[NSString stringWithCString:property_getAttributes(allProperties[i]) 93 | encoding:NSASCIIStringEncoding] componentsSeparatedByString:@","]; 94 | for(NSString *attribute in propertyAttributes) 95 | { 96 | if(([attribute hasPrefix:@"G"] || [attribute hasPrefix:@"S"]) && 97 | [[attribute substringFromIndex:1] isEqualToString:propertyName]) 98 | { 99 | *isGetterPtr = ![attribute hasPrefix:@"S"]; 100 | property = allProperties[i]; 101 | i = propertiesCount; 102 | break; 103 | } 104 | } 105 | } 106 | free(allProperties); 107 | 108 | return property; 109 | } 110 | 111 | 112 | #pragma mark Signatures for blocks 113 | 114 | struct OCMBlockDef 115 | { 116 | void *isa; // initialized to &_NSConcreteStackBlock or &_NSConcreteGlobalBlock 117 | int flags; 118 | int reserved; 119 | void (*invoke)(void *, ...); 120 | struct block_descriptor { 121 | unsigned long int reserved; // NULL 122 | unsigned long int size; // sizeof(struct Block_literal_1) 123 | // optional helper functions 124 | void (*copy_helper)(void *dst, void *src); // IFF (1<<25) 125 | void (*dispose_helper)(void *src); // IFF (1<<25) 126 | // required ABI.2010.3.16 127 | const char *signature; // IFF (1<<30) 128 | } *descriptor; 129 | }; 130 | 131 | enum 132 | { 133 | OCMBlockDescriptionFlagsHasCopyDispose = (1 << 25), 134 | OCMBlockDescriptionFlagsHasSignature = (1 << 30) 135 | }; 136 | 137 | 138 | + (NSMethodSignature *)signatureForBlock:(id)block 139 | { 140 | /* For a more complete implementation of parsing the block data structure see: 141 | * 142 | * https://github.com/ebf/CTObjectiveCRuntimeAdditions/tree/master/CTObjectiveCRuntimeAdditions/CTObjectiveCRuntimeAdditions 143 | */ 144 | 145 | struct OCMBlockDef *blockRef = (__bridge struct OCMBlockDef *)block; 146 | 147 | if(!(blockRef->flags & OCMBlockDescriptionFlagsHasSignature)) 148 | return nil; 149 | 150 | void *signatureLocation = blockRef->descriptor; 151 | signatureLocation += sizeof(unsigned long int); 152 | signatureLocation += sizeof(unsigned long int); 153 | if(blockRef->flags & OCMBlockDescriptionFlagsHasCopyDispose) 154 | { 155 | signatureLocation += sizeof(void(*)(void *dst, void *src)); 156 | signatureLocation += sizeof(void (*)(void *src)); 157 | } 158 | 159 | const char *signature = (*(const char **)signatureLocation); 160 | return [NSMethodSignature signatureWithObjCTypes:signature]; 161 | } 162 | 163 | 164 | #pragma mark Extended attributes 165 | 166 | - (BOOL)usesSpecialStructureReturn 167 | { 168 | const char *types = OCMTypeWithoutQualifiers([self methodReturnType]); 169 | 170 | if((types == NULL) || (types[0] != '{')) 171 | return NO; 172 | 173 | /* In some cases structures are returned by ref. The rules are complex and depend on the 174 | architecture, see: 175 | 176 | http://sealiesoftware.com/blog/archive/2008/10/30/objc_explain_objc_msgSend_stret.html 177 | http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/LowLevelABI/000-Introduction/introduction.html 178 | https://github.com/atgreen/libffi/blob/master/src/x86/ffi64.c 179 | http://www.uclibc.org/docs/psABI-x86_64.pdf 180 | http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042e/IHI0042E_aapcs.pdf 181 | 182 | NSMethodSignature knows the details but has no API to return it, though it is in 183 | the debugDescription. Horribly kludgy. 184 | */ 185 | NSRange range = [[self debugDescription] rangeOfString:@"is special struct return? YES"]; 186 | return range.length > 0; 187 | } 188 | 189 | 190 | - (NSString *)fullTypeString 191 | { 192 | NSMutableString *typeString = [NSMutableString string]; 193 | [typeString appendFormat:@"%s", [self methodReturnType]]; 194 | for (NSUInteger i=0; i<[self numberOfArguments]; i++) 195 | [typeString appendFormat:@"%s", [self getArgumentTypeAtIndex:i]]; 196 | return typeString; 197 | } 198 | 199 | 200 | - (const char *)fullObjCTypes 201 | { 202 | return [[self fullTypeString] UTF8String]; 203 | } 204 | 205 | @end 206 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/NSNotificationCenter+OCMAdditions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @class OCObserverMockObject; 20 | 21 | 22 | @interface NSNotificationCenter(OCMAdditions) 23 | 24 | - (void)addMockObserver:(OCObserverMockObject *)notificationObserver name:(NSString *)notificationName object:(id)notificationSender; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/NSNotificationCenter+OCMAdditions.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "NSNotificationCenter+OCMAdditions.h" 18 | #import "OCObserverMockObject.h" 19 | 20 | 21 | @implementation NSNotificationCenter(OCMAdditions) 22 | 23 | - (void)addMockObserver:(OCObserverMockObject *)notificationObserver name:(NSString *)notificationName object:(id)notificationSender 24 | { 25 | [notificationObserver autoRemoveFromCenter:self]; 26 | [self addObserver:notificationObserver selector:@selector(handleNotification:) name:notificationName object:notificationSender]; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/NSObject+OCMAdditions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface NSObject(OCMAdditions) 20 | 21 | + (IMP)instanceMethodForwarderForSelector:(SEL)aSelector; 22 | + (void)enumerateMethodsInClass:(Class)aClass usingBlock:(void (^)(Class cls, SEL sel))aBlock; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/NSObject+OCMAdditions.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "NSObject+OCMAdditions.h" 18 | #import "NSMethodSignature+OCMAdditions.h" 19 | #import 20 | 21 | @implementation NSObject(OCMAdditions) 22 | 23 | + (IMP)instanceMethodForwarderForSelector:(SEL)aSelector 24 | { 25 | // use sel_registerName() and not @selector to avoid warning 26 | SEL selectorWithNoImplementation = sel_registerName("methodWhichMustNotExist::::"); 27 | 28 | #ifndef __arm64__ 29 | static NSMutableDictionary *_OCMReturnTypeCache; 30 | 31 | if(_OCMReturnTypeCache == nil) 32 | _OCMReturnTypeCache = [[NSMutableDictionary alloc] init]; 33 | 34 | BOOL needsStructureReturn; 35 | void *rawCacheKey[2] = { (void *)self, aSelector }; 36 | NSData *cacheKey = [NSData dataWithBytes:rawCacheKey length:sizeof(rawCacheKey)]; 37 | NSNumber *cachedValue = [_OCMReturnTypeCache objectForKey:cacheKey]; 38 | 39 | if(cachedValue == nil) 40 | { 41 | NSMethodSignature *sig = [self instanceMethodSignatureForSelector:aSelector]; 42 | needsStructureReturn = [sig usesSpecialStructureReturn]; 43 | [_OCMReturnTypeCache setObject:@(needsStructureReturn) forKey:cacheKey]; 44 | } 45 | else 46 | { 47 | needsStructureReturn = [cachedValue boolValue]; 48 | } 49 | 50 | if(needsStructureReturn) 51 | return class_getMethodImplementation_stret([NSObject class], selectorWithNoImplementation); 52 | #endif 53 | 54 | return class_getMethodImplementation([NSObject class], selectorWithNoImplementation); 55 | } 56 | 57 | 58 | + (void)enumerateMethodsInClass:(Class)aClass usingBlock:(void (^)(Class cls, SEL sel))aBlock 59 | { 60 | for(Class cls = aClass; cls != nil; cls = class_getSuperclass(cls)) 61 | { 62 | Method *methodList = class_copyMethodList(cls, NULL); 63 | if(methodList == NULL) 64 | continue; 65 | 66 | for(Method *mPtr = methodList; *mPtr != NULL; mPtr++) 67 | { 68 | SEL sel = method_getName(*mPtr); 69 | aBlock(cls, sel); 70 | } 71 | free(methodList); 72 | } 73 | } 74 | 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/NSValue+OCMAdditions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface NSValue(OCMAdditions) 20 | 21 | - (BOOL)getBytes:(void *)outputBuf objCType:(const char *)targetType; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/NSValue+OCMAdditions.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "NSValue+OCMAdditions.h" 18 | #import "OCMFunctionsPrivate.h" 19 | 20 | @implementation NSValue(OCMAdditions) 21 | 22 | static NSNumber *OCMNumberForValue(NSValue *value) 23 | { 24 | #define CREATE_NUM(_type) ({ _type _v; [value getValue:&_v]; @(_v); }) 25 | switch([value objCType][0]) 26 | { 27 | case 'c': return CREATE_NUM(char); 28 | case 'C': return CREATE_NUM(unsigned char); 29 | case 'B': return CREATE_NUM(bool); 30 | case 's': return CREATE_NUM(short); 31 | case 'S': return CREATE_NUM(unsigned short); 32 | case 'i': return CREATE_NUM(int); 33 | case 'I': return CREATE_NUM(unsigned int); 34 | case 'l': return CREATE_NUM(long); 35 | case 'L': return CREATE_NUM(unsigned long); 36 | case 'q': return CREATE_NUM(long long); 37 | case 'Q': return CREATE_NUM(unsigned long long); 38 | case 'f': return CREATE_NUM(float); 39 | case 'd': return CREATE_NUM(double); 40 | default: return nil; 41 | } 42 | } 43 | 44 | 45 | - (BOOL)getBytes:(void *)outputBuf objCType:(const char *)targetType 46 | { 47 | /* 48 | * See if they are similar number types, and if we can convert losslessly between them. 49 | * For the most part, we set things up to use CFNumberGetValue, which returns false if 50 | * conversion will be lossy. 51 | */ 52 | CFNumberType inputType = OCMNumberTypeForObjCType([self objCType]); 53 | CFNumberType outputType = OCMNumberTypeForObjCType(targetType); 54 | 55 | if(inputType == 0 || outputType == 0) // one or both are non-number types 56 | return NO; 57 | 58 | NSNumber *inputNumber = [self isKindOfClass:[NSNumber class]] ? (NSNumber *)self : OCMNumberForValue(self); 59 | 60 | /* 61 | * Due to some legacy, back-compatible requirements in CFNumber.c, CFNumberGetValue can return true for 62 | * some conversions which should not be allowed (by reading source, conversions from integer types to 63 | * 8-bit or 16-bit integer types). So, check ourselves. 64 | */ 65 | long long min; 66 | long long max; 67 | long long val = [inputNumber longLongValue]; 68 | switch(targetType[0]) 69 | { 70 | case 'B': 71 | case 'c': min = CHAR_MIN; max = CHAR_MAX; break; 72 | case 'C': min = 0; max = UCHAR_MAX; break; 73 | case 's': min = SHRT_MIN; max = SHRT_MAX; break; 74 | case 'S': min = 0; max = USHRT_MAX; break; 75 | default: min = LLONG_MIN; max = LLONG_MAX; break; 76 | } 77 | if(val < min || val > max) 78 | return NO; 79 | 80 | /* Get the number, and return NO if the value was out of range or conversion was lossy */ 81 | return CFNumberGetValue((CFNumberRef)inputNumber, outputType, outputBuf); 82 | } 83 | 84 | 85 | @end 86 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCClassMockObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCClassMockObject : OCMockObject 20 | { 21 | Class mockedClass; 22 | Class originalMetaClass; 23 | } 24 | 25 | - (id)initWithClass:(Class)aClass; 26 | 27 | - (Class)mockedClass; 28 | - (Class)mockObjectClass; // since -class returns the mockedClass 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCClassMockObject.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import "OCClassMockObject.h" 19 | #import "NSObject+OCMAdditions.h" 20 | #import "OCMFunctionsPrivate.h" 21 | #import "OCMInvocationStub.h" 22 | #import "NSMethodSignature+OCMAdditions.h" 23 | 24 | @implementation OCClassMockObject 25 | 26 | #pragma mark Initialisers, description, accessors, etc. 27 | 28 | - (id)initWithClass:(Class)aClass 29 | { 30 | NSParameterAssert(aClass != nil); 31 | [super init]; 32 | mockedClass = aClass; 33 | [self prepareClassForClassMethodMocking]; 34 | return self; 35 | } 36 | 37 | - (void)dealloc 38 | { 39 | [self stopMocking]; 40 | [super dealloc]; 41 | } 42 | 43 | - (NSString *)description 44 | { 45 | return [NSString stringWithFormat:@"OCMockObject(%@)", NSStringFromClass(mockedClass)]; 46 | } 47 | 48 | - (Class)mockedClass 49 | { 50 | return mockedClass; 51 | } 52 | 53 | #pragma mark Extending/overriding superclass behaviour 54 | 55 | - (void)stopMocking 56 | { 57 | if(originalMetaClass != nil) 58 | { 59 | /* The mocked class has the meta class of a dynamically created subclass as its meta class, 60 | but we need a reference to the subclass to dispose it. Asking the meta class for its 61 | class name returns the actual class name, which we can then use to look up the class... 62 | */ 63 | const char *createdSubclassName = object_getClassName(mockedClass); 64 | Class createdSubclass = objc_lookUpClass(createdSubclassName); 65 | 66 | [self restoreMetaClass]; 67 | 68 | objc_disposeClassPair(createdSubclass); 69 | } 70 | [super stopMocking]; 71 | } 72 | 73 | - (void)restoreMetaClass 74 | { 75 | OCMSetAssociatedMockForClass(nil, mockedClass); 76 | object_setClass(mockedClass, originalMetaClass); 77 | originalMetaClass = nil; 78 | } 79 | 80 | - (void)addStub:(OCMInvocationStub *)aStub 81 | { 82 | [super addStub:aStub]; 83 | if([aStub recordedAsClassMethod]) 84 | [self setupForwarderForClassMethodSelector:[[aStub recordedInvocation] selector]]; 85 | } 86 | 87 | 88 | #pragma mark Class method mocking 89 | 90 | - (void)prepareClassForClassMethodMocking 91 | { 92 | /* the runtime and OCMock depend on string and array; we don't intercept methods on them to avoid endless loops */ 93 | if([[mockedClass class] isSubclassOfClass:[NSString class]] || [[mockedClass class] isSubclassOfClass:[NSArray class]]) 94 | return; 95 | 96 | /* if there is another mock for this exact class, stop it */ 97 | id otherMock = OCMGetAssociatedMockForClass(mockedClass, NO); 98 | if(otherMock != nil) 99 | [otherMock restoreMetaClass]; 100 | 101 | OCMSetAssociatedMockForClass(self, mockedClass); 102 | 103 | /* dynamically create a subclass and use its meta class as the meta class for the mocked class */ 104 | Class subclass = OCMCreateSubclass(mockedClass, mockedClass); 105 | originalMetaClass = object_getClass(mockedClass); 106 | id newMetaClass = object_getClass(subclass); 107 | 108 | /* create a dummy initialize method */ 109 | Method myDummyInitializeMethod = class_getInstanceMethod([self mockObjectClass], @selector(initializeForClassObject)); 110 | const char *initializeTypes = method_getTypeEncoding(myDummyInitializeMethod); 111 | IMP myDummyInitializeIMP = method_getImplementation(myDummyInitializeMethod); 112 | class_addMethod(newMetaClass, @selector(initialize), myDummyInitializeIMP, initializeTypes); 113 | 114 | object_setClass(mockedClass, newMetaClass); // only after dummy initialize is installed (iOS9) 115 | 116 | /* point forwardInvocation: of the object to the implementation in the mock */ 117 | Method myForwardMethod = class_getInstanceMethod([self mockObjectClass], @selector(forwardInvocationForClassObject:)); 118 | IMP myForwardIMP = method_getImplementation(myForwardMethod); 119 | class_addMethod(newMetaClass, @selector(forwardInvocation:), myForwardIMP, method_getTypeEncoding(myForwardMethod)); 120 | 121 | 122 | /* adding forwarder for most class methods (instance methods on meta class) to allow for verify after run */ 123 | NSArray *methodBlackList = @[@"class", @"forwardingTargetForSelector:", @"methodSignatureForSelector:", @"forwardInvocation:", @"isBlock", 124 | @"instanceMethodForwarderForSelector:", @"instanceMethodSignatureForSelector:"]; 125 | [NSObject enumerateMethodsInClass:originalMetaClass usingBlock:^(Class cls, SEL sel) { 126 | if((cls == object_getClass([NSObject class])) || (cls == [NSObject class]) || (cls == object_getClass(cls))) 127 | return; 128 | NSString *className = NSStringFromClass(cls); 129 | NSString *selName = NSStringFromSelector(sel); 130 | if(([className hasPrefix:@"NS"] || [className hasPrefix:@"UI"]) && 131 | ([selName hasPrefix:@"_"] || [selName hasSuffix:@"_"])) 132 | return; 133 | if([methodBlackList containsObject:selName]) 134 | return; 135 | @try 136 | { 137 | [self setupForwarderForClassMethodSelector:sel]; 138 | } 139 | @catch(NSException *e) 140 | { 141 | // ignore for now 142 | } 143 | }]; 144 | } 145 | 146 | - (void)setupForwarderForClassMethodSelector:(SEL)selector 147 | { 148 | SEL aliasSelector = OCMAliasForOriginalSelector(selector); 149 | if(class_getClassMethod(mockedClass, aliasSelector) != NULL) 150 | return; 151 | 152 | Method originalMethod = class_getClassMethod(mockedClass, selector); 153 | IMP originalIMP = method_getImplementation(originalMethod); 154 | const char *types = method_getTypeEncoding(originalMethod); 155 | 156 | Class metaClass = object_getClass(mockedClass); 157 | IMP forwarderIMP = [originalMetaClass instanceMethodForwarderForSelector:selector]; 158 | class_replaceMethod(metaClass, selector, forwarderIMP, types); 159 | class_addMethod(metaClass, aliasSelector, originalIMP, types); 160 | } 161 | 162 | 163 | - (void)forwardInvocationForClassObject:(NSInvocation *)anInvocation 164 | { 165 | // in here "self" is a reference to the real class, not the mock 166 | OCClassMockObject *mock = OCMGetAssociatedMockForClass((Class) self, YES); 167 | if(mock == nil) 168 | { 169 | [NSException raise:NSInternalInconsistencyException format:@"No mock for class %@", NSStringFromClass((Class)self)]; 170 | } 171 | if([mock handleInvocation:anInvocation] == NO) 172 | { 173 | [anInvocation setSelector:OCMAliasForOriginalSelector([anInvocation selector])]; 174 | [anInvocation invoke]; 175 | } 176 | } 177 | 178 | - (void)initializeForClassObject 179 | { 180 | // we really just want to have an implementation so that the superclass's is not called 181 | } 182 | 183 | 184 | #pragma mark Proxy API 185 | 186 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector 187 | { 188 | NSMethodSignature *signature = [mockedClass instanceMethodSignatureForSelector:aSelector]; 189 | if(signature == nil) 190 | { 191 | signature = [NSMethodSignature signatureForDynamicPropertyAccessedWithSelector:aSelector inClass:mockedClass]; 192 | } 193 | return signature; 194 | } 195 | 196 | - (Class)mockObjectClass 197 | { 198 | return [super class]; 199 | } 200 | 201 | - (Class)class 202 | { 203 | return mockedClass; 204 | } 205 | 206 | - (BOOL)respondsToSelector:(SEL)selector 207 | { 208 | return [mockedClass instancesRespondToSelector:selector]; 209 | } 210 | 211 | - (BOOL)isKindOfClass:(Class)aClass 212 | { 213 | return [mockedClass isSubclassOfClass:aClass]; 214 | } 215 | 216 | - (BOOL)conformsToProtocol:(Protocol *)aProtocol 217 | { 218 | return class_conformsToProtocol(mockedClass, aProtocol); 219 | } 220 | 221 | @end 222 | 223 | 224 | #pragma mark - 225 | 226 | /** 227 | taken from: 228 | `class-dump -f isNS /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/System/Library/Frameworks/CoreFoundation.framework` 229 | 230 | @interface NSObject (__NSIsKinds) 231 | - (_Bool)isNSValue__; 232 | - (_Bool)isNSTimeZone__; 233 | - (_Bool)isNSString__; 234 | - (_Bool)isNSSet__; 235 | - (_Bool)isNSOrderedSet__; 236 | - (_Bool)isNSNumber__; 237 | - (_Bool)isNSDictionary__; 238 | - (_Bool)isNSDate__; 239 | - (_Bool)isNSData__; 240 | - (_Bool)isNSArray__; 241 | */ 242 | 243 | @implementation OCClassMockObject(NSIsKindsImplementation) 244 | 245 | - (BOOL)isNSValue__ 246 | { 247 | return [mockedClass isSubclassOfClass:[NSValue class]]; 248 | } 249 | 250 | - (BOOL)isNSTimeZone__ 251 | { 252 | return [mockedClass isSubclassOfClass:[NSTimeZone class]]; 253 | } 254 | 255 | - (BOOL)isNSSet__ 256 | { 257 | return [mockedClass isSubclassOfClass:[NSSet class]]; 258 | } 259 | 260 | - (BOOL)isNSOrderedSet__ 261 | { 262 | return [mockedClass isSubclassOfClass:[NSOrderedSet class]]; 263 | } 264 | 265 | - (BOOL)isNSNumber__ 266 | { 267 | return [mockedClass isSubclassOfClass:[NSNumber class]]; 268 | } 269 | 270 | - (BOOL)isNSDate__ 271 | { 272 | return [mockedClass isSubclassOfClass:[NSDate class]]; 273 | } 274 | 275 | - (BOOL)isNSString__ 276 | { 277 | return [mockedClass isSubclassOfClass:[NSString class]]; 278 | } 279 | 280 | - (BOOL)isNSDictionary__ 281 | { 282 | return [mockedClass isSubclassOfClass:[NSDictionary class]]; 283 | } 284 | 285 | - (BOOL)isNSData__ 286 | { 287 | return [mockedClass isSubclassOfClass:[NSData class]]; 288 | } 289 | 290 | - (BOOL)isNSArray__ 291 | { 292 | return [mockedClass isSubclassOfClass:[NSArray class]]; 293 | } 294 | 295 | @end 296 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMArg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCMArg : NSObject 20 | 21 | // constraining arguments 22 | 23 | + (id)any; 24 | + (SEL)anySelector; 25 | + (void *)anyPointer; 26 | + (id __autoreleasing *)anyObjectRef; 27 | + (id)isNil; 28 | + (id)isNotNil; 29 | + (id)isEqual:(id)value; 30 | + (id)isNotEqual:(id)value; 31 | + (id)isKindOfClass:(Class)cls; 32 | + (id)checkWithSelector:(SEL)selector onObject:(id)anObject; 33 | + (id)checkWithBlock:(BOOL (^)(id obj))block; 34 | 35 | // manipulating arguments 36 | 37 | + (id *)setTo:(id)value; 38 | + (void *)setToValue:(NSValue *)value; 39 | + (id)invokeBlock; 40 | + (id)invokeBlockWithArgs:(id)first,... NS_REQUIRES_NIL_TERMINATION; 41 | 42 | + (id)defaultValue; 43 | 44 | // internal use only 45 | 46 | + (id)resolveSpecialValues:(NSValue *)value; 47 | 48 | @end 49 | 50 | #define OCMOCK_ANY [OCMArg any] 51 | 52 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__) 53 | #define OCMOCK_VALUE(variable) \ 54 | ({ __typeof__(variable) __v = (variable); [NSValue value:&__v withObjCType:@encode(__typeof__(__v))]; }) 55 | #else 56 | #define OCMOCK_VALUE(variable) [NSValue value:&variable withObjCType:@encode(__typeof__(variable))] 57 | #endif 58 | 59 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMArg.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import 19 | #import 20 | #import "OCMPassByRefSetter.h" 21 | #import "OCMBlockArgCaller.h" 22 | 23 | @implementation OCMArg 24 | 25 | + (id)any 26 | { 27 | return [OCMAnyConstraint constraint]; 28 | } 29 | 30 | + (void *)anyPointer 31 | { 32 | return (void *)0x01234567; 33 | } 34 | 35 | + (id __autoreleasing *)anyObjectRef 36 | { 37 | return (id *)0x01234567; 38 | } 39 | 40 | + (SEL)anySelector 41 | { 42 | return NSSelectorFromString(@"aSelectorThatMatchesAnySelector"); 43 | } 44 | 45 | + (id)isNil 46 | { 47 | return [OCMIsNilConstraint constraint]; 48 | } 49 | 50 | + (id)isNotNil 51 | { 52 | return [OCMIsNotNilConstraint constraint]; 53 | } 54 | 55 | + (id)isEqual:(id)value 56 | { 57 | return value; 58 | } 59 | 60 | + (id)isNotEqual:(id)value 61 | { 62 | OCMIsNotEqualConstraint *constraint = [OCMIsNotEqualConstraint constraint]; 63 | constraint->testValue = value; 64 | return constraint; 65 | } 66 | 67 | + (id)isKindOfClass:(Class)cls 68 | { 69 | return [[[OCMBlockConstraint alloc] initWithConstraintBlock:^BOOL(id obj) { 70 | return [obj isKindOfClass:cls]; 71 | }] autorelease]; 72 | } 73 | 74 | + (id)checkWithSelector:(SEL)selector onObject:(id)anObject 75 | { 76 | return [OCMConstraint constraintWithSelector:selector onObject:anObject]; 77 | } 78 | 79 | + (id)checkWithBlock:(BOOL (^)(id))block 80 | { 81 | return [[[OCMBlockConstraint alloc] initWithConstraintBlock:block] autorelease]; 82 | } 83 | 84 | + (id *)setTo:(id)value 85 | { 86 | return (id *)[[[OCMPassByRefSetter alloc] initWithValue:value] autorelease]; 87 | } 88 | 89 | + (void *)setToValue:(NSValue *)value 90 | { 91 | return (id *)[[[OCMPassByRefSetter alloc] initWithValue:value] autorelease]; 92 | } 93 | 94 | + (id)invokeBlock 95 | { 96 | return [[[OCMBlockArgCaller alloc] init] autorelease]; 97 | } 98 | 99 | + (id)invokeBlockWithArgs:(id)first,... NS_REQUIRES_NIL_TERMINATION 100 | { 101 | 102 | NSMutableArray *params = [NSMutableArray array]; 103 | va_list args; 104 | if(first) 105 | { 106 | [params addObject:first]; 107 | va_start(args, first); 108 | id obj; 109 | while((obj = va_arg(args, id))) 110 | { 111 | [params addObject:obj]; 112 | } 113 | va_end(args); 114 | } 115 | return [[[OCMBlockArgCaller alloc] initWithBlockArguments:params] autorelease]; 116 | 117 | } 118 | 119 | + (id)defaultValue 120 | { 121 | return [NSNull null]; 122 | } 123 | 124 | 125 | + (id)resolveSpecialValues:(NSValue *)value 126 | { 127 | const char *type = [value objCType]; 128 | if(type[0] == '^') 129 | { 130 | void *pointer = [value pointerValue]; 131 | if(pointer == (void *)0x01234567) 132 | return [OCMArg any]; 133 | if((pointer != NULL) && (object_getClass((id)pointer) == [OCMPassByRefSetter class])) 134 | return (id)pointer; 135 | } 136 | else if(type[0] == ':') 137 | { 138 | SEL selector; 139 | [value getValue:&selector]; 140 | if(selector == NSSelectorFromString(@"aSelectorThatMatchesAnySelector")) 141 | return [OCMArg any]; 142 | } 143 | return value; 144 | } 145 | 146 | @end 147 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMArgAction.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCMArgAction : NSObject 20 | 21 | - (void)handleArgument:(id)argument; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMArgAction.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMArgAction.h" 18 | 19 | 20 | @implementation OCMArgAction 21 | 22 | - (void)handleArgument:(id)argument 23 | { 24 | 25 | } 26 | 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMBlockArgCaller.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMArgAction.h" 18 | 19 | @interface OCMBlockArgCaller : OCMArgAction 20 | { 21 | NSArray *arguments; 22 | } 23 | 24 | - (instancetype)initWithBlockArguments:(NSArray *)someArgs; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMBlockArgCaller.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMBlockArgCaller.h" 18 | #import "NSInvocation+OCMAdditions.h" 19 | 20 | 21 | @implementation OCMBlockArgCaller 22 | 23 | - (instancetype)initWithBlockArguments:(NSArray *)someArgs 24 | { 25 | self = [super init]; 26 | if(self) 27 | { 28 | arguments = [someArgs copy]; 29 | } 30 | return self; 31 | } 32 | 33 | - (void)dealloc 34 | { 35 | [arguments release]; 36 | [super dealloc]; 37 | } 38 | 39 | - (id)copyWithZone:(NSZone *)zone 40 | { 41 | return [self retain]; 42 | } 43 | 44 | - (void)handleArgument:(id)aBlock 45 | { 46 | if(aBlock) 47 | { 48 | NSInvocation *inv = [NSInvocation invocationForBlock:aBlock withArguments:arguments]; 49 | [inv invokeWithTarget:aBlock]; 50 | } 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMBlockCaller.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | 20 | @interface OCMBlockCaller : NSObject 21 | { 22 | void (^block)(NSInvocation *); 23 | } 24 | 25 | - (id)initWithCallBlock:(void (^)(NSInvocation *))theBlock; 26 | 27 | - (void)handleInvocation:(NSInvocation *)anInvocation; 28 | 29 | @end 30 | 31 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMBlockCaller.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMBlockCaller.h" 18 | 19 | 20 | @implementation OCMBlockCaller 21 | 22 | -(id)initWithCallBlock:(void (^)(NSInvocation *))theBlock 23 | { 24 | if ((self = [super init])) 25 | { 26 | block = [theBlock copy]; 27 | } 28 | 29 | return self; 30 | } 31 | 32 | -(void)dealloc 33 | { 34 | [block release]; 35 | [super dealloc]; 36 | } 37 | 38 | - (void)handleInvocation:(NSInvocation *)anInvocation 39 | { 40 | if (block != nil) 41 | { 42 | block(anInvocation); 43 | } 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMBoxedReturnValueProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMReturnValueProvider.h" 18 | 19 | @interface OCMBoxedReturnValueProvider : OCMReturnValueProvider 20 | { 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMBoxedReturnValueProvider.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMBoxedReturnValueProvider.h" 18 | #import "OCMFunctionsPrivate.h" 19 | #import "NSValue+OCMAdditions.h" 20 | 21 | @implementation OCMBoxedReturnValueProvider 22 | 23 | - (void)handleInvocation:(NSInvocation *)anInvocation 24 | { 25 | const char *returnType = [[anInvocation methodSignature] methodReturnType]; 26 | NSUInteger returnTypeSize = [[anInvocation methodSignature] methodReturnLength]; 27 | char valueBuffer[returnTypeSize]; 28 | NSValue *returnValueAsNSValue = (NSValue *)returnValue; 29 | 30 | if([self isMethodReturnType:returnType compatibleWithValueType:[returnValueAsNSValue objCType]]) 31 | { 32 | [returnValueAsNSValue getValue:valueBuffer]; 33 | [anInvocation setReturnValue:valueBuffer]; 34 | } 35 | else if([returnValueAsNSValue getBytes:valueBuffer objCType:returnType]) 36 | { 37 | [anInvocation setReturnValue:valueBuffer]; 38 | } 39 | else 40 | { 41 | [NSException raise:NSInvalidArgumentException 42 | format:@"Return value cannot be used for method; method signature declares '%s' but value is '%s'.", returnType, [returnValueAsNSValue objCType]]; 43 | } 44 | } 45 | 46 | 47 | - (BOOL)isMethodReturnType:(const char *)returnType compatibleWithValueType:(const char *)valueType 48 | { 49 | /* Same types are obviously compatible */ 50 | if(strcmp(returnType, valueType) == 0) 51 | return YES; 52 | 53 | /* Allow void* for methods that return id, mainly to be able to handle nil */ 54 | if(strcmp(returnType, @encode(id)) == 0 && strcmp(valueType, @encode(void *)) == 0) 55 | return YES; 56 | 57 | return OCMEqualTypesAllowingOpaqueStructs(returnType, valueType); 58 | } 59 | 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMConstraint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | 20 | @interface OCMConstraint : NSObject 21 | 22 | + (instancetype)constraint; 23 | - (BOOL)evaluate:(id)value; 24 | 25 | // if you are looking for any, isNil, etc, they have moved to OCMArg 26 | 27 | // try to use [OCMArg checkWith...] instead of the constraintWith... methods below 28 | 29 | + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject; 30 | + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject withValue:(id)aValue; 31 | 32 | 33 | @end 34 | 35 | @interface OCMAnyConstraint : OCMConstraint 36 | @end 37 | 38 | @interface OCMIsNilConstraint : OCMConstraint 39 | @end 40 | 41 | @interface OCMIsNotNilConstraint : OCMConstraint 42 | @end 43 | 44 | @interface OCMIsNotEqualConstraint : OCMConstraint 45 | { 46 | @public 47 | id testValue; 48 | } 49 | 50 | @end 51 | 52 | @interface OCMInvocationConstraint : OCMConstraint 53 | { 54 | @public 55 | NSInvocation *invocation; 56 | } 57 | 58 | @end 59 | 60 | @interface OCMBlockConstraint : OCMConstraint 61 | { 62 | BOOL (^block)(id); 63 | } 64 | 65 | - (instancetype)initWithConstraintBlock:(BOOL (^)(id))block; 66 | 67 | @end 68 | 69 | 70 | #define CONSTRAINT(aSelector) [OCMConstraint constraintWithSelector:aSelector onObject:self] 71 | #define CONSTRAINTV(aSelector, aValue) [OCMConstraint constraintWithSelector:aSelector onObject:self withValue:(aValue)] 72 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMConstraint.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | 20 | @implementation OCMConstraint 21 | 22 | + (instancetype)constraint 23 | { 24 | return [[[self alloc] init] autorelease]; 25 | } 26 | 27 | - (BOOL)evaluate:(id)value 28 | { 29 | return NO; 30 | } 31 | 32 | - (id)copyWithZone:(struct _NSZone *)zone 33 | { 34 | return [self retain]; 35 | } 36 | 37 | + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject 38 | { 39 | OCMInvocationConstraint *constraint = [OCMInvocationConstraint constraint]; 40 | NSMethodSignature *signature = [anObject methodSignatureForSelector:aSelector]; 41 | if(signature == nil) 42 | [NSException raise:NSInvalidArgumentException format:@"Unkown selector %@ used in constraint.", NSStringFromSelector(aSelector)]; 43 | NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; 44 | [invocation setTarget:anObject]; 45 | [invocation setSelector:aSelector]; 46 | constraint->invocation = invocation; 47 | return constraint; 48 | } 49 | 50 | + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject withValue:(id)aValue 51 | { 52 | OCMInvocationConstraint *constraint = [self constraintWithSelector:aSelector onObject:anObject]; 53 | if([[constraint->invocation methodSignature] numberOfArguments] < 4) 54 | [NSException raise:NSInvalidArgumentException format:@"Constraint with value requires selector with two arguments."]; 55 | [constraint->invocation setArgument:&aValue atIndex:3]; 56 | return constraint; 57 | } 58 | 59 | 60 | @end 61 | 62 | 63 | 64 | #pragma mark - 65 | 66 | @implementation OCMAnyConstraint 67 | 68 | - (BOOL)evaluate:(id)value 69 | { 70 | return YES; 71 | } 72 | 73 | @end 74 | 75 | 76 | 77 | #pragma mark - 78 | 79 | @implementation OCMIsNilConstraint 80 | 81 | - (BOOL)evaluate:(id)value 82 | { 83 | return value == nil; 84 | } 85 | 86 | @end 87 | 88 | 89 | 90 | #pragma mark - 91 | 92 | @implementation OCMIsNotNilConstraint 93 | 94 | - (BOOL)evaluate:(id)value 95 | { 96 | return value != nil; 97 | } 98 | 99 | @end 100 | 101 | 102 | 103 | #pragma mark - 104 | 105 | @implementation OCMIsNotEqualConstraint 106 | 107 | - (BOOL)evaluate:(id)value 108 | { 109 | return ![value isEqual:testValue]; 110 | } 111 | 112 | @end 113 | 114 | 115 | 116 | #pragma mark - 117 | 118 | @implementation OCMInvocationConstraint 119 | 120 | - (BOOL)evaluate:(id)value 121 | { 122 | [invocation setArgument:&value atIndex:2]; // should test if constraint takes arg 123 | [invocation invoke]; 124 | BOOL returnValue; 125 | [invocation getReturnValue:&returnValue]; 126 | return returnValue; 127 | } 128 | 129 | @end 130 | 131 | #pragma mark - 132 | 133 | @implementation OCMBlockConstraint 134 | 135 | - (instancetype)initWithConstraintBlock:(BOOL (^)(id))aBlock 136 | { 137 | if ((self = [super init])) 138 | { 139 | block = [aBlock copy]; 140 | } 141 | 142 | return self; 143 | } 144 | 145 | - (void)dealloc { 146 | [block release]; 147 | [super dealloc]; 148 | } 149 | 150 | - (BOOL)evaluate:(id)value 151 | { 152 | return block ? block(value) : NO; 153 | } 154 | 155 | 156 | @end 157 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMExceptionReturnValueProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMReturnValueProvider.h" 18 | 19 | extern NSString *OCMStubbedException; 20 | 21 | @interface OCMExceptionReturnValueProvider : OCMReturnValueProvider 22 | { 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMExceptionReturnValueProvider.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMExceptionReturnValueProvider.h" 18 | 19 | 20 | @implementation OCMExceptionReturnValueProvider 21 | 22 | NSString *OCMStubbedException = @"OCMStubbedException"; 23 | 24 | 25 | - (void)handleInvocation:(NSInvocation *)anInvocation 26 | { 27 | [[NSException exceptionWithName:OCMStubbedException reason:@"Exception stubbed in test." userInfo:@{ @"exception": returnValue }] raise]; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMExpectationRecorder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCMExpectationRecorder : OCMStubRecorder 20 | 21 | - (id)never; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMExpectationRecorder.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMExpectationRecorder.h" 18 | #import "OCMInvocationExpectation.h" 19 | 20 | @implementation OCMExpectationRecorder 21 | 22 | #pragma mark Initialisers, description, accessors, etc. 23 | 24 | - (id)init 25 | { 26 | self = [super init]; 27 | [invocationMatcher release]; 28 | invocationMatcher = [[OCMInvocationExpectation alloc] init]; 29 | return self; 30 | } 31 | 32 | - (OCMInvocationExpectation *)expectation 33 | { 34 | return (OCMInvocationExpectation *)invocationMatcher; 35 | } 36 | 37 | 38 | #pragma mark Modifying the expectation 39 | 40 | - (id)never 41 | { 42 | [[self expectation] setMatchAndReject:YES]; 43 | return self; 44 | } 45 | 46 | 47 | #pragma mark Finishing recording 48 | 49 | - (void)forwardInvocation:(NSInvocation *)anInvocation 50 | { 51 | [super forwardInvocation:anInvocation]; 52 | [mockObject addExpectation:[self expectation]]; 53 | } 54 | 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMFunctions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | 20 | #if defined(__cplusplus) 21 | #define OCMOCK_EXTERN extern "C" 22 | #else 23 | #define OCMOCK_EXTERN extern 24 | #endif 25 | 26 | 27 | OCMOCK_EXTERN BOOL OCMIsObjectType(const char *objCType); 28 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMFunctionsPrivate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @class OCMLocation; 20 | @class OCClassMockObject; 21 | @class OCPartialMockObject; 22 | 23 | 24 | BOOL OCMIsClassType(const char *objCType); 25 | BOOL OCMIsBlockType(const char *objCType); 26 | BOOL OCMIsObjectType(const char *objCType); 27 | const char *OCMTypeWithoutQualifiers(const char *objCType); 28 | BOOL OCMEqualTypesAllowingOpaqueStructs(const char *type1, const char *type2); 29 | CFNumberType OCMNumberTypeForObjCType(const char *objcType); 30 | 31 | Class OCMCreateSubclass(Class cls, void *ref); 32 | 33 | BOOL OCMIsAliasSelector(SEL selector); 34 | SEL OCMAliasForOriginalSelector(SEL selector); 35 | SEL OCMOriginalSelectorForAlias(SEL selector); 36 | 37 | void OCMSetAssociatedMockForClass(OCClassMockObject *mock, Class aClass); 38 | OCClassMockObject *OCMGetAssociatedMockForClass(Class aClass, BOOL includeSuperclasses); 39 | 40 | void OCMSetAssociatedMockForObject(OCClassMockObject *mock, id anObject); 41 | OCPartialMockObject *OCMGetAssociatedMockForObject(id anObject); 42 | 43 | void OCMReportFailure(OCMLocation *loc, NSString *description); 44 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMIndirectReturnValueProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCMIndirectReturnValueProvider : NSObject 20 | { 21 | id provider; 22 | SEL selector; 23 | } 24 | 25 | - (id)initWithProvider:(id)aProvider andSelector:(SEL)aSelector; 26 | 27 | - (void)handleInvocation:(NSInvocation *)anInvocation; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMIndirectReturnValueProvider.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "NSMethodSignature+OCMAdditions.h" 18 | #import "OCMIndirectReturnValueProvider.h" 19 | #import "NSInvocation+OCMAdditions.h" 20 | 21 | 22 | @implementation OCMIndirectReturnValueProvider 23 | 24 | - (id)initWithProvider:(id)aProvider andSelector:(SEL)aSelector 25 | { 26 | if ((self = [super init])) 27 | { 28 | provider = [aProvider retain]; 29 | selector = aSelector; 30 | } 31 | 32 | return self; 33 | } 34 | 35 | - (void)dealloc 36 | { 37 | [provider release]; 38 | [super dealloc]; 39 | } 40 | 41 | - (void)handleInvocation:(NSInvocation *)anInvocation 42 | { 43 | id originalTarget = [anInvocation target]; 44 | SEL originalSelector = [anInvocation selector]; 45 | 46 | [anInvocation setTarget:provider]; 47 | [anInvocation setSelector:selector]; 48 | [anInvocation invoke]; 49 | 50 | [anInvocation setTarget:originalTarget]; 51 | [anInvocation setSelector:originalSelector]; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMInvocationExpectation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMInvocationStub.h" 18 | 19 | @interface OCMInvocationExpectation : OCMInvocationStub 20 | { 21 | BOOL matchAndReject; 22 | BOOL isSatisfied; 23 | } 24 | 25 | - (void)setMatchAndReject:(BOOL)flag; 26 | - (BOOL)isMatchAndReject; 27 | 28 | - (BOOL)isSatisfied; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMInvocationExpectation.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMInvocationExpectation.h" 18 | #import "NSInvocation+OCMAdditions.h" 19 | 20 | 21 | @implementation OCMInvocationExpectation 22 | 23 | - (void)setMatchAndReject:(BOOL)flag 24 | { 25 | matchAndReject = flag; 26 | if(matchAndReject) 27 | isSatisfied = YES; 28 | } 29 | 30 | - (BOOL)isMatchAndReject 31 | { 32 | return matchAndReject; 33 | } 34 | 35 | - (BOOL)isSatisfied 36 | { 37 | return isSatisfied; 38 | } 39 | 40 | - (void)handleInvocation:(NSInvocation *)anInvocation 41 | { 42 | [super handleInvocation:anInvocation]; 43 | 44 | if(matchAndReject) 45 | { 46 | isSatisfied = NO; 47 | [NSException raise:NSInternalInconsistencyException format:@"%@: explicitly disallowed method invoked: %@", 48 | [self description], [anInvocation invocationDescription]]; 49 | } 50 | else 51 | { 52 | isSatisfied = YES; 53 | } 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMInvocationMatcher.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCMInvocationMatcher : NSObject 20 | { 21 | NSInvocation *recordedInvocation; 22 | BOOL recordedAsClassMethod; 23 | BOOL ignoreNonObjectArgs; 24 | } 25 | 26 | - (void)setInvocation:(NSInvocation *)anInvocation; 27 | - (NSInvocation *)recordedInvocation; 28 | 29 | - (void)setRecordedAsClassMethod:(BOOL)flag; 30 | - (BOOL)recordedAsClassMethod; 31 | 32 | - (void)setIgnoreNonObjectArgs:(BOOL)flag; 33 | 34 | - (BOOL)matchesSelector:(SEL)aSelector; 35 | - (BOOL)matchesInvocation:(NSInvocation *)anInvocation; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMInvocationMatcher.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import 19 | #import 20 | #import "OCMPassByRefSetter.h" 21 | #import "NSInvocation+OCMAdditions.h" 22 | #import "OCMInvocationMatcher.h" 23 | #import "OCClassMockObject.h" 24 | #import "OCMFunctionsPrivate.h" 25 | #import "OCMBlockArgCaller.h" 26 | 27 | 28 | @interface NSObject(HCMatcherDummy) 29 | - (BOOL)matches:(id)item; 30 | @end 31 | 32 | 33 | @implementation OCMInvocationMatcher 34 | 35 | - (void)dealloc 36 | { 37 | [recordedInvocation release]; 38 | [super dealloc]; 39 | } 40 | 41 | - (void)setInvocation:(NSInvocation *)anInvocation 42 | { 43 | [recordedInvocation release]; 44 | // Don't do a regular -retainArguments on the invocation that we use for matching. NSInvocation 45 | // effectively does an strcpy on char* arguments which messes up matching them literally and blows 46 | // up with anyPointer (in strlen since it's not actually a C string). Also on the off-chance that 47 | // anInvocation contains self as an argument, -retainArguments would create a retain cycle. 48 | [anInvocation retainObjectArgumentsExcludingObject:self]; 49 | recordedInvocation = [anInvocation retain]; 50 | } 51 | 52 | - (void)setRecordedAsClassMethod:(BOOL)flag 53 | { 54 | recordedAsClassMethod = flag; 55 | } 56 | 57 | - (BOOL)recordedAsClassMethod 58 | { 59 | return recordedAsClassMethod; 60 | } 61 | 62 | - (void)setIgnoreNonObjectArgs:(BOOL)flag 63 | { 64 | ignoreNonObjectArgs = flag; 65 | } 66 | 67 | - (NSString *)description 68 | { 69 | return [recordedInvocation invocationDescription]; 70 | } 71 | 72 | - (NSInvocation *)recordedInvocation 73 | { 74 | return recordedInvocation; 75 | } 76 | 77 | - (BOOL)matchesSelector:(SEL)sel 78 | { 79 | if(sel == [recordedInvocation selector]) 80 | return YES; 81 | if(OCMIsAliasSelector(sel) && 82 | OCMOriginalSelectorForAlias(sel) == [recordedInvocation selector]) 83 | return YES; 84 | 85 | return NO; 86 | } 87 | 88 | - (BOOL)matchesInvocation:(NSInvocation *)anInvocation 89 | { 90 | id target = [anInvocation target]; 91 | BOOL isClassMethodInvocation = (target != nil) && (target == [target class]); 92 | if(isClassMethodInvocation != recordedAsClassMethod) 93 | return NO; 94 | 95 | if(![self matchesSelector:[anInvocation selector]]) 96 | return NO; 97 | 98 | NSMethodSignature *signature = [recordedInvocation methodSignature]; 99 | NSUInteger n = [signature numberOfArguments]; 100 | for(NSUInteger i = 2; i < n; i++) 101 | { 102 | if(ignoreNonObjectArgs && !OCMIsObjectType([signature getArgumentTypeAtIndex:i])) 103 | { 104 | continue; 105 | } 106 | 107 | id recordedArg = [recordedInvocation getArgumentAtIndexAsObject:i]; 108 | id passedArg = [anInvocation getArgumentAtIndexAsObject:i]; 109 | 110 | if([recordedArg isProxy]) 111 | { 112 | if(![recordedArg isEqual:passedArg]) 113 | return NO; 114 | continue; 115 | } 116 | 117 | if([recordedArg isKindOfClass:[NSValue class]]) 118 | recordedArg = [OCMArg resolveSpecialValues:recordedArg]; 119 | 120 | if([recordedArg isKindOfClass:[OCMConstraint class]]) 121 | { 122 | if([recordedArg evaluate:passedArg] == NO) 123 | return NO; 124 | } 125 | else if([recordedArg isKindOfClass:[OCMArgAction class]]) 126 | { 127 | // ignore, will be dealt with in handleInvocation: where applicable 128 | } 129 | else if([recordedArg conformsToProtocol:objc_getProtocol("HCMatcher")]) 130 | { 131 | if([recordedArg matches:passedArg] == NO) 132 | return NO; 133 | } 134 | else 135 | { 136 | if(([recordedArg class] == [NSNumber class]) && 137 | ([(NSNumber*)recordedArg compare:(NSNumber*)passedArg] != NSOrderedSame)) 138 | return NO; 139 | if(([recordedArg isEqual:passedArg] == NO) && 140 | !((recordedArg == nil) && (passedArg == nil))) 141 | return NO; 142 | } 143 | } 144 | return YES; 145 | } 146 | 147 | @end 148 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMInvocationStub.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMInvocationMatcher.h" 18 | 19 | @interface OCMInvocationStub : OCMInvocationMatcher 20 | { 21 | NSMutableArray *invocationActions; 22 | } 23 | 24 | - (void)addInvocationAction:(id)anAction; 25 | - (NSArray *)invocationActions; 26 | 27 | - (void)handleInvocation:(NSInvocation *)anInvocation; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMInvocationStub.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMInvocationStub.h" 18 | #import "OCMFunctionsPrivate.h" 19 | #import "OCMArg.h" 20 | #import "OCMArgAction.h" 21 | #import "NSInvocation+OCMAdditions.h" 22 | 23 | @implementation OCMInvocationStub 24 | 25 | - (id)init 26 | { 27 | self = [super init]; 28 | invocationActions = [[NSMutableArray alloc] init]; 29 | return self; 30 | } 31 | 32 | - (void)dealloc 33 | { 34 | [invocationActions release]; 35 | [super dealloc]; 36 | } 37 | 38 | 39 | - (void)addInvocationAction:(id)anAction 40 | { 41 | [invocationActions addObject:anAction]; 42 | } 43 | 44 | - (NSArray *)invocationActions 45 | { 46 | return invocationActions; 47 | } 48 | 49 | 50 | - (void)handleInvocation:(NSInvocation *)anInvocation 51 | { 52 | NSMethodSignature *signature = [recordedInvocation methodSignature]; 53 | NSUInteger n = [signature numberOfArguments]; 54 | for(NSUInteger i = 2; i < n; i++) 55 | { 56 | id recordedArg = [recordedInvocation getArgumentAtIndexAsObject:i]; 57 | id passedArg = [anInvocation getArgumentAtIndexAsObject:i]; 58 | 59 | if([recordedArg isProxy]) 60 | continue; 61 | 62 | if([recordedArg isKindOfClass:[NSValue class]]) 63 | recordedArg = [OCMArg resolveSpecialValues:recordedArg]; 64 | 65 | if(![recordedArg isKindOfClass:[OCMArgAction class]]) 66 | continue; 67 | 68 | [recordedArg handleArgument:passedArg]; 69 | } 70 | 71 | [invocationActions makeObjectsPerformSelector:@selector(handleInvocation:) withObject:anInvocation]; 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMLocation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import "OCMFunctions.h" 19 | 20 | 21 | @interface OCMLocation : NSObject 22 | { 23 | id testCase; 24 | NSString *file; 25 | NSUInteger line; 26 | } 27 | 28 | + (instancetype)locationWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine; 29 | 30 | - (instancetype)initWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine; 31 | 32 | - (id)testCase; 33 | - (NSString *)file; 34 | - (NSUInteger)line; 35 | 36 | @end 37 | 38 | OCMOCK_EXTERN OCMLocation *OCMMakeLocation(id testCase, const char *file, int line); 39 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMLocation.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMLocation.h" 18 | 19 | @implementation OCMLocation 20 | 21 | + (instancetype)locationWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine 22 | { 23 | return [[[OCMLocation alloc] initWithTestCase:aTestCase file:aFile line:aLine] autorelease]; 24 | } 25 | 26 | - (instancetype)initWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine 27 | { 28 | if ((self = [super init])) 29 | { 30 | testCase = aTestCase; 31 | file = [aFile retain]; 32 | line = aLine; 33 | } 34 | 35 | return self; 36 | } 37 | 38 | - (void)dealloc 39 | { 40 | [file release]; 41 | [super dealloc]; 42 | } 43 | 44 | - (id)testCase 45 | { 46 | return testCase; 47 | } 48 | 49 | - (NSString *)file 50 | { 51 | return file; 52 | } 53 | 54 | - (NSUInteger)line 55 | { 56 | return line; 57 | } 58 | 59 | @end 60 | 61 | 62 | OCMLocation *OCMMakeLocation(id testCase, const char *fileCString, int line) 63 | { 64 | return [OCMLocation locationWithTestCase:testCase file:[NSString stringWithUTF8String:fileCString] line:line]; 65 | } 66 | 67 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMMacroState.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @class OCMLocation; 20 | @class OCMRecorder; 21 | @class OCMStubRecorder; 22 | @class OCMockObject; 23 | 24 | 25 | @interface OCMMacroState : NSObject 26 | { 27 | OCMRecorder *recorder; 28 | } 29 | 30 | + (void)beginStubMacro; 31 | + (OCMStubRecorder *)endStubMacro; 32 | 33 | + (void)beginExpectMacro; 34 | + (OCMStubRecorder *)endExpectMacro; 35 | 36 | + (void)beginRejectMacro; 37 | + (OCMStubRecorder *)endRejectMacro; 38 | 39 | + (void)beginVerifyMacroAtLocation:(OCMLocation *)aLocation; 40 | + (void)endVerifyMacro; 41 | 42 | + (OCMMacroState *)globalState; 43 | 44 | - (OCMRecorder *)recorder; 45 | 46 | - (void)switchToClassMethod; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMMacroState.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMMacroState.h" 18 | #import "OCMStubRecorder.h" 19 | #import "OCMockObject.h" 20 | #import "OCMExpectationRecorder.h" 21 | #import "OCMVerifier.h" 22 | #import "OCMInvocationMatcher.h" 23 | 24 | 25 | @implementation OCMMacroState 26 | 27 | static NSString *const OCMGlobalStateKey = @"OCMGlobalStateKey"; 28 | 29 | #pragma mark Methods to begin/end macros 30 | 31 | + (void)beginStubMacro 32 | { 33 | OCMStubRecorder *recorder = [[[OCMStubRecorder alloc] init] autorelease]; 34 | OCMMacroState *macroState = [[OCMMacroState alloc] initWithRecorder:recorder]; 35 | [NSThread currentThread].threadDictionary[OCMGlobalStateKey] = macroState; 36 | [macroState release]; 37 | } 38 | 39 | + (OCMStubRecorder *)endStubMacro 40 | { 41 | NSMutableDictionary *threadDictionary = [NSThread currentThread].threadDictionary; 42 | OCMMacroState *globalState = threadDictionary[OCMGlobalStateKey]; 43 | OCMStubRecorder *recorder = [(OCMStubRecorder *)[globalState recorder] retain]; 44 | [threadDictionary removeObjectForKey:OCMGlobalStateKey]; 45 | return [recorder autorelease]; 46 | } 47 | 48 | 49 | + (void)beginExpectMacro 50 | { 51 | OCMExpectationRecorder *recorder = [[[OCMExpectationRecorder alloc] init] autorelease]; 52 | OCMMacroState *macroState = [[OCMMacroState alloc] initWithRecorder:recorder]; 53 | [NSThread currentThread].threadDictionary[OCMGlobalStateKey] = macroState; 54 | [macroState release]; 55 | } 56 | 57 | + (OCMStubRecorder *)endExpectMacro 58 | { 59 | return [self endStubMacro]; 60 | } 61 | 62 | 63 | + (void)beginRejectMacro 64 | { 65 | OCMExpectationRecorder *recorder = [[[OCMExpectationRecorder alloc] init] autorelease]; 66 | [recorder never]; 67 | OCMMacroState *macroState = [[OCMMacroState alloc] initWithRecorder:recorder]; 68 | [NSThread currentThread].threadDictionary[OCMGlobalStateKey] = macroState; 69 | [macroState release]; 70 | } 71 | 72 | + (OCMStubRecorder *)endRejectMacro 73 | { 74 | return [self endStubMacro]; 75 | } 76 | 77 | 78 | + (void)beginVerifyMacroAtLocation:(OCMLocation *)aLocation 79 | { 80 | OCMVerifier *recorder = [[[OCMVerifier alloc] init] autorelease]; 81 | [recorder setLocation:aLocation]; 82 | OCMMacroState *macroState = [[OCMMacroState alloc] initWithRecorder:recorder]; 83 | [NSThread currentThread].threadDictionary[OCMGlobalStateKey] = macroState; 84 | [macroState release]; 85 | } 86 | 87 | + (void)endVerifyMacro 88 | { 89 | [[NSThread currentThread].threadDictionary removeObjectForKey:OCMGlobalStateKey]; 90 | } 91 | 92 | 93 | #pragma mark Accessing global state 94 | 95 | + (OCMMacroState *)globalState 96 | { 97 | return [NSThread currentThread].threadDictionary[OCMGlobalStateKey]; 98 | } 99 | 100 | 101 | #pragma mark Init, dealloc, accessors 102 | 103 | - (id)initWithRecorder:(OCMRecorder *)aRecorder 104 | { 105 | if ((self = [super init])) 106 | { 107 | recorder = [aRecorder retain]; 108 | } 109 | 110 | return self; 111 | } 112 | 113 | - (void)dealloc 114 | { 115 | [recorder release]; 116 | NSAssert([NSThread currentThread].threadDictionary[OCMGlobalStateKey] != self, @"Unexpected dealloc while set as the global state"); 117 | [super dealloc]; 118 | } 119 | 120 | - (OCMRecorder *)recorder 121 | { 122 | return recorder; 123 | } 124 | 125 | 126 | #pragma mark Changing the recorder 127 | 128 | - (void)switchToClassMethod 129 | { 130 | [recorder classMethod]; 131 | } 132 | 133 | 134 | @end 135 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMNotificationPoster.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCMNotificationPoster : NSObject 20 | { 21 | NSNotification *notification; 22 | } 23 | 24 | - (id)initWithNotification:(id)aNotification; 25 | 26 | - (void)handleInvocation:(NSInvocation *)anInvocation; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMNotificationPoster.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMNotificationPoster.h" 18 | 19 | 20 | @implementation OCMNotificationPoster 21 | 22 | - (id)initWithNotification:(id)aNotification 23 | { 24 | if ((self = [super init])) 25 | { 26 | notification = [aNotification retain]; 27 | } 28 | 29 | return self; 30 | } 31 | 32 | - (void)dealloc 33 | { 34 | [notification release]; 35 | [super dealloc]; 36 | } 37 | 38 | - (void)handleInvocation:(NSInvocation *)anInvocation 39 | { 40 | [[NSNotificationCenter defaultCenter] postNotification:notification]; 41 | } 42 | 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMObserverRecorder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCMObserverRecorder : NSObject 20 | { 21 | NSNotification *recordedNotification; 22 | } 23 | 24 | - (NSNotification *)notificationWithName:(NSString *)name object:(id)sender; 25 | 26 | - (NSNotification *)notificationWithName:(NSString *)name object:(id)sender userInfo:(NSDictionary *)userInfo; 27 | 28 | - (BOOL)matchesNotification:(NSNotification *)aNotification; 29 | 30 | - (BOOL)argument:(id)expectedArg matchesArgument:(id)observedArg; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMObserverRecorder.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import 19 | #import "NSInvocation+OCMAdditions.h" 20 | #import "OCMObserverRecorder.h" 21 | 22 | @interface NSObject(HCMatcherDummy) 23 | - (BOOL)matches:(id)item; 24 | @end 25 | 26 | #pragma mark - 27 | 28 | 29 | @implementation OCMObserverRecorder 30 | 31 | #pragma mark Initialisers, description, accessors, etc. 32 | 33 | - (void)dealloc 34 | { 35 | [recordedNotification release]; 36 | [super dealloc]; 37 | } 38 | 39 | 40 | #pragma mark Recording 41 | 42 | - (NSNotification *)notificationWithName:(NSString *)name object:(id)sender 43 | { 44 | recordedNotification = [[NSNotification notificationWithName:name object:sender] retain]; 45 | return nil; 46 | } 47 | 48 | - (NSNotification *)notificationWithName:(NSString *)name object:(id)sender userInfo:(NSDictionary *)userInfo 49 | { 50 | recordedNotification = [[NSNotification notificationWithName:name object:sender userInfo:userInfo] retain]; 51 | return nil; 52 | } 53 | 54 | 55 | #pragma mark Verification 56 | 57 | - (BOOL)matchesNotification:(NSNotification *)aNotification 58 | { 59 | return [self argument:[recordedNotification name] matchesArgument:[aNotification name]] && 60 | [self argument:[recordedNotification object] matchesArgument:[aNotification object]] && 61 | [self argument:[recordedNotification userInfo] matchesArgument:[aNotification userInfo]]; 62 | } 63 | 64 | - (BOOL)argument:(id)expectedArg matchesArgument:(id)observedArg 65 | { 66 | if([expectedArg isKindOfClass:[OCMConstraint class]]) 67 | { 68 | return [expectedArg evaluate:observedArg]; 69 | } 70 | else if([expectedArg conformsToProtocol:objc_getProtocol("HCMatcher")]) 71 | { 72 | return [expectedArg matches:observedArg]; 73 | } 74 | else if (expectedArg == observedArg) 75 | { 76 | return YES; 77 | } 78 | else if (expectedArg == nil || observedArg == nil) 79 | { 80 | return NO; 81 | } 82 | else 83 | { 84 | return [expectedArg isEqual:observedArg]; 85 | } 86 | } 87 | 88 | 89 | @end 90 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMPassByRefSetter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMArgAction.h" 18 | 19 | @interface OCMPassByRefSetter : OCMArgAction 20 | { 21 | id value; 22 | } 23 | 24 | - (id)initWithValue:(id)value; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMPassByRefSetter.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMPassByRefSetter.h" 18 | 19 | 20 | @implementation OCMPassByRefSetter 21 | 22 | - (id)initWithValue:(id)aValue 23 | { 24 | if ((self = [super init])) 25 | { 26 | value = [aValue retain]; 27 | } 28 | 29 | return self; 30 | } 31 | 32 | - (void)dealloc 33 | { 34 | [value release]; 35 | [super dealloc]; 36 | } 37 | 38 | - (void)handleArgument:(id)arg 39 | { 40 | void *pointerValue = [arg pointerValue]; 41 | if(pointerValue != NULL) 42 | { 43 | if([value isKindOfClass:[NSValue class]]) 44 | [(NSValue *)value getValue:pointerValue]; 45 | else 46 | *(id *)pointerValue = value; 47 | } 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMRealObjectForwarder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCMRealObjectForwarder : NSObject 20 | { 21 | } 22 | 23 | - (void)handleInvocation:(NSInvocation *)anInvocation; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMRealObjectForwarder.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import "OCPartialMockObject.h" 19 | #import "OCMRealObjectForwarder.h" 20 | #import "OCMFunctionsPrivate.h" 21 | 22 | 23 | @implementation OCMRealObjectForwarder 24 | 25 | - (void)handleInvocation:(NSInvocation *)anInvocation 26 | { 27 | id invocationTarget = [anInvocation target]; 28 | 29 | [anInvocation setSelector:OCMAliasForOriginalSelector([anInvocation selector])]; 30 | if ([invocationTarget isProxy]) 31 | { 32 | if (class_getInstanceMethod([invocationTarget mockObjectClass], @selector(realObject))) 33 | { 34 | // the method has been invoked on the mock, we need to change the target to the real object 35 | [anInvocation setTarget:[(OCPartialMockObject *)invocationTarget realObject]]; 36 | } 37 | else 38 | { 39 | [NSException raise:NSInternalInconsistencyException 40 | format:@"Method andForwardToRealObject can only be used with partial mocks and class methods."]; 41 | } 42 | } 43 | 44 | [anInvocation invoke]; 45 | } 46 | 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMRecorder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @class OCMockObject; 20 | @class OCMInvocationMatcher; 21 | 22 | 23 | @interface OCMRecorder : NSProxy 24 | { 25 | OCMockObject *mockObject; 26 | OCMInvocationMatcher *invocationMatcher; 27 | } 28 | 29 | - (instancetype)init; 30 | - (instancetype)initWithMockObject:(OCMockObject *)aMockObject; 31 | 32 | - (void)setMockObject:(OCMockObject *)aMockObject; 33 | 34 | - (OCMInvocationMatcher *)invocationMatcher; 35 | 36 | - (id)classMethod; 37 | - (id)ignoringNonObjectArgs; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMRecorder.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import "OCMRecorder.h" 19 | #import "OCMockObject.h" 20 | #import "OCMInvocationMatcher.h" 21 | #import "OCClassMockObject.h" 22 | 23 | @implementation OCMRecorder 24 | 25 | - (instancetype)init 26 | { 27 | // no super, we're inheriting from NSProxy 28 | return self; 29 | } 30 | 31 | - (instancetype)initWithMockObject:(OCMockObject *)aMockObject 32 | { 33 | [self init]; 34 | [self setMockObject:aMockObject]; 35 | return self; 36 | } 37 | 38 | - (void)setMockObject:(OCMockObject *)aMockObject 39 | { 40 | mockObject = aMockObject; 41 | } 42 | 43 | - (void)dealloc 44 | { 45 | [invocationMatcher release]; 46 | [super dealloc]; 47 | } 48 | 49 | - (NSString *)description 50 | { 51 | return [invocationMatcher description]; 52 | } 53 | 54 | - (OCMInvocationMatcher *)invocationMatcher 55 | { 56 | return invocationMatcher; 57 | } 58 | 59 | 60 | #pragma mark Modifying the matcher 61 | 62 | - (id)classMethod 63 | { 64 | // should we handle the case where this is called with a mock that isn't a class mock? 65 | [invocationMatcher setRecordedAsClassMethod:YES]; 66 | return self; 67 | } 68 | 69 | - (id)ignoringNonObjectArgs 70 | { 71 | [invocationMatcher setIgnoreNonObjectArgs:YES]; 72 | return self; 73 | } 74 | 75 | 76 | #pragma mark Recording the actual invocation 77 | 78 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector 79 | { 80 | if([invocationMatcher recordedAsClassMethod]) 81 | return [[(OCClassMockObject *)mockObject mockedClass] methodSignatureForSelector:aSelector]; 82 | 83 | NSMethodSignature *signature = [mockObject methodSignatureForSelector:aSelector]; 84 | if(signature == nil) 85 | { 86 | // if we're a working with a class mock and there is a class method, auto-switch 87 | if(([object_getClass(mockObject) isSubclassOfClass:[OCClassMockObject class]]) && 88 | ([[(OCClassMockObject *)mockObject mockedClass] respondsToSelector:aSelector])) 89 | { 90 | [self classMethod]; 91 | signature = [self methodSignatureForSelector:aSelector]; 92 | } 93 | } 94 | return signature; 95 | } 96 | 97 | - (void)forwardInvocation:(NSInvocation *)anInvocation 98 | { 99 | [anInvocation setTarget:nil]; 100 | [invocationMatcher setInvocation:anInvocation]; 101 | } 102 | 103 | - (void)doesNotRecognizeSelector:(SEL)aSelector 104 | { 105 | [NSException raise:NSInvalidArgumentException format:@"%@: cannot stub/expect/verify method '%@' because no such method exists in the mocked class.", mockObject, NSStringFromSelector(aSelector)]; 106 | } 107 | 108 | 109 | @end 110 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMReturnValueProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCMReturnValueProvider : NSObject 20 | { 21 | id returnValue; 22 | } 23 | 24 | - (instancetype)initWithValue:(id)aValue; 25 | 26 | - (void)handleInvocation:(NSInvocation *)anInvocation; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMReturnValueProvider.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "NSMethodSignature+OCMAdditions.h" 18 | #import "OCMReturnValueProvider.h" 19 | #import "OCMFunctions.h" 20 | 21 | 22 | @implementation OCMReturnValueProvider 23 | 24 | - (instancetype)initWithValue:(id)aValue 25 | { 26 | if ((self = [super init])) 27 | { 28 | returnValue = [aValue retain]; 29 | } 30 | 31 | return self; 32 | } 33 | 34 | - (void)dealloc 35 | { 36 | [returnValue release]; 37 | [super dealloc]; 38 | } 39 | 40 | - (void)handleInvocation:(NSInvocation *)anInvocation 41 | { 42 | if(!OCMIsObjectType([[anInvocation methodSignature] methodReturnType])) 43 | { 44 | @throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"Expected invocation with object return type. Did you mean to use andReturnValue: instead?" userInfo:nil]; 45 | } 46 | NSString *sel = NSStringFromSelector([anInvocation selector]); 47 | if([sel hasPrefix:@"alloc"] || [sel hasPrefix:@"new"] || [sel hasPrefix:@"copy"] || [sel hasPrefix:@"mutableCopy"]) 48 | { 49 | // methods that "create" an object return it with an extra retain count 50 | [returnValue retain]; 51 | } 52 | [anInvocation setReturnValue:&returnValue]; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMStubRecorder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import 19 | #import 20 | 21 | @interface OCMStubRecorder : OCMRecorder 22 | 23 | - (id)andReturn:(id)anObject; 24 | - (id)andReturnValue:(NSValue *)aValue; 25 | - (id)andThrow:(NSException *)anException; 26 | - (id)andPost:(NSNotification *)aNotification; 27 | - (id)andCall:(SEL)selector onObject:(id)anObject; 28 | - (id)andDo:(void (^)(NSInvocation *invocation))block; 29 | - (id)andForwardToRealObject; 30 | 31 | @end 32 | 33 | 34 | @interface OCMStubRecorder (Properties) 35 | 36 | #define andReturn(aValue) _andReturn(({ \ 37 | __typeof__(aValue) _val = (aValue); \ 38 | NSValue *_nsval = [NSValue value:&_val withObjCType:@encode(__typeof__(_val))]; \ 39 | if (OCMIsObjectType(@encode(__typeof(_val)))) { \ 40 | objc_setAssociatedObject(_nsval, "OCMAssociatedBoxedValue", *(__unsafe_unretained id *) (void *) &_val, OBJC_ASSOCIATION_RETAIN); \ 41 | } \ 42 | _nsval; \ 43 | })) 44 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andReturn)(NSValue *); 45 | 46 | #define andThrow(anException) _andThrow(anException) 47 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andThrow)(NSException *); 48 | 49 | #define andPost(aNotification) _andPost(aNotification) 50 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andPost)(NSNotification *); 51 | 52 | #define andCall(anObject, aSelector) _andCall(anObject, aSelector) 53 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andCall)(id, SEL); 54 | 55 | #define andDo(aBlock) _andDo(aBlock) 56 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andDo)(void (^)(NSInvocation *)); 57 | 58 | #define andForwardToRealObject() _andForwardToRealObject() 59 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andForwardToRealObject)(void); 60 | 61 | @end 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMStubRecorder.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMStubRecorder.h" 18 | #import "OCClassMockObject.h" 19 | #import "OCMReturnValueProvider.h" 20 | #import "OCMBoxedReturnValueProvider.h" 21 | #import "OCMExceptionReturnValueProvider.h" 22 | #import "OCMIndirectReturnValueProvider.h" 23 | #import "OCMNotificationPoster.h" 24 | #import "OCMBlockCaller.h" 25 | #import "OCMRealObjectForwarder.h" 26 | #import "OCMFunctions.h" 27 | #import "OCMInvocationStub.h" 28 | 29 | 30 | @implementation OCMStubRecorder 31 | 32 | #pragma mark Initialisers, description, accessors, etc. 33 | 34 | - (id)init 35 | { 36 | if(invocationMatcher != nil) 37 | [NSException raise:NSInternalInconsistencyException format:@"** Method init invoked twice on stub recorder. Are you trying to mock the init method? This is currently not supported."]; 38 | 39 | self = [super init]; 40 | invocationMatcher = [[OCMInvocationStub alloc] init]; 41 | return self; 42 | } 43 | 44 | - (OCMInvocationStub *)stub 45 | { 46 | return (OCMInvocationStub *)invocationMatcher; 47 | } 48 | 49 | 50 | #pragma mark Recording invocation actions 51 | 52 | - (id)andReturn:(id)anObject 53 | { 54 | [[self stub] addInvocationAction:[[[OCMReturnValueProvider alloc] initWithValue:anObject] autorelease]]; 55 | return self; 56 | } 57 | 58 | - (id)andReturnValue:(NSValue *)aValue 59 | { 60 | [[self stub] addInvocationAction:[[[OCMBoxedReturnValueProvider alloc] initWithValue:aValue] autorelease]]; 61 | return self; 62 | } 63 | 64 | - (id)andThrow:(NSException *)anException 65 | { 66 | [[self stub] addInvocationAction:[[[OCMExceptionReturnValueProvider alloc] initWithValue:anException] autorelease]]; 67 | return self; 68 | } 69 | 70 | - (id)andPost:(NSNotification *)aNotification 71 | { 72 | [[self stub] addInvocationAction:[[[OCMNotificationPoster alloc] initWithNotification:aNotification] autorelease]]; 73 | return self; 74 | } 75 | 76 | - (id)andCall:(SEL)selector onObject:(id)anObject 77 | { 78 | [[self stub] addInvocationAction:[[[OCMIndirectReturnValueProvider alloc] initWithProvider:anObject andSelector:selector] autorelease]]; 79 | return self; 80 | } 81 | 82 | - (id)andDo:(void (^)(NSInvocation *))aBlock 83 | { 84 | [[self stub] addInvocationAction:[[[OCMBlockCaller alloc] initWithCallBlock:aBlock] autorelease]]; 85 | return self; 86 | } 87 | 88 | - (id)andForwardToRealObject 89 | { 90 | [[self stub] addInvocationAction:[[[OCMRealObjectForwarder alloc] init] autorelease]]; 91 | return self; 92 | } 93 | 94 | 95 | #pragma mark Finishing recording 96 | 97 | - (void)forwardInvocation:(NSInvocation *)anInvocation 98 | { 99 | [super forwardInvocation:anInvocation]; 100 | [mockObject addStub:[self stub]]; 101 | } 102 | 103 | 104 | @end 105 | 106 | 107 | @implementation OCMStubRecorder (Properties) 108 | 109 | @dynamic _andReturn; 110 | 111 | - (OCMStubRecorder *(^)(NSValue *))_andReturn 112 | { 113 | id (^theBlock)(id) = ^ (NSValue *aValue) 114 | { 115 | if(OCMIsObjectType([aValue objCType])) 116 | { 117 | NSValue *objValue = nil; 118 | [aValue getValue:&objValue]; 119 | return [self andReturn:objValue]; 120 | } 121 | else 122 | { 123 | return [self andReturnValue:aValue]; 124 | } 125 | }; 126 | return [[theBlock copy] autorelease]; 127 | } 128 | 129 | 130 | @dynamic _andThrow; 131 | 132 | - (OCMStubRecorder *(^)(NSException *))_andThrow 133 | { 134 | id (^theBlock)(id) = ^ (NSException * anException) 135 | { 136 | return [self andThrow:anException]; 137 | }; 138 | return [[theBlock copy] autorelease]; 139 | } 140 | 141 | 142 | @dynamic _andPost; 143 | 144 | - (OCMStubRecorder *(^)(NSNotification *))_andPost 145 | { 146 | id (^theBlock)(id) = ^ (NSNotification * aNotification) 147 | { 148 | return [self andPost:aNotification]; 149 | }; 150 | return [[theBlock copy] autorelease]; 151 | } 152 | 153 | 154 | @dynamic _andCall; 155 | 156 | - (OCMStubRecorder *(^)(id, SEL))_andCall 157 | { 158 | id (^theBlock)(id, SEL) = ^ (id anObject, SEL aSelector) 159 | { 160 | return [self andCall:aSelector onObject:anObject]; 161 | }; 162 | return [[theBlock copy] autorelease]; 163 | } 164 | 165 | 166 | @dynamic _andDo; 167 | 168 | - (OCMStubRecorder *(^)(void (^)(NSInvocation *)))_andDo 169 | { 170 | id (^theBlock)(void (^)(NSInvocation *)) = ^ (void (^ blockToCall)(NSInvocation *)) 171 | { 172 | return [self andDo:blockToCall]; 173 | }; 174 | return [[theBlock copy] autorelease]; 175 | } 176 | 177 | 178 | @dynamic _andForwardToRealObject; 179 | 180 | - (OCMStubRecorder *(^)(void))_andForwardToRealObject 181 | { 182 | id (^theBlock)(void) = ^ (void) 183 | { 184 | return [self andForwardToRealObject]; 185 | }; 186 | return [[theBlock copy] autorelease]; 187 | } 188 | 189 | 190 | @end 191 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMVerifier.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMRecorder.h" 18 | #import "OCMLocation.h" 19 | 20 | 21 | @interface OCMVerifier : OCMRecorder 22 | 23 | @property(retain) OCMLocation *location; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMVerifier.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import "OCMVerifier.h" 19 | #import "OCMockObject.h" 20 | #import "OCMLocation.h" 21 | #import "OCMInvocationMatcher.h" 22 | 23 | 24 | @implementation OCMVerifier 25 | 26 | - (id)init 27 | { 28 | if ((self = [super init])) 29 | { 30 | invocationMatcher = [[OCMInvocationMatcher alloc] init]; 31 | } 32 | 33 | return self; 34 | } 35 | 36 | - (void)forwardInvocation:(NSInvocation *)anInvocation 37 | { 38 | [super forwardInvocation:anInvocation]; 39 | [mockObject verifyInvocation:invocationMatcher atLocation:self.location]; 40 | } 41 | 42 | - (void)dealloc 43 | { 44 | [_location release]; 45 | [super dealloc]; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import 19 | #import 20 | #import 21 | #import 22 | #import 23 | #import 24 | #import 25 | #import 26 | 27 | 28 | #define OCMClassMock(cls) [OCMockObject niceMockForClass:cls] 29 | 30 | #define OCMStrictClassMock(cls) [OCMockObject mockForClass:cls] 31 | 32 | #define OCMProtocolMock(protocol) [OCMockObject niceMockForProtocol:protocol] 33 | 34 | #define OCMStrictProtocolMock(protocol) [OCMockObject mockForProtocol:protocol] 35 | 36 | #define OCMPartialMock(obj) [OCMockObject partialMockForObject:obj] 37 | 38 | #define OCMObserverMock() [OCMockObject observerMock] 39 | 40 | 41 | #define OCMStub(invocation) \ 42 | ({ \ 43 | _OCMSilenceWarnings( \ 44 | [OCMMacroState beginStubMacro]; \ 45 | OCMStubRecorder *recorder = nil; \ 46 | @try{ \ 47 | invocation; \ 48 | }@finally{ \ 49 | recorder = [OCMMacroState endStubMacro]; \ 50 | } \ 51 | recorder; \ 52 | ); \ 53 | }) 54 | 55 | #define OCMExpect(invocation) \ 56 | ({ \ 57 | _OCMSilenceWarnings( \ 58 | [OCMMacroState beginExpectMacro]; \ 59 | OCMStubRecorder *recorder = nil; \ 60 | @try{ \ 61 | invocation; \ 62 | }@finally{ \ 63 | recorder = [OCMMacroState endExpectMacro]; \ 64 | } \ 65 | recorder; \ 66 | ); \ 67 | }) 68 | 69 | #define OCMReject(invocation) \ 70 | ({ \ 71 | _OCMSilenceWarnings( \ 72 | [OCMMacroState beginRejectMacro]; \ 73 | OCMStubRecorder *recorder = nil; \ 74 | @try{ \ 75 | invocation; \ 76 | }@finally{ \ 77 | recorder = [OCMMacroState endRejectMacro]; \ 78 | } \ 79 | recorder; \ 80 | ); \ 81 | }) 82 | 83 | #define ClassMethod(invocation) \ 84 | _OCMSilenceWarnings( \ 85 | [[OCMMacroState globalState] switchToClassMethod]; \ 86 | invocation; \ 87 | ); 88 | 89 | 90 | #define OCMVerifyAll(mock) [mock verifyAtLocation:OCMMakeLocation(self, __FILE__, __LINE__)] 91 | 92 | #define OCMVerifyAllWithDelay(mock, delay) [mock verifyWithDelay:delay atLocation:OCMMakeLocation(self, __FILE__, __LINE__)] 93 | 94 | #define OCMVerify(invocation) \ 95 | ({ \ 96 | _OCMSilenceWarnings( \ 97 | [OCMMacroState beginVerifyMacroAtLocation:OCMMakeLocation(self, __FILE__, __LINE__)]; \ 98 | @try{ \ 99 | invocation; \ 100 | }@finally{ \ 101 | [OCMMacroState endVerifyMacro]; \ 102 | } \ 103 | ); \ 104 | }) 105 | 106 | #define _OCMSilenceWarnings(macro) \ 107 | ({ \ 108 | _Pragma("clang diagnostic push") \ 109 | _Pragma("clang diagnostic ignored \"-Wunused-value\"") \ 110 | _Pragma("clang diagnostic ignored \"-Wunused-getter-return-value\"") \ 111 | macro \ 112 | _Pragma("clang diagnostic pop") \ 113 | }) 114 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCMockObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @class OCMLocation; 20 | @class OCMInvocationStub; 21 | @class OCMStubRecorder; 22 | @class OCMInvocationMatcher; 23 | @class OCMInvocationExpectation; 24 | 25 | 26 | @interface OCMockObject : NSProxy 27 | { 28 | BOOL isNice; 29 | BOOL expectationOrderMatters; 30 | NSMutableArray *stubs; 31 | NSMutableArray *expectations; 32 | NSMutableArray *exceptions; 33 | NSMutableArray *invocations; 34 | } 35 | 36 | + (id)mockForClass:(Class)aClass; 37 | + (id)mockForProtocol:(Protocol *)aProtocol; 38 | + (id)partialMockForObject:(NSObject *)anObject; 39 | 40 | + (id)niceMockForClass:(Class)aClass; 41 | + (id)niceMockForProtocol:(Protocol *)aProtocol; 42 | 43 | + (id)observerMock; 44 | 45 | - (instancetype)init; 46 | 47 | - (void)setExpectationOrderMatters:(BOOL)flag; 48 | 49 | - (id)stub; 50 | - (id)expect; 51 | - (id)reject; 52 | 53 | - (id)verify; 54 | - (id)verifyAtLocation:(OCMLocation *)location; 55 | 56 | - (void)verifyWithDelay:(NSTimeInterval)delay; 57 | - (void)verifyWithDelay:(NSTimeInterval)delay atLocation:(OCMLocation *)location; 58 | 59 | - (void)stopMocking; 60 | 61 | // internal use only 62 | 63 | - (void)addStub:(OCMInvocationStub *)aStub; 64 | - (void)addExpectation:(OCMInvocationExpectation *)anExpectation; 65 | 66 | - (BOOL)handleInvocation:(NSInvocation *)anInvocation; 67 | - (void)handleUnRecordedInvocation:(NSInvocation *)anInvocation; 68 | - (BOOL)handleSelector:(SEL)sel; 69 | 70 | - (void)verifyInvocation:(OCMInvocationMatcher *)matcher; 71 | - (void)verifyInvocation:(OCMInvocationMatcher *)matcher atLocation:(OCMLocation *)location; 72 | 73 | @end 74 | 75 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCObserverMockObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @class OCMLocation; 20 | 21 | 22 | @interface OCObserverMockObject : NSObject 23 | { 24 | BOOL expectationOrderMatters; 25 | NSMutableArray *recorders; 26 | NSMutableArray *centers; 27 | } 28 | 29 | - (void)setExpectationOrderMatters:(BOOL)flag; 30 | 31 | - (id)expect; 32 | 33 | - (void)verify; 34 | - (void)verifyAtLocation:(OCMLocation *)location; 35 | 36 | - (void)handleNotification:(NSNotification *)aNotification; 37 | 38 | // internal use 39 | 40 | - (void)autoRemoveFromCenter:(NSNotificationCenter *)aCenter; 41 | - (NSNotification *)notificationWithName:(NSString *)name object:(id)sender; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCObserverMockObject.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCObserverMockObject.h" 18 | #import "OCMObserverRecorder.h" 19 | #import "OCMLocation.h" 20 | #import "OCMFunctionsPrivate.h" 21 | 22 | 23 | @implementation OCObserverMockObject 24 | 25 | #pragma mark Initialisers, description, accessors, etc. 26 | 27 | - (id)init 28 | { 29 | if ((self = [super init])) 30 | { 31 | recorders = [[NSMutableArray alloc] init]; 32 | centers = [[NSMutableArray alloc] init]; 33 | } 34 | 35 | return self; 36 | } 37 | 38 | - (id)retain 39 | { 40 | return [super retain]; 41 | } 42 | 43 | - (void)dealloc 44 | { 45 | for(NSNotificationCenter *c in centers) 46 | [c removeObserver:self]; 47 | [centers release]; 48 | [recorders release]; 49 | [super dealloc]; 50 | } 51 | 52 | - (NSString *)description 53 | { 54 | return @"OCMockObserver"; 55 | } 56 | 57 | - (void)setExpectationOrderMatters:(BOOL)flag 58 | { 59 | expectationOrderMatters = flag; 60 | } 61 | 62 | - (void)autoRemoveFromCenter:(NSNotificationCenter *)aCenter 63 | { 64 | @synchronized(centers) 65 | { 66 | [centers addObject:aCenter]; 67 | } 68 | } 69 | 70 | 71 | #pragma mark Public API 72 | 73 | - (id)expect 74 | { 75 | OCMObserverRecorder *recorder = [[[OCMObserverRecorder alloc] init] autorelease]; 76 | @synchronized(recorders) 77 | { 78 | [recorders addObject:recorder]; 79 | } 80 | return recorder; 81 | } 82 | 83 | - (void)verify 84 | { 85 | [self verifyAtLocation:nil]; 86 | } 87 | 88 | - (void)verifyAtLocation:(OCMLocation *)location 89 | { 90 | @synchronized(recorders) 91 | { 92 | if([recorders count] == 1) 93 | { 94 | NSString *description = [NSString stringWithFormat:@"%@: expected notification was not observed: %@", 95 | [self description], [[recorders lastObject] description]]; 96 | OCMReportFailure(location, description); 97 | } 98 | else if([recorders count] > 0) 99 | { 100 | NSString *description = [NSString stringWithFormat:@"%@ : %@ expected notifications were not observed.", 101 | [self description], @([recorders count])]; 102 | OCMReportFailure(location, description); 103 | } 104 | } 105 | } 106 | 107 | 108 | #pragma mark Receiving recording requests via macro 109 | 110 | - (NSNotification *)notificationWithName:(NSString *)name object:(id)sender 111 | { 112 | return [[self expect] notificationWithName:name object:sender]; 113 | } 114 | 115 | 116 | #pragma mark Receiving notifications 117 | 118 | - (void)handleNotification:(NSNotification *)aNotification 119 | { 120 | @synchronized(recorders) 121 | { 122 | NSUInteger i, limit; 123 | 124 | limit = expectationOrderMatters ? 1 : [recorders count]; 125 | for(i = 0; i < limit; i++) 126 | { 127 | if([[recorders objectAtIndex:i] matchesNotification:aNotification]) 128 | { 129 | [recorders removeObjectAtIndex:i]; 130 | return; 131 | } 132 | } 133 | } 134 | [NSException raise:NSInternalInconsistencyException format:@"%@: unexpected notification observed: %@", [self description], 135 | [aNotification description]]; 136 | } 137 | 138 | 139 | @end 140 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCPartialMockObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCClassMockObject.h" 18 | 19 | @interface OCPartialMockObject : OCClassMockObject 20 | { 21 | NSObject *realObject; 22 | } 23 | 24 | - (id)initWithObject:(NSObject *)anObject; 25 | 26 | - (NSObject *)realObject; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCPartialMockObject.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import "OCMockObject.h" 19 | #import "OCPartialMockObject.h" 20 | #import "NSMethodSignature+OCMAdditions.h" 21 | #import "NSObject+OCMAdditions.h" 22 | #import "OCMFunctionsPrivate.h" 23 | #import "OCMInvocationStub.h" 24 | 25 | 26 | @implementation OCPartialMockObject 27 | 28 | #pragma mark Initialisers, description, accessors, etc. 29 | 30 | - (id)initWithObject:(NSObject *)anObject 31 | { 32 | NSParameterAssert(anObject != nil); 33 | [self assertClassIsSupported:[anObject class]]; 34 | [super initWithClass:[anObject class]]; 35 | realObject = [anObject retain]; 36 | [self prepareObjectForInstanceMethodMocking]; 37 | return self; 38 | } 39 | 40 | - (void)dealloc 41 | { 42 | [self stopMocking]; 43 | [realObject release]; 44 | [super dealloc]; 45 | } 46 | 47 | - (NSString *)description 48 | { 49 | return [NSString stringWithFormat:@"OCPartialMockObject(%@)", NSStringFromClass(mockedClass)]; 50 | } 51 | 52 | - (NSObject *)realObject 53 | { 54 | return realObject; 55 | } 56 | 57 | #pragma mark Helper methods 58 | 59 | - (void)assertClassIsSupported:(Class)class 60 | { 61 | NSString *classname = NSStringFromClass(class); 62 | NSString *reason = nil; 63 | if([classname hasPrefix:@"__NSTagged"] || [classname hasPrefix:@"NSTagged"]) 64 | reason = [NSString stringWithFormat:@"OCMock does not support partially mocking tagged classes; got %@", classname]; 65 | else if([classname hasPrefix:@"__NSCF"]) 66 | reason = [NSString stringWithFormat:@"OCMock does not support partially mocking toll-free bridged classes; got %@", classname]; 67 | 68 | if(reason != nil) 69 | [[NSException exceptionWithName:NSInvalidArgumentException reason:reason userInfo:nil] raise]; 70 | } 71 | 72 | 73 | #pragma mark Extending/overriding superclass behaviour 74 | 75 | - (void)stopMocking 76 | { 77 | if(realObject != nil) 78 | { 79 | Class partialMockClass = object_getClass(realObject); 80 | OCMSetAssociatedMockForObject(nil, realObject); 81 | object_setClass(realObject, [self mockedClass]); 82 | [realObject release]; 83 | realObject = nil; 84 | objc_disposeClassPair(partialMockClass); 85 | } 86 | [super stopMocking]; 87 | } 88 | 89 | - (void)addStub:(OCMInvocationStub *)aStub 90 | { 91 | [super addStub:aStub]; 92 | if(![aStub recordedAsClassMethod]) 93 | [self setupForwarderForSelector:[[aStub recordedInvocation] selector]]; 94 | } 95 | 96 | - (void)handleUnRecordedInvocation:(NSInvocation *)anInvocation 97 | { 98 | [anInvocation invokeWithTarget:realObject]; 99 | } 100 | 101 | 102 | #pragma mark Subclass management 103 | 104 | - (void)prepareObjectForInstanceMethodMocking 105 | { 106 | OCMSetAssociatedMockForObject(self, realObject); 107 | 108 | /* dynamically create a subclass and set it as the class of the object */ 109 | Class subclass = OCMCreateSubclass(mockedClass, realObject); 110 | object_setClass(realObject, subclass); 111 | 112 | /* point forwardInvocation: of the object to the implementation in the mock */ 113 | Method myForwardMethod = class_getInstanceMethod([self mockObjectClass], @selector(forwardInvocationForRealObject:)); 114 | IMP myForwardIMP = method_getImplementation(myForwardMethod); 115 | class_addMethod(subclass, @selector(forwardInvocation:), myForwardIMP, method_getTypeEncoding(myForwardMethod)); 116 | 117 | /* do the same for forwardingTargetForSelector, remember existing imp with alias selector */ 118 | Method myForwardingTargetMethod = class_getInstanceMethod([self mockObjectClass], @selector(forwardingTargetForSelectorForRealObject:)); 119 | IMP myForwardingTargetIMP = method_getImplementation(myForwardingTargetMethod); 120 | IMP originalForwardingTargetIMP = [mockedClass instanceMethodForSelector:@selector(forwardingTargetForSelector:)]; 121 | class_addMethod(subclass, @selector(forwardingTargetForSelector:), myForwardingTargetIMP, method_getTypeEncoding(myForwardingTargetMethod)); 122 | class_addMethod(subclass, @selector(ocmock_replaced_forwardingTargetForSelector:), originalForwardingTargetIMP, method_getTypeEncoding(myForwardingTargetMethod)); 123 | 124 | /* We also override the -class method to return the original class */ 125 | Method myObjectClassMethod = class_getInstanceMethod([self mockObjectClass], @selector(classForRealObject)); 126 | const char *objectClassTypes = method_getTypeEncoding(myObjectClassMethod); 127 | IMP myObjectClassImp = method_getImplementation(myObjectClassMethod); 128 | class_addMethod(subclass, @selector(class), myObjectClassImp, objectClassTypes); 129 | 130 | /* Adding forwarder for most instance methods to allow for verify after run */ 131 | NSArray *methodBlackList = @[@"class", @"forwardingTargetForSelector:", @"methodSignatureForSelector:", @"forwardInvocation:", 132 | @"allowsWeakReference", @"retainWeakReference", @"isBlock", @"retainCount", @"retain", @"release", @"autorelease"]; 133 | [NSObject enumerateMethodsInClass:mockedClass usingBlock:^(Class cls, SEL sel) { 134 | if((cls == [NSObject class]) || (cls == [NSProxy class])) 135 | return; 136 | NSString *className = NSStringFromClass(cls); 137 | NSString *selName = NSStringFromSelector(sel); 138 | if(([className hasPrefix:@"NS"] || [className hasPrefix:@"UI"]) && 139 | ([selName hasPrefix:@"_"] || [selName hasSuffix:@"_"])) 140 | return; 141 | if([methodBlackList containsObject:selName]) 142 | return; 143 | @try 144 | { 145 | [self setupForwarderForSelector:sel]; 146 | } 147 | @catch(NSException *e) 148 | { 149 | // ignore for now 150 | } 151 | }]; 152 | } 153 | 154 | - (void)setupForwarderForSelector:(SEL)sel 155 | { 156 | SEL aliasSelector = OCMAliasForOriginalSelector(sel); 157 | if(class_getInstanceMethod(object_getClass(realObject), aliasSelector) != NULL) 158 | return; 159 | 160 | Method originalMethod = class_getInstanceMethod(mockedClass, sel); 161 | IMP originalIMP = method_getImplementation(originalMethod); 162 | const char *types = method_getTypeEncoding(originalMethod); 163 | /* Might be NULL if the selector is forwarded to another class */ 164 | // TODO: check the fallback implementation is actually sufficient 165 | if(types == NULL) 166 | types = ([[mockedClass instanceMethodSignatureForSelector:sel] fullObjCTypes]); 167 | 168 | Class subclass = object_getClass([self realObject]); 169 | IMP forwarderIMP = [mockedClass instanceMethodForwarderForSelector:sel]; 170 | class_replaceMethod(subclass, sel, forwarderIMP, types); 171 | class_addMethod(subclass, aliasSelector, originalIMP, types); 172 | } 173 | 174 | 175 | // Implementation of the -class method; return the Class that was reported with [realObject class] prior to mocking 176 | - (Class)classForRealObject 177 | { 178 | // in here "self" is a reference to the real object, not the mock 179 | OCPartialMockObject *mock = OCMGetAssociatedMockForObject(self); 180 | if(mock == nil) 181 | [NSException raise:NSInternalInconsistencyException format:@"No partial mock for object %p", self]; 182 | return [mock mockedClass]; 183 | } 184 | 185 | 186 | - (id)forwardingTargetForSelectorForRealObject:(SEL)sel 187 | { 188 | // in here "self" is a reference to the real object, not the mock 189 | OCPartialMockObject *mock = OCMGetAssociatedMockForObject(self); 190 | if(mock == nil) 191 | [NSException raise:NSInternalInconsistencyException format:@"No partial mock for object %p", self]; 192 | if([mock handleSelector:sel]) 193 | return self; 194 | 195 | return [self ocmock_replaced_forwardingTargetForSelector:sel]; 196 | } 197 | 198 | // Make the compiler happy in -forwardingTargetForSelectorForRealObject: because it can't find the message… 199 | - (id)ocmock_replaced_forwardingTargetForSelector:(SEL)sel 200 | { 201 | return nil; 202 | } 203 | 204 | 205 | - (void)forwardInvocationForRealObject:(NSInvocation *)anInvocation 206 | { 207 | // in here "self" is a reference to the real object, not the mock 208 | OCPartialMockObject *mock = OCMGetAssociatedMockForObject(self); 209 | if(mock == nil) 210 | [NSException raise:NSInternalInconsistencyException format:@"No partial mock for object %p", self]; 211 | 212 | if([mock handleInvocation:anInvocation] == NO) 213 | { 214 | [anInvocation setSelector:OCMAliasForOriginalSelector([anInvocation selector])]; 215 | [anInvocation invoke]; 216 | } 217 | } 218 | 219 | 220 | @end 221 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCProtocolMockObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCProtocolMockObject : OCMockObject 20 | { 21 | Protocol *mockedProtocol; 22 | } 23 | 24 | - (id)initWithProtocol:(Protocol *)aProtocol; 25 | 26 | @end 27 | 28 | -------------------------------------------------------------------------------- /sample project/Pods/OCMock/Source/OCMock/OCProtocolMockObject.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import "NSMethodSignature+OCMAdditions.h" 19 | #import "OCProtocolMockObject.h" 20 | 21 | @implementation OCProtocolMockObject 22 | 23 | #pragma mark Initialisers, description, accessors, etc. 24 | 25 | - (id)initWithProtocol:(Protocol *)aProtocol 26 | { 27 | NSParameterAssert(aProtocol != nil); 28 | [super init]; 29 | mockedProtocol = aProtocol; 30 | return self; 31 | } 32 | 33 | - (NSString *)description 34 | { 35 | const char* name = protocol_getName(mockedProtocol); 36 | return [NSString stringWithFormat:@"OCMockObject(%s)", name]; 37 | } 38 | 39 | #pragma mark Proxy API 40 | 41 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector 42 | { 43 | struct { BOOL isRequired; BOOL isInstance; } opts[4] = { {YES, YES}, {NO, YES}, {YES, NO}, {NO, NO} }; 44 | for(int i = 0; i < 4; i++) 45 | { 46 | struct objc_method_description methodDescription = protocol_getMethodDescription(mockedProtocol, aSelector, opts[i].isRequired, opts[i].isInstance); 47 | if(methodDescription.name != NULL) 48 | return [NSMethodSignature signatureWithObjCTypes:methodDescription.types]; 49 | } 50 | return nil; 51 | } 52 | 53 | - (BOOL)conformsToProtocol:(Protocol *)aProtocol 54 | { 55 | return protocol_conformsToProtocol(mockedProtocol, aProtocol); 56 | } 57 | 58 | - (BOOL)respondsToSelector:(SEL)selector 59 | { 60 | return ([self methodSignatureForSelector:selector] != nil); 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /sample project/Pods/Pods.xcodeproj/xcuserdata/Zrizi.xcuserdatad/xcschemes/OCMock.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 66 | 67 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /sample project/Pods/Pods.xcodeproj/xcuserdata/Zrizi.xcuserdatad/xcschemes/Pods-RolloutManagerSampleAppTests.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 66 | 67 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /sample project/Pods/Pods.xcodeproj/xcuserdata/Zrizi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OCMock.xcscheme 8 | 9 | isShown 10 | 11 | 12 | Pods-RolloutManagerSampleAppTests.xcscheme 13 | 14 | isShown 15 | 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | 51DCB640FA15D0599EBE953A4F76C5EA 21 | 22 | primary 23 | 24 | 25 | A561198B7669F579C29FC6864AE4991F 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /sample project/Pods/Target Support Files/OCMock/OCMock-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_OCMock : NSObject 3 | @end 4 | @implementation PodsDummy_OCMock 5 | @end 6 | -------------------------------------------------------------------------------- /sample project/Pods/Target Support Files/OCMock/OCMock-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /sample project/Pods/Target Support Files/OCMock/OCMock.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/OCMock 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/OCMock" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/OCMock" 4 | PODS_BUILD_DIR = $BUILD_DIR 5 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 8 | SKIP_INSTALL = YES 9 | -------------------------------------------------------------------------------- /sample project/Pods/Target Support Files/Pods-RolloutManagerSampleAppTests/Pods-RolloutManagerSampleAppTests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_RolloutManagerSampleAppTests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_RolloutManagerSampleAppTests 5 | @end 6 | -------------------------------------------------------------------------------- /sample project/Pods/Target Support Files/Pods-RolloutManagerSampleAppTests/Pods-RolloutManagerSampleAppTests-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements \"$1\"" 63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1" 64 | fi 65 | } 66 | 67 | # Strip invalid architectures 68 | strip_invalid_archs() { 69 | binary="$1" 70 | # Get architectures for current file 71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 72 | stripped="" 73 | for arch in $archs; do 74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 75 | # Strip non-valid architectures in-place 76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 77 | stripped="$stripped $arch" 78 | fi 79 | done 80 | if [[ "$stripped" ]]; then 81 | echo "Stripped $binary of architectures:$stripped" 82 | fi 83 | } 84 | 85 | -------------------------------------------------------------------------------- /sample project/Pods/Target Support Files/Pods-RolloutManagerSampleAppTests/Pods-RolloutManagerSampleAppTests-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | case "${TARGETED_DEVICE_FAMILY}" in 12 | 1,2) 13 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 14 | ;; 15 | 1) 16 | TARGET_DEVICE_ARGS="--target-device iphone" 17 | ;; 18 | 2) 19 | TARGET_DEVICE_ARGS="--target-device ipad" 20 | ;; 21 | *) 22 | TARGET_DEVICE_ARGS="--target-device mac" 23 | ;; 24 | esac 25 | 26 | install_resource() 27 | { 28 | if [[ "$1" = /* ]] ; then 29 | RESOURCE_PATH="$1" 30 | else 31 | RESOURCE_PATH="${PODS_ROOT}/$1" 32 | fi 33 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 34 | cat << EOM 35 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 36 | EOM 37 | exit 1 38 | fi 39 | case $RESOURCE_PATH in 40 | *.storyboard) 41 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 42 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 43 | ;; 44 | *.xib) 45 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 46 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 47 | ;; 48 | *.framework) 49 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 50 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 51 | echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 52 | rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 53 | ;; 54 | *.xcdatamodel) 55 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" 56 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 57 | ;; 58 | *.xcdatamodeld) 59 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" 60 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 61 | ;; 62 | *.xcmappingmodel) 63 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" 64 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 65 | ;; 66 | *.xcassets) 67 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 68 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 69 | ;; 70 | *) 71 | echo "$RESOURCE_PATH" 72 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 73 | ;; 74 | esac 75 | } 76 | 77 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 78 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 79 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 80 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 81 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 82 | fi 83 | rm -f "$RESOURCES_TO_COPY" 84 | 85 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 86 | then 87 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 88 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 89 | while read line; do 90 | if [[ $line != "${PODS_ROOT}*" ]]; then 91 | XCASSET_FILES+=("$line") 92 | fi 93 | done <<<"$OTHER_XCASSETS" 94 | 95 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 96 | fi 97 | -------------------------------------------------------------------------------- /sample project/Pods/Target Support Files/Pods-RolloutManagerSampleAppTests/Pods-RolloutManagerSampleAppTests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/OCMock" 4 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/OCMock" 5 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/OCMock" 6 | OTHER_LDFLAGS = $(inherited) -ObjC -l"OCMock" 7 | PODS_BUILD_DIR = $BUILD_DIR 8 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /sample project/Pods/Target Support Files/Pods-RolloutManagerSampleAppTests/Pods-RolloutManagerSampleAppTests.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/OCMock" 4 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/OCMock" 5 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/OCMock" 6 | OTHER_LDFLAGS = $(inherited) -ObjC -l"OCMock" 7 | PODS_BUILD_DIR = $BUILD_DIR 8 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /sample project/RolloutManagerSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /sample project/RolloutManagerSampleApp.xcodeproj/project.xcworkspace/xcuserdata/Zrizi.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk/RolloutManager-iOS/0a861df5efaf8604676ad9559f912efb8dcff835/sample project/RolloutManagerSampleApp.xcodeproj/project.xcworkspace/xcuserdata/Zrizi.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /sample project/RolloutManagerSampleApp.xcodeproj/xcuserdata/Zrizi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SuppressBuildableAutocreation 8 | 9 | 17E1E3FB1DD8890100F9C490 10 | 11 | primary 12 | 13 | 14 | 17E1E4141DD8890200F9C490 15 | 16 | primary 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /sample project/RolloutManagerSampleApp.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /sample project/RolloutManagerSampleApp.xcworkspace/xcshareddata/xcschemes/RolloutManagerSampleApp.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /sample project/RolloutManagerSampleApp.xcworkspace/xcuserdata/Zrizi.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk/RolloutManager-iOS/0a861df5efaf8604676ad9559f912efb8dcff835/sample project/RolloutManagerSampleApp.xcworkspace/xcuserdata/Zrizi.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /sample project/RolloutManagerSampleApp.xcworkspace/xcuserdata/Zrizi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /sample project/RolloutManagerSampleApp.xcworkspace/xcuserdata/Zrizi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | RolloutManagerSampleApp.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /sample project/RolloutManagerSampleApp/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // RolloutManagerSampleApp 4 | // 5 | // Created by Asaf Shveki on 13/11/2016. 6 | // Copyright © 2016 Autodesk. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /sample project/RolloutManagerSampleApp/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // RolloutManagerSampleApp 4 | // 5 | // Created by Asaf Shveki on 13/11/2016. 6 | // Copyright © 2016 Autodesk. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /sample project/RolloutManagerSampleApp/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /sample project/RolloutManagerSampleApp/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /sample project/RolloutManagerSampleApp/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /sample project/RolloutManagerSampleApp/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /sample project/RolloutManagerSampleApp/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // RolloutManagerSampleApp 4 | // 5 | // Created by Asaf Shveki on 13/11/2016. 6 | // Copyright © 2016 Autodesk. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /sample project/RolloutManagerSampleApp/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // RolloutManagerSampleApp 4 | // 5 | // Created by Asaf Shveki on 13/11/2016. 6 | // Copyright © 2016 Autodesk. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | } 21 | 22 | 23 | - (void)didReceiveMemoryWarning { 24 | [super didReceiveMemoryWarning]; 25 | // Dispose of any resources that can be recreated. 26 | } 27 | 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /sample project/RolloutManagerSampleApp/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // RolloutManagerSampleApp 4 | // 5 | // Created by Asaf Shveki on 13/11/2016. 6 | // Copyright © 2016 Autodesk. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /sample project/RolloutManagerSampleAppTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | --------------------------------------------------------------------------------