├── .gitignore
├── LICENCE.txt
├── M3Foundation.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
└── xcshareddata
│ └── xcdebugger
│ └── Breakpoints.xcbkptlist
├── M3Foundation
├── Info.plist
├── Info.plist.prefix
├── M3Foundation_Prefix.pch
├── Resources
│ └── English.lproj
│ │ └── InfoPlist.strings
├── Source
│ ├── M3CSVValueTransformer.h
│ ├── M3CSVValueTransformer.m
│ ├── M3FileSizeValueTransformer.h
│ ├── M3FileSizeValueTransformer.m
│ ├── M3Foundation.h
│ ├── M3URLConnectionOperation.h
│ ├── M3URLConnectionOperation.m
│ ├── NSArray+M3Extensions.h
│ ├── NSArray+M3Extensions.m
│ ├── NSComparisonPredicate+M3Extensions.h
│ ├── NSComparisonPredicate+M3Extensions.m
│ ├── NSCompoundPredicate+M3Extensions.h
│ ├── NSCompoundPredicate+M3Extensions.m
│ ├── NSCountedSet+M3Extensions.h
│ ├── NSCountedSet+M3Extensions.m
│ ├── NSDictionary+M3Extensions.h
│ ├── NSDictionary+M3Extensions.m
│ ├── NSExpression+M3Extensions.h
│ ├── NSExpression+M3Extensions.m
│ ├── NSKeyValueObserving+M3Extensions.h
│ ├── NSKeyValueObserving+M3Extensions.m
│ ├── NSMapTable+M3Extensions.h
│ ├── NSMapTable+M3Extensions.m
│ ├── NSMutableArray+M3Extensions.h
│ ├── NSMutableArray+M3Extensions.m
│ ├── NSMutableDictionary+M3Extensions.h
│ ├── NSMutableDictionary+M3Extensions.m
│ ├── NSObject+M3Extensions.h
│ ├── NSObject+M3Extensions.m
│ ├── NSPredicate+M3Extensions.h
│ ├── NSPredicate+M3Extensions.m
│ ├── NSString+M3Extensions.h
│ ├── NSString+M3Extensions.m
│ ├── NSXMLElement+M3Extensions.h
│ ├── NSXMLElement+M3Extensions.m
│ ├── NSXMLNode+M3Extensions.h
│ └── NSXMLNode+M3Extensions.m
└── version.plist
├── M3FoundationTests
├── Dependencies
│ └── OCHamcrest.framework
│ │ ├── Headers
│ │ ├── OCHamcrest
│ │ ├── Resources
│ │ └── Versions
│ │ ├── A
│ │ ├── Headers
│ │ │ ├── HCAllOf.h
│ │ │ ├── HCAnyOf.h
│ │ │ ├── HCAssertThat.h
│ │ │ ├── HCBaseDescription.h
│ │ │ ├── HCBaseMatcher.h
│ │ │ ├── HCBoxNumber.h
│ │ │ ├── HCCollectMatchers.h
│ │ │ ├── HCConformsToProtocol.h
│ │ │ ├── HCDescribedAs.h
│ │ │ ├── HCDescription.h
│ │ │ ├── HCHasCount.h
│ │ │ ├── HCHasDescription.h
│ │ │ ├── HCHasProperty.h
│ │ │ ├── HCInvocationMatcher.h
│ │ │ ├── HCIs.h
│ │ │ ├── HCIsAnything.h
│ │ │ ├── HCIsCloseTo.h
│ │ │ ├── HCIsCollectionContaining.h
│ │ │ ├── HCIsCollectionContainingInAnyOrder.h
│ │ │ ├── HCIsCollectionContainingInOrder.h
│ │ │ ├── HCIsCollectionOnlyContaining.h
│ │ │ ├── HCIsDictionaryContaining.h
│ │ │ ├── HCIsDictionaryContainingEntries.h
│ │ │ ├── HCIsDictionaryContainingKey.h
│ │ │ ├── HCIsDictionaryContainingValue.h
│ │ │ ├── HCIsEmptyCollection.h
│ │ │ ├── HCIsEqual.h
│ │ │ ├── HCIsEqualIgnoringCase.h
│ │ │ ├── HCIsEqualIgnoringWhiteSpace.h
│ │ │ ├── HCIsEqualToNumber.h
│ │ │ ├── HCIsIn.h
│ │ │ ├── HCIsInstanceOf.h
│ │ │ ├── HCIsNil.h
│ │ │ ├── HCIsNot.h
│ │ │ ├── HCIsSame.h
│ │ │ ├── HCMatcher.h
│ │ │ ├── HCNumberAssert.h
│ │ │ ├── HCOrderingComparison.h
│ │ │ ├── HCRequireNonNilObject.h
│ │ │ ├── HCRequireNonNilString.h
│ │ │ ├── HCSelfDescribing.h
│ │ │ ├── HCStringContains.h
│ │ │ ├── HCStringContainsInOrder.h
│ │ │ ├── HCStringDescription.h
│ │ │ ├── HCStringEndsWith.h
│ │ │ ├── HCStringStartsWith.h
│ │ │ ├── HCSubstringMatcher.h
│ │ │ ├── HCWrapInMatcher.h
│ │ │ └── OCHamcrest.h
│ │ ├── OCHamcrest
│ │ └── Resources
│ │ │ └── Info.plist
│ │ └── Current
├── M3FoundationTests-Info.plist
├── M3FoundationTests_Prefix.pch
├── Resources
│ └── NSPredicateXMLTestData.txt
└── Source
│ ├── M3CSVValueTransformerTests.h
│ ├── M3CSVValueTransformerTests.m
│ ├── M3FileSizeValueTransformerTests.h
│ ├── M3FileSizeValueTransformerTests.m
│ ├── M3TestObject.h
│ ├── M3TestObject.m
│ ├── M3URLConnectionOperationTests.h
│ ├── M3URLConnectionOperationTests.m
│ ├── NSArray+M3ExtensionsTests.h
│ ├── NSArray+M3ExtensionsTests.m
│ ├── NSCountedSet+M3Extensions.h
│ ├── NSCountedSet+M3Extensions.m
│ ├── NSDictionary+M3ExtensionsTests.h
│ ├── NSDictionary+M3ExtensionsTests.m
│ ├── NSMapTable+M3Extensions.h
│ ├── NSMapTable+M3Extensions.m
│ ├── NSMutableArray+M3Extensions.h
│ ├── NSMutableArray+M3Extensions.m
│ ├── NSMutableDictionary+M3ExtensionTests.h
│ ├── NSMutableDictionary+M3ExtensionTests.m
│ ├── NSObject+M3ExtensionsTests.h
│ ├── NSObject+M3ExtensionsTests.m
│ ├── NSPredicate+M3ExtensionsTests.h
│ ├── NSPredicate+M3ExtensionsTests.m
│ ├── NSString+M3ExtensionsTest.h
│ ├── NSString+M3ExtensionsTest.m
│ ├── NSXMLElement+M3ExtensionsTests.h
│ ├── NSXMLElement+M3ExtensionsTests.m
│ ├── NSXMLNode+M3ExtensionsTests.h
│ └── NSXMLNode+M3ExtensionsTests.m
├── README.md
└── Scripts
└── processbuildnumbers.rb
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | build
3 | *.pbxuser
4 | *.perspective
5 | *.perspectivev3
6 | *~.nib
7 | *.mode1
8 | *.mode1v3
9 | xcuserdata
--------------------------------------------------------------------------------
/LICENCE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2006-2013 by M Cubed Software Ltd
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
21 |
22 |
--------------------------------------------------------------------------------
/M3Foundation.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/M3Foundation.xcodeproj/xcshareddata/xcdebugger/Breakpoints.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/M3Foundation/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleName
10 | ${PRODUCT_NAME}
11 | CFBundleIconFile
12 |
13 | CFBundleIdentifier
14 | com.mcubedsw.${PRODUCT_NAME:rfc1034Identifier}
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundlePackageType
18 | FMWK
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | BUNDLEVERSION
23 | M3CommitHash
24 | COMMITHASH
25 | CFBundleShortVersionString
26 | 1.0
27 | NSPrincipalClass
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/M3Foundation/Info.plist.prefix:
--------------------------------------------------------------------------------
1 | #define BUNDLEVERSION __BUNDLE_VERSION__
2 | #define COMMITHASH __COMMIT_HASH__
--------------------------------------------------------------------------------
/M3Foundation/M3Foundation_Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'M3Foundation' target in the 'M3Foundation' project.
3 | //
4 |
5 | #ifdef __OBJC__
6 | #import
7 | #endif
8 |
--------------------------------------------------------------------------------
/M3Foundation/Resources/English.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys***************************/
2 |
3 |
--------------------------------------------------------------------------------
/M3Foundation/Source/M3CSVValueTransformer.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | M3CSVValueTransformer.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 02/08/2009.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 |
11 | /***************************
12 | Converts a list of comma separated variables into an array and back
13 | @since M3Foundation 1.0 and later
14 | ***************************/
15 | @interface M3CSVValueTransformer : NSValueTransformer
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/M3Foundation/Source/M3CSVValueTransformer.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | M3CSVValueTransformer.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 02/08/2009.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "M3CSVValueTransformer.h"
11 |
12 |
13 | @implementation M3CSVValueTransformer
14 |
15 |
16 | + (Class)transformedValueClass {
17 | return [NSString class];
18 | }
19 |
20 |
21 | + (BOOL)allowsReverseTransformation {
22 | return YES;
23 | }
24 |
25 |
26 | - (id)transformedValue:(id)aValue {
27 | if (![aValue isKindOfClass:[NSString class]]) {
28 | return nil;
29 | }
30 | if (![aValue length]) {
31 | return nil;
32 | }
33 | return [aValue componentsSeparatedByString:@","];
34 | }
35 |
36 |
37 | - (id)reverseTransformedValue:(id)aValue {
38 | if (![aValue isKindOfClass:[NSArray class]]) {
39 | return nil;
40 | }
41 | if(![aValue count]) {
42 | return nil;
43 | }
44 | return [aValue componentsJoinedByString:@","];
45 | }
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/M3Foundation/Source/M3FileSizeValueTransformer.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | M3FileSizeValueTransformer.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 16/08/2009.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 |
11 | /***************************
12 | Takes a value in bytes and converts it into the most appropriate unit eg 2048 bytes would return "2 KB"
13 | @since M3Foundation 1.0 and later
14 | ***************************/
15 | @interface M3FileSizeValueTransformer : NSValueTransformer {
16 |
17 | }
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/M3Foundation/Source/M3FileSizeValueTransformer.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | M3FileSizeValueTransformer.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 16/08/2009.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "M3FileSizeValueTransformer.h"
11 |
12 |
13 | @implementation M3FileSizeValueTransformer
14 |
15 |
16 | + (Class)transformedValueClass {
17 | return [NSString class];
18 | }
19 |
20 |
21 | + (BOOL)allowsReverseTransformation {
22 | return NO;
23 | }
24 |
25 |
26 | - (id)transformedValue:(id)aValue {
27 | if (![aValue isKindOfClass:[NSNumber class]]) {
28 | return nil;
29 | }
30 |
31 | double fileSize = [aValue doubleValue];
32 | NSArray *units = @[ @"bytes", @"KB", @"MB", @"GB", @"TB", @"PB", @"EB", @"ZB", @"YB" ];
33 | NSInteger currentIndex = 0;
34 | while (fileSize > 1000) {
35 | currentIndex++;
36 | fileSize /= 1000;
37 | }
38 | if (currentIndex == 0) {
39 | return [NSString stringWithFormat:@"%.0f %@", fileSize, units[currentIndex]];
40 | }
41 | return [NSString stringWithFormat:@"%.2f %@", fileSize, units[currentIndex]];
42 | }
43 |
44 | @end
45 |
--------------------------------------------------------------------------------
/M3Foundation/Source/M3Foundation.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | M3Foundation.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 09/01/2010.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | //Add subscripting to Map table et al
11 |
12 | #import "M3CSVValueTransformer.h"
13 | #import "M3FileSizeValueTransformer.h"
14 | #import "M3URLConnectionOperation.h"
15 |
16 | //Categories
17 | #import "NSObject+M3Extensions.h"
18 | #import "NSKeyValueObserving+M3Extensions.h"
19 | #import "NSString+M3Extensions.h"
20 |
21 | #import "NSArray+M3Extensions.h"
22 | #import "NSDictionary+M3Extensions.h"
23 | #import "NSMutableArray+M3Extensions.h"
24 | #import "NSMutableDictionary+M3Extensions.h"
25 | #import "NSCountedSet+M3Extensions.h"
26 | #import "NSMapTable+M3Extensions.h"
27 |
28 | #import "NSXMLElement+M3Extensions.h"
29 | #import "NSXMLNode+M3Extensions.h"
30 |
31 | #import "NSPredicate+M3Extensions.h"
32 | #import "NSCompoundPredicate+M3Extensions.h"
33 | #import "NSComparisonPredicate+M3Extensions.h"
34 | #import "NSExpression+M3Extensions.h"
--------------------------------------------------------------------------------
/M3Foundation/Source/M3URLConnectionOperation.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | M3URLConnectionOperation.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 01/07/2010.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 |
11 | /***************************
12 | An operation that encapsulates a URL connection
13 | Behind the scenes this uses NS
14 | @since M3Foundation 1.0 or later
15 | **************************/
16 | @interface M3URLConnectionOperation : NSOperation
17 |
18 | /***************************
19 | Initialise a new operation with the supplied request
20 | @param aRequest The request for the connection operation
21 | @return A newly initialised M3URLConnectionOperation
22 | @since M3Foundation 1.0 or later
23 | **************************/
24 | - (id)initWithURLRequest:(NSURLRequest *)aRequest;
25 |
26 | /***************************
27 | The block to call when the connection has completed
28 | This block is called on the main thread. The operation doesn't complete until after it has executed
29 | @since M3Foundation 1.0 or later
30 | **************************/
31 | @property (copy) void (^downloadCompletionBlock)(NSInteger aResponse, NSData *aData, NSError *aError);
32 |
33 | /***************************
34 | The request for the operation
35 | @since M3Foundation 1.0 or later
36 | **************************/
37 | @property (readonly) NSURLRequest *request;
38 |
39 | /***************************
40 | Whether the operation should automatically try a second time after a time out.
41 | @since M3Foundation 1.0 or later
42 | **************************/
43 | @property (assign) BOOL shouldAutomaticallyRetryAfterTimeOut;
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/M3Foundation/Source/M3URLConnectionOperation.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | M3URLConnectionOperation.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 01/07/2010.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "M3URLConnectionOperation.h"
11 |
12 |
13 | @implementation M3URLConnectionOperation
14 |
15 | - (id)init {
16 | return [self initWithURLRequest:nil];
17 | }
18 |
19 | - (id)initWithURLRequest:(NSURLRequest *)aRequest {
20 | if ((self = [super init])) {
21 | _request = aRequest;
22 | _shouldAutomaticallyRetryAfterTimeOut = YES;
23 | }
24 | return self;
25 | }
26 |
27 |
28 |
29 | - (void)main {
30 | NSHTTPURLResponse *response = nil;
31 | NSError *error = nil;
32 | NSData *data = [NSURLConnection sendSynchronousRequest:self.request returningResponse:&response error:&error];
33 |
34 | if (!data && (error.code == NSURLErrorTimedOut) && self.shouldAutomaticallyRetryAfterTimeOut) {
35 | data = [NSURLConnection sendSynchronousRequest:self.request returningResponse:&response error:&error];
36 | }
37 |
38 | [self performSelectorOnMainThread:@selector(performBlock:) withObject:^{
39 | self.downloadCompletionBlock(response.statusCode, data, error);
40 | } waitUntilDone:YES];
41 | }
42 |
43 |
44 | - (void)performBlock:(void (^)(void))aBlock {
45 | aBlock();
46 | }
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSArray+M3Extensions.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSArray+M3Extensions.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 10/09/2006.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | /**
11 | This category adds some useful class methods for generating and accessing arrays.
12 | @since M3Foundation 1.0 and later
13 | */
14 | @interface NSArray (M3Extensions)
15 |
16 | /**
17 | Creates and returns an array with strings for 0-9 a-z.
18 | @result An array containing strings for 0-9, a-z.
19 | @since M3Foundation 1.0 and later
20 | */
21 | + (NSArray *)m3_alphaNumericArray;
22 |
23 | /**
24 | Creates and returns an array or NSNumber objects from minValue to maxValue in integer steps.
25 | @param aMaxValue The maximum value in the array
26 | @param aMinValue The minimum value in the array
27 | @result An array containing NSNumbers for the supplied values, or nil on error.
28 | @since M3Foundation 1.0 and later
29 | */
30 | + (NSArray *)m3_arrayWithNumbersFrom:(NSInteger)aMinValue to:(NSInteger)aMaxValue;
31 |
32 | /**
33 | A safer version of objectAtIndex: which returns nil for an out of bounds index.
34 | @param aIndex The index of the object to retrieve
35 | @result The object at the supplied index, or nil if the index is out of bounds
36 | @since M3Foundation 1.0 and later
37 | */
38 | - (id)m3_safeObjectAtIndex:(NSUInteger)aIndex;
39 |
40 | /**
41 | Returns the first object in the array that satisfies the test
42 | @param aTest A block to implement the test
43 | @return The first object matching the test
44 | @since M3Foundation 1.0 or later
45 | */
46 | - (id)m3_firstObjectPassingTest:(BOOL (^)(id aObject))aTest;
47 |
48 | @end
--------------------------------------------------------------------------------
/M3Foundation/Source/NSArray+M3Extensions.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSArray+M3Extensions.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 10/09/2006.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSArray+M3Extensions.h"
11 |
12 | @implementation NSArray (M3Extensions)
13 |
14 |
15 | + (NSArray *)m3_alphaNumericArray {
16 | return @[
17 | @"0", @"1", @"2", @"3", @"4", @"5", @"6", @"7", @"8", @"9", @"a", @"b",
18 | @"c", @"d", @"e", @"f", @"g", @"h", @"i", @"j", @"k", @"l", @"m", @"n",
19 | @"o", @"p", @"q", @"r", @"s", @"t", @"u", @"v", @"w", @"x", @"y", @"z"
20 | ];
21 | }
22 |
23 |
24 | + (NSArray *)m3_arrayWithNumbersFrom:(NSInteger)aMinValue to:(NSInteger)aMaxValue {
25 | if (aMaxValue == aMinValue) {
26 | return nil;
27 | }
28 |
29 | NSMutableArray *returnArray = [NSMutableArray array];
30 | NSInteger i;
31 | //loop through the number sequence adding them to our array
32 | if (aMaxValue > aMinValue) {
33 | for (i = aMinValue; i <= aMaxValue; i++) {
34 | [returnArray addObject:[NSNumber numberWithInteger:i]];
35 | }
36 | } else {
37 | for (i = aMinValue; i >= aMaxValue; i--) {
38 | [returnArray addObject:[NSNumber numberWithInteger:i]];
39 | }
40 | }
41 | return [returnArray copy];
42 | }
43 |
44 |
45 | - (id)m3_safeObjectAtIndex:(NSUInteger)aIndex {
46 | if (aIndex < self.count) {
47 | return self[aIndex];
48 | }
49 | return nil;
50 | }
51 |
52 |
53 | - (id)m3_firstObjectPassingTest:(BOOL (^)(id aObject))aTest {
54 | NSArray *objects = [self filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id aEvaluatedObject, NSDictionary *aBindings) {
55 | return aTest(aEvaluatedObject);
56 | }]];
57 | return [objects m3_safeObjectAtIndex:0];
58 | }
59 |
60 | @end
--------------------------------------------------------------------------------
/M3Foundation/Source/NSComparisonPredicate+M3Extensions.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSComparisonPredicate+M3Extensions.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 01/04/2011.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 |
11 | /**
12 | Additions to NSComparisonPredicate for converting to and from XML representations
13 | @since M3Foundation 1.0 or later
14 | */
15 | @interface NSComparisonPredicate (M3Extensions)
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSComparisonPredicate+M3Extensions.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSComparisonPredicate+M3Extensions.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 01/04/2011.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSComparisonPredicate+M3Extensions.h"
11 | #import "NSExpression+M3Extensions.h"
12 | #import "NSXMLElement+M3Extensions.h"
13 | #import "NSArray+M3Extensions.h"
14 |
15 |
16 | @implementation NSComparisonPredicate (M3Extensions)
17 |
18 |
19 | + (NSPredicate *)m3_predicateWithXMLElement:(NSXMLElement *)aElement {
20 | //Get our expressions
21 | NSExpression *leftExpression = [NSExpression m3_expressionWithXMLElement:[aElement m3_elementForName:@"leftExpression"]];
22 | NSExpression *rightExpression = [NSExpression m3_expressionWithXMLElement:[aElement m3_elementForName:@"rightExpression"]];
23 |
24 | //Find our modifier value
25 | NSComparisonPredicateModifier modifier = NSDirectPredicateModifier;
26 | if ([aElement attributeForName:@"modifier"]) {
27 | NSString *attributeKey = [aElement attributeForName:@"modifier"].stringValue;
28 | NSNumber *value = [self modifierMap][attributeKey];
29 | modifier = value.integerValue;
30 | }
31 |
32 | //And our operator
33 | NSPredicateOperatorType operator = NSEqualToPredicateOperatorType;
34 | if ([aElement attributeForName:@"operatorType"]) {
35 | NSString *attributeKey = [aElement attributeForName:@"operatorType"].stringValue;
36 | NSNumber *value = [self operatorTypeMap][attributeKey];
37 | operator = value.integerValue;
38 | }
39 |
40 | //And our options
41 | NSUInteger options = 0;
42 | if ([aElement attributeForName:@"caseInsensitive"]) {
43 | options |= NSCaseInsensitivePredicateOption;
44 | }
45 | if ([aElement attributeForName:@"diacriticInsensitive"]) {
46 | options |= NSDiacriticInsensitivePredicateOption;
47 | }
48 |
49 | //Go go gadget predicate
50 | return [NSComparisonPredicate predicateWithLeftExpression:leftExpression
51 | rightExpression:rightExpression
52 | modifier:modifier
53 | type:operator
54 | options:options];
55 | }
56 |
57 |
58 | + (NSDictionary *)modifierMap {
59 | return @{
60 | @"direct":[NSNumber numberWithInt:NSDirectPredicateModifier],
61 | @"any":[NSNumber numberWithInt:NSAnyPredicateModifier],
62 | @"all":[NSNumber numberWithInt:NSAllPredicateModifier]
63 | };
64 | }
65 |
66 |
67 | + (NSDictionary *)operatorTypeMap {
68 | return @{
69 | @"lessThan":[NSNumber numberWithInt:NSLessThanPredicateOperatorType],
70 | @"lessThanOrEqualTo":[NSNumber numberWithInt:NSLessThanOrEqualToPredicateOperatorType],
71 | @"greaterThan":[NSNumber numberWithInt:NSGreaterThanPredicateOperatorType],
72 | @"greaterThanOrEqualTo":[NSNumber numberWithInt:NSGreaterThanOrEqualToPredicateOperatorType],
73 | @"equalTo":[NSNumber numberWithInt:NSEqualToPredicateOperatorType],
74 | @"matches":[NSNumber numberWithInt:NSMatchesPredicateOperatorType],
75 | @"like":[NSNumber numberWithInt:NSLikePredicateOperatorType],
76 | @"beginsWith":[NSNumber numberWithInt:NSBeginsWithPredicateOperatorType],
77 | @"endsWith":[NSNumber numberWithInt:NSEndsWithPredicateOperatorType],
78 | @"in":[NSNumber numberWithInt:NSInPredicateOperatorType],
79 | @"customSelector":[NSNumber numberWithInt:NSCustomSelectorPredicateOperatorType],
80 | @"contains":[NSNumber numberWithInt:NSContainsPredicateOperatorType],
81 | @"between":[NSNumber numberWithInt:NSBetweenPredicateOperatorType]
82 | };
83 | }
84 |
85 |
86 | - (NSString *)p_modifierString {
87 | return [[[self.class modifierMap] allKeysForObject:@(self.comparisonPredicateModifier)] m3_safeObjectAtIndex:0];;
88 | }
89 |
90 |
91 | - (NSString *)p_operatorTypeString {
92 | return [[[self.class operatorTypeMap] allKeysForObject:@(self.predicateOperatorType)] m3_safeObjectAtIndex:0];
93 | }
94 |
95 |
96 | - (NSXMLElement *)m3_xmlRepresentation {
97 | //Build a predicate element
98 | NSXMLElement *comparisonElement = [NSXMLElement elementWithName:@"predicate"];
99 |
100 | //Set all its attributes
101 | [comparisonElement addAttribute:[NSXMLNode attributeWithName:@"operatorType" stringValue:self.p_operatorTypeString]];
102 |
103 | if ([self comparisonPredicateModifier] != NSDirectPredicateModifier) {
104 | [comparisonElement addAttribute:[NSXMLNode attributeWithName:@"modifier" stringValue:self.p_modifierString]];
105 | }
106 |
107 | if ([self predicateOperatorType] == NSCustomSelectorPredicateOperatorType) {
108 | [comparisonElement addAttribute:[NSXMLNode attributeWithName:@"selector" stringValue:NSStringFromSelector(self.customSelector)]];
109 | }
110 |
111 | if ([self options] & NSCaseInsensitivePredicateOption) {
112 | [comparisonElement addAttribute:[NSXMLNode attributeWithName:@"caseInsensitive" stringValue:@"true"]];
113 | }
114 |
115 | if ([self options] & NSDiacriticInsensitivePredicateOption) {
116 | [comparisonElement addAttribute:[NSXMLNode attributeWithName:@"diacriticInsensitive" stringValue:@"true"]];
117 | }
118 |
119 | //And add its expressions
120 | NSXMLElement *leftExpressionElement = self.leftExpression.m3_xmlRepresentation;
121 | [leftExpressionElement setName:@"leftExpression"];
122 | [comparisonElement addChild:leftExpressionElement];
123 |
124 | NSXMLElement *rightExpressionElement = self.rightExpression.m3_xmlRepresentation;
125 | [rightExpressionElement setName:@"rightExpression"];
126 | [comparisonElement addChild:rightExpressionElement];
127 |
128 | return comparisonElement;
129 | }
130 |
131 | @end
132 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSCompoundPredicate+M3Extensions.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSCompoundPredicate+M3Extensions.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 01/04/2011.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 |
11 | /**
12 | Additions to NSCompoundPredicate for converting to and from XML representations
13 | @since M3Foundation 1.0 or later
14 | */
15 | @interface NSCompoundPredicate (M3Extensions)
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSCompoundPredicate+M3Extensions.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSCompoundPredicate+M3Extensions.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 01/04/2011.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSCompoundPredicate+M3Extensions.h"
11 | #import "NSPredicate+M3Extensions.h"
12 |
13 |
14 | @implementation NSCompoundPredicate (M3Extensions)
15 |
16 |
17 | + (NSPredicate *)m3_predicateWithXMLElement:(NSXMLElement *)aElement {
18 | //Generate the sub predicates
19 | NSMutableArray *subpredicates = [NSMutableArray array];
20 | for (NSXMLElement *subpred in [aElement elementsForName:@"predicate"]) {
21 | [subpredicates addObject:[NSPredicate m3_predicateWithXMLElement:subpred]];
22 | }
23 | for (NSXMLElement *subpred in [aElement elementsForName:@"predicates"]) {
24 | [subpredicates addObject:[NSPredicate m3_predicateWithXMLElement:subpred]];
25 | }
26 |
27 | //Combine them into the correct type
28 | NSString *type = [aElement attributeForName:@"type"].stringValue;
29 | if ([type isEqualToString:@"and"]) {
30 | return [NSCompoundPredicate andPredicateWithSubpredicates:subpredicates];
31 | } else if ([type isEqualToString:@"or"]) {
32 | return [NSCompoundPredicate orPredicateWithSubpredicates:subpredicates];
33 | } else if ([type isEqualToString:@"not"] && subpredicates.count == 1) {
34 | return [NSCompoundPredicate notPredicateWithSubpredicate:subpredicates[0]];
35 | }
36 | return nil;
37 | }
38 |
39 |
40 | - (NSString *)p_compoundPredicateTypeString {
41 | switch (self.compoundPredicateType) {
42 | case NSAndPredicateType:
43 | return @"and";
44 | case NSOrPredicateType:
45 | return @"or";
46 | case NSNotPredicateType:
47 | return @"not";
48 | }
49 | return @"";
50 | }
51 |
52 |
53 | - (NSXMLElement *)m3_xmlRepresentation {
54 | NSXMLElement *compoundElement = [NSXMLElement elementWithName:@"predicates"];
55 | [compoundElement addAttribute:[NSXMLNode attributeWithName:@"type" stringValue:self.p_compoundPredicateTypeString]];
56 | for (NSPredicate *subPred in self.subpredicates) {
57 | [compoundElement addChild:subPred.m3_xmlRepresentation];
58 | }
59 | return compoundElement;
60 | }
61 |
62 | @end
63 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSCountedSet+M3Extensions.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSCountedSet+M3Extensions.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 11/02/2012.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | /**
11 | A category to add additional operations for working with object counts
12 | @since M3Foundation 1.0 and later
13 | */
14 | @interface NSCountedSet (M3Extensions)
15 |
16 | /**
17 | Returns the objects with a certain count
18 | @param aCount The object count to look for
19 | @return A new set containing the objects with the supplied count
20 | @since M3Foundation 1.0 or later
21 | */
22 | - (NSSet *)m3_objectsWithCount:(NSUInteger)aCount;
23 |
24 | /**
25 | The total number of objects that have been added to the set
26 | @since M3Foundation 1.0 or later
27 | */
28 | @property (readonly) NSUInteger m3_countedObjectTotal;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSCountedSet+M3Extensions.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSCountedSet+M3Extensions.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 11/02/2012.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSCountedSet+M3Extensions.h"
11 |
12 | @implementation NSCountedSet (M3Extensions)
13 |
14 |
15 | - (NSSet *)m3_objectsWithCount:(NSUInteger)aCount {
16 | NSMutableSet *returnSet = [NSMutableSet set];
17 | for (id object in self) {
18 | if ([self countForObject:object] == aCount) {
19 | [returnSet addObject:object];
20 | }
21 | }
22 | return [returnSet copy];
23 | }
24 |
25 |
26 | - (NSUInteger)m3_countedObjectTotal {
27 | NSUInteger totalCount = 0;
28 | for (id object in self) {
29 | totalCount += [self countForObject:object];
30 | }
31 | return totalCount;
32 | }
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSDictionary+M3Extensions.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSDictionary+M3Extensions.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 17/01/2012.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | /**
11 | This category adds some useful class methods for adding objects to a dictionary.
12 | @since M3Foundation 1.0 and later
13 | */
14 | @interface NSDictionary (M3Extensions)
15 |
16 | /**
17 | Creates a new dictionary by adding the supplied object and key
18 | @param aObject The object to add to the dictionary
19 | @param aKey The key for the object
20 | @return A new dictionary containing the supplied object and key
21 | @since M3Foundation 1.0 or later
22 | */
23 | - (NSDictionary *)m3_dictionaryBySettingObject:(id)aObject forKey:(id)aKey;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSDictionary+M3Extensions.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSDictionary+M3Extensions.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 17/01/2012.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSDictionary+M3Extensions.h"
11 |
12 | @implementation NSDictionary (M3Extensions)
13 |
14 |
15 | - (NSDictionary *)m3_dictionaryBySettingObject:(id)aObject forKey:(id)aKey {
16 | NSMutableDictionary *newDictionary = [self mutableCopy];
17 | newDictionary[aKey] = aObject;
18 | return [newDictionary copy];
19 | }
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSExpression+M3Extensions.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSExpression+M3Extensions.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 01/04/2011.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 |
11 | /**
12 | Additions to NSExpression for converting to and from XML representations
13 | @since M3Foundation 1.0 or later
14 | */
15 | @interface NSExpression (M3Extensions)
16 |
17 | /**
18 | Creates a new expression from an XML representation
19 | @param aElement The XML element at the root of the representation
20 | @return The expression generated from the XML or nil if it fails
21 | @since M3Foundation 1.0 or later
22 | */
23 | + (NSExpression *)m3_expressionWithXMLElement:(NSXMLElement *)aElement;
24 |
25 | /**
26 | The XML representation for the expression
27 | @return The root element of the XML representation
28 | @since M3Foundation 1.0 or later
29 | */
30 | - (NSXMLElement *)m3_xmlRepresentation;
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSExpression+M3Extensions.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSExpression+M3Extensions.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 01/04/2011.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSExpression+M3Extensions.h"
11 |
12 |
13 | @implementation NSExpression (M3Extensions)
14 |
15 |
16 | + (NSExpression *)m3_expressionWithXMLElement:(NSXMLElement *)aElement {
17 | //Get the element type
18 | NSString *type = [aElement attributeForName:@"type"].stringValue;
19 | //If a constant, find the value
20 | if ([type isEqualToString:@"constant"]) {
21 | NSString *valueType = [aElement attributeForName:@"valueType"].stringValue;
22 | id constantValue = nil;
23 | if ([valueType isEqualToString:@"string"]) {
24 | constantValue = aElement.stringValue;
25 | } else if ([valueType isEqualToString:@"double"]) {
26 | constantValue = [NSNumber numberWithDouble:aElement.stringValue.doubleValue];
27 | } else if ([valueType isEqualToString:@"integer"]) {
28 | constantValue = [NSNumber numberWithInteger:aElement.stringValue.integerValue];
29 | }
30 | return [NSExpression expressionForConstantValue:constantValue];
31 | }
32 | //If a variable use directly
33 | if ([type isEqualToString:@"variable"]) {
34 | return [NSExpression expressionForVariable:aElement.stringValue];
35 | }
36 | //Same for key paths
37 | if ([type isEqualToString:@"keyPath"]) {
38 | return [NSExpression expressionForKeyPath:aElement.stringValue];
39 | }
40 | //If an aggregate, collect together the sub expressions
41 | if ([type isEqualToString:@"aggregate"]) {
42 | NSMutableArray *aggregate = [NSMutableArray array];
43 | for (NSXMLElement *element in aElement.children) {
44 | [aggregate addObject:[NSExpression m3_expressionWithXMLElement:element]];
45 | }
46 | return [NSExpression expressionForAggregate:aggregate];
47 | }
48 | //And if an evaluated object return
49 | if ([type isEqualToString:@"evaluatedObject"]) {
50 | return [NSExpression expressionForEvaluatedObject];
51 | }
52 | return nil;
53 | }
54 |
55 |
56 | - (void)p_addContentToElement:(NSXMLElement *)aElement {
57 | NSExpressionType type = self.expressionType;
58 | //Set the constant value and value type
59 | if (type == NSConstantValueExpressionType) {
60 | [aElement addAttribute:[NSXMLNode attributeWithName:@"type" stringValue:@"constant"]];
61 |
62 | NSString *valueType = @"string";
63 | if ([self.constantValue isKindOfClass:[NSNumber class]]) {
64 | if (strcmp([self.constantValue objCType], @encode(int)) == 0) {
65 | valueType = @"integer";
66 | } else if (strcmp([self.constantValue objCType], @encode(double)) == 0) {
67 | valueType = @"double";
68 | }
69 |
70 | }
71 |
72 | [aElement addAttribute:[NSXMLNode attributeWithName:@"valueType" stringValue:valueType]];
73 |
74 | [aElement setStringValue:[self.constantValue description]];
75 | //Set the variable value
76 | } else if (type == NSVariableExpressionType) {
77 | [aElement addAttribute:[NSXMLNode attributeWithName:@"type" stringValue:@"variable"]];
78 | [aElement setStringValue:self.variable];
79 | //Set the key path value
80 | } else if (type == NSKeyPathExpressionType) {
81 | [aElement addAttribute:[NSXMLNode attributeWithName:@"type" stringValue:@"keyPath"]];
82 | [aElement setStringValue:self.keyPath];
83 | //Set the aggregate value
84 | } else if (type == NSAggregateExpressionType) {
85 | [aElement addAttribute:[NSXMLNode attributeWithName:@"type" stringValue:@"aggregate"]];
86 | for (NSExpression *expression in self.collection) {
87 | [aElement addChild:expression.m3_xmlRepresentation];
88 | }
89 | //Other types
90 | } else if (type == NSEvaluatedObjectExpressionType) {
91 | [aElement addAttribute:[NSXMLNode attributeWithName:@"type" stringValue:@"evaluatedObject"]];
92 | } else if (type == NSFunctionExpressionType) {
93 | [aElement addAttribute:[NSXMLNode attributeWithName:@"type" stringValue:@"function"]];
94 | } else if (type == NSSubqueryExpressionType) {
95 | [aElement addAttribute:[NSXMLNode attributeWithName:@"type" stringValue:@"subquery"]];
96 | } else if (type == NSUnionSetExpressionType) {
97 | [aElement addAttribute:[NSXMLNode attributeWithName:@"type" stringValue:@"unionSet"]];
98 | } else if (type == NSIntersectSetExpressionType) {
99 | [aElement addAttribute:[NSXMLNode attributeWithName:@"type" stringValue:@"intersectSet"]];
100 | } else if (type == NSMinusSetExpressionType) {
101 | [aElement addAttribute:[NSXMLNode attributeWithName:@"type" stringValue:@"minusSet"]];
102 | } else if (type == NSBlockExpressionType) {
103 | [aElement addAttribute:[NSXMLNode attributeWithName:@"type" stringValue:@"block"]];
104 | }
105 | }
106 |
107 |
108 | - (NSXMLElement *)m3_xmlRepresentation {
109 | NSXMLElement *expressionElement = [NSXMLElement elementWithName:@"expression"];
110 | [self p_addContentToElement:expressionElement];
111 | return expressionElement;
112 | }
113 |
114 | @end
115 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSKeyValueObserving+M3Extensions.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSKeyValueObserving+M3Extensions.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 04/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 |
11 | @interface NSObject (M3KeyValueObservingExtensions)
12 |
13 | /**
14 | Start observing multiple key paths at once
15 | @param aObserver The object that will observe the receiver
16 | @param aKeyPaths An array of key paths to observe
17 | @param aOptions The options to use for observing
18 | @param aContext A context pointer for the observation
19 | @since M3Foundation 1.0 or later
20 | */
21 | - (void)m3_addObserver:(NSObject *)aObserver forKeyPathsInArray:(NSArray *)aKeyPaths options:(NSKeyValueObservingOptions)aOptions context:(void *)aContext;
22 |
23 | /**
24 | Stop observing multiple key paths at once
25 | @param aObserver The object that will stop observing the receiver
26 | @param aKeyPaths An array of key paths to stop observing
27 | @since M3Foundation 1.0 or later
28 | */
29 | - (void)m3_removeObserver:(NSObject *)aObserver forKeyPathsInArray:(NSArray *)aKeyPaths;
30 |
31 | /**
32 | Inform observers that we will change multiple keys
33 | @param aKeys An array of key paths that will change
34 | @since M3Foundation 1.0 or later
35 | */
36 | - (void)m3_willChangeValueForKeys:(NSArray *)aKeys;
37 |
38 | /**
39 | Inform observers that we did change multiple keys
40 | @param aKeys An array of key paths that did change
41 | @since M3Foundation 1.0 or later
42 | */
43 | - (void)m3_didChangeValueForKeys:(NSArray *)aKeys;
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSKeyValueObserving+M3Extensions.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSKeyValueObserving+M3Extensions.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 04/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSKeyValueObserving+M3Extensions.h"
11 |
12 |
13 | @implementation NSObject (M3KeyValueObservingExtensions)
14 |
15 | - (void)m3_addObserver:(NSObject *)aObserver forKeyPathsInArray:(NSArray *)aKeyPaths options:(NSKeyValueObservingOptions)aOptions context:(void *)aContext {
16 | for (NSString *path in aKeyPaths) {
17 | [self addObserver:aObserver forKeyPath:path options:aOptions context:aContext];
18 | }
19 | }
20 |
21 |
22 | - (void)m3_removeObserver:(NSObject *)aObserver forKeyPathsInArray:(NSArray *)aKeyPaths {
23 | for (NSString *path in aKeyPaths) {
24 | [self removeObserver:aObserver forKeyPath:path];
25 | }
26 | }
27 |
28 |
29 | - (void)m3_willChangeValueForKeys:(NSArray *)aKeys {
30 | for (NSString *key in aKeys) {
31 | [self willChangeValueForKey:key];
32 | }
33 | }
34 |
35 |
36 | - (void)m3_didChangeValueForKeys:(NSArray *)aKeys {
37 | for (NSString *key in aKeys) {
38 | [self didChangeValueForKey:key];
39 | }
40 | }
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSMapTable+M3Extensions.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSMapTable+M3Extensions.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 15/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import
11 |
12 | @interface NSMapTable (M3Extensions)
13 |
14 | - (id)objectForKeyedSubscript:(id)aKey;
15 | - (void)setObject:(id)aObject forKeyedSubscript:(id)aKey;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSMapTable+M3Extensions.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSMapTable+M3Extensions.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 15/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSMapTable+M3Extensions.h"
11 |
12 | @implementation NSMapTable (M3Extensions)
13 |
14 | - (id)objectForKeyedSubscript:(id)aKey {
15 | return [self objectForKey:aKey];
16 | }
17 |
18 | - (void)setObject:(id)aObject forKeyedSubscript:(id)aKey {
19 | [self setObject:aObject forKey:aKey];
20 | }
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSMutableArray+M3Extensions.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSMutableArray+M3Extensions.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 21/05/2010.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | /**
11 | This category adds more ways of re-arranging objects in a mutable array
12 | @since M3Foundation 1.0 and later
13 | */
14 | @interface NSMutableArray (M3Extensions)
15 |
16 | /**
17 | Moves the supplied object to the new index
18 | If the supplied index is beyond the bounds of the array, the object is simply moved to the end of the array
19 | @param aIndex The index of the object to move
20 | @param aNewIndex The index to move the object to
21 | @since M3Foundation 1.0 and later
22 | */
23 | - (void)m3_moveObjectAtIndex:(NSUInteger)aIndex toIndex:(NSUInteger)aNewIndex;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSMutableArray+M3Extensions.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSMutableArray+M3Extensions.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 21/05/2010.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSMutableArray+M3Extensions.h"
11 |
12 |
13 | @implementation NSMutableArray (M3Extensions)
14 |
15 |
16 | - (void)m3_moveObjectAtIndex:(NSUInteger)aIndex toIndex:(NSUInteger)aNewIndex {
17 | id movingObject = [self objectAtIndex:aIndex];
18 | [self removeObjectAtIndex:aIndex];
19 | if (aNewIndex < self.count) {
20 | [self insertObject:movingObject atIndex:aNewIndex];
21 | } else {
22 | [self addObject:movingObject];
23 | }
24 | }
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSMutableDictionary+M3Extensions.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSMutableDictionary+M3Extensions.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 15/04/2011.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | /**
11 | This category adds methods to safely set objects
12 | @since M3Foundation 1.0 or later
13 | */
14 | @interface NSMutableDictionary (M3Extensions)
15 |
16 | /**
17 | Adds an object to the dictionary, ignoring nil if passed in as the object
18 | @param aObject The object to add
19 | @param aKey The key to use for the object
20 | @since M3Foundation 1.0 or later
21 | */
22 | - (void)m3_safeSetObject:(id)aObject forKey:(id)aKey;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSMutableDictionary+M3Extensions.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSMutableDictionary+M3Extensions.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 15/04/2011.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSMutableDictionary+M3Extensions.h"
11 |
12 |
13 | @implementation NSMutableDictionary (M3Extensions)
14 |
15 |
16 | - (void)m3_safeSetObject:(id)aObject forKey:(id)aKey {
17 | if (aObject && aKey) {
18 | self[aKey] = aObject;
19 | }
20 | }
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSObject+M3Extensions.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSObject+M3Extensions.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 30/03/2011.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 |
11 | @interface NSObject (M3Extensions)
12 |
13 | ///-----------------------------------------------------
14 | /// @name Perform blocks
15 | ///-----------------------------------------------------
16 |
17 | /**
18 | Perform the supplied block after a delay
19 | This is effectively equivalent to performSelector:afterDelay:
20 | @param aBlock The block to perform
21 | @param aInterval The time interval after which the block should be invoked
22 | @since M3Foundation 1.0 or later
23 | */
24 | - (void)m3_performBlock:(void (^)(void))aBlock afterDelay:(NSTimeInterval)aInterval;
25 |
26 | /**
27 | Perform the supplied block after a delay for the supplied run loop modes
28 | This is effectively equivalent to performSelector:afterDelay:inModes:
29 | @param aBlock The block to perform
30 | @param aInterval The time interval after which the block should be invoked
31 | @param aArray An array of run loop modes
32 | @since M3Foundation 1.0 or later
33 | */
34 | - (void)m3_performBlock:(void (^)(void))aBlock afterDelay:(NSTimeInterval)aInterval inModes:(NSArray *)aArray;
35 |
36 |
37 |
38 |
39 |
40 | ///-----------------------------------------------------
41 | /// @name Manipulating objects
42 | ///-----------------------------------------------------
43 |
44 | /**
45 | Replaces the implementation of a method on this object with the supplied block
46 | This method only affects the receiver and not any other instances of the class.
47 | @param aSelector The selector of the method to replace
48 | @param aBlock A block representing the implementation. The first argument must be of type id, followed by the list of method arguments
49 | @since M3Foundation 1.0 or later
50 | */
51 | - (BOOL)m3_replaceImplementationOfMethodWithSelector:(SEL)aSelector withBlock:(id)aBlock;
52 |
53 |
54 | @end
55 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSObject+M3Extensions.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSObject+M3Extensions.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 30/03/2011.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSObject+M3Extensions.h"
11 | #import
12 |
13 |
14 | @implementation NSObject (M3Extensions)
15 |
16 | #pragma mark -
17 | #pragma mark Perform blocks
18 |
19 |
20 | - (void)m3_performBlock:(void (^)(void))aBlock afterDelay:(NSTimeInterval)aInterval {
21 | [self performSelector:@selector(_m3_performBlock:) withObject:[aBlock copy] afterDelay:aInterval];
22 | }
23 |
24 |
25 | - (void)m3_performBlock:(void (^)(void))aBlock afterDelay:(NSTimeInterval)aInterval inModes:(NSArray *)aArray {
26 | [self performSelector:@selector(_m3_performBlock:) withObject:[aBlock copy] afterDelay:aInterval inModes:aArray];
27 | }
28 |
29 |
30 | - (void)_m3_performBlock:(void (^)(void))aBlock {
31 | aBlock();
32 | }
33 |
34 |
35 |
36 |
37 |
38 | #pragma mark -
39 | #pragma mark Manipulating objects
40 |
41 |
42 | - (BOOL)m3_replaceImplementationOfMethodWithSelector:(SEL)aSelector withBlock:(id)aBlock {
43 | NSString *className = NSStringFromClass(self.class);
44 | NSArray *nameComponents = [className componentsSeparatedByString:@"_"];
45 | //Check if we're already a singleton
46 | if (![nameComponents.lastObject hasPrefix:@"m3singleton"]) {
47 | //If not then get the subclass name to use
48 | NSString *newClassNamePrefix = [NSString stringWithFormat:@"%@_m3singleton", className];
49 | NSString *newClassName = newClassNamePrefix;
50 | NSInteger classNumber = 0;
51 | //While the class name is registered try the next number
52 | while (objc_getClass([newClassName cStringUsingEncoding:NSUTF8StringEncoding])) {
53 | classNumber++;
54 | newClassName = [NSString stringWithFormat:@"%@%ld", newClassName, classNumber];
55 | }
56 |
57 | //Register the class with the runtime and then change our class
58 | const char *name = [newClassName cStringUsingEncoding:NSUTF8StringEncoding];
59 | Class newSubclass = objc_allocateClassPair(self.class, name, 0);
60 | objc_registerClassPair(newSubclass);
61 | object_setClass(self, newSubclass);
62 | }
63 | IMP newIMP = imp_implementationWithBlock(aBlock);
64 | Method methodToReplace = class_getInstanceMethod(self.class, aSelector);
65 | return class_addMethod(self.class, aSelector, newIMP, method_getTypeEncoding(methodToReplace));
66 | }
67 |
68 | @end
69 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSPredicate+M3Extensions.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSPredicate+M3Extensions.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 31/03/2011.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 |
11 | /**
12 | Additions to NSPredicate for converting to and from XML representations
13 | @since M3Foundation 1.0 or later
14 | */
15 | @interface NSPredicate (M3Extensions)
16 |
17 | /**
18 | Creates a new predicate from an XML representation
19 | @param aElement The XML element at the root of the representation
20 | @return The predicate generated from the XML or nil if it fails
21 | @since M3Foundation 1.0 or later
22 | */
23 | + (NSPredicate *)m3_predicateWithXMLElement:(NSXMLElement *)aElement;
24 |
25 | /**
26 | The XML representation for the predicate
27 | @return The root element of the XML representation
28 | @since M3Foundation 1.0 or later
29 | */
30 | - (NSXMLElement *)m3_xmlRepresentation;
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSPredicate+M3Extensions.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSPredicate+M3Extensions.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 31/03/2011.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSPredicate+M3Extensions.h"
11 |
12 |
13 | @implementation NSPredicate (M3Extensions)
14 |
15 | + (NSPredicate *)m3_predicateWithXMLElement:(NSXMLElement *)aElement {
16 | if ([aElement.name isEqualToString:@"truePredicate"]) {
17 | return [NSPredicate predicateWithValue:YES];
18 | } else if ([aElement.name isEqualToString:@"falsePredicate"]) {
19 | return [NSPredicate predicateWithValue:NO];
20 | } else if ([aElement.name isEqualToString:@"predicates"]) {
21 | return [NSCompoundPredicate m3_predicateWithXMLElement:aElement];
22 | } else if ([aElement.name isEqualToString:@"predicate"]) {
23 | return [NSComparisonPredicate m3_predicateWithXMLElement:aElement];
24 | }
25 | return nil;
26 | }
27 |
28 | - (NSXMLElement *)m3_xmlRepresentation {
29 | if ([self isKindOfClass:NSClassFromString(@"NSTruePredicate")]) {
30 | return [NSXMLElement elementWithName:@"truePredicate"];
31 | } else if ([self isKindOfClass:NSClassFromString(@"NSFalsePredicate")]) {
32 | return [NSXMLElement elementWithName:@"falsePredicate"];
33 | }
34 | return nil;
35 | }
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSString+M3Extensions.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSString+M3Extensions.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 09/09/2006.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | /**
11 | This category adds some convienience methods to NSString
12 | @since M3Foundation 1.0 and later
13 | */
14 | @interface NSString (M3Extensions)
15 |
16 | /**
17 | Returns a string with the specified number of characters removed from the end
18 | @param aNumber The number of characters to be removed from the end of the string
19 | @result Returns an NSString object with with the specified number of characters are removed
20 | @since M3Foundation 1.0 and later
21 | */
22 | - (NSString *)m3_stringByRemovingCharactersFromEnd:(NSUInteger)aNumber;
23 |
24 | /**
25 | Finds whether the string contains the supplied substring
26 | @param aSubString The string to test for
27 | @result Returns true if the string contains subString
28 | @since M3Foundation 1.0 and later
29 | */
30 | - (BOOL)m3_containsString:(NSString *)aSubString;
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSString+M3Extensions.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSString+M3Extensions.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 09/09/2006.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSString+M3Extensions.h"
11 |
12 |
13 | @implementation NSString(M3Extensions)
14 |
15 |
16 | - (NSString *)m3_stringByRemovingCharactersFromEnd:(NSUInteger)aNumber {
17 | if (aNumber > self.length) {
18 | return nil;
19 | }
20 | return [self substringToIndex:self.length - aNumber];
21 | }
22 |
23 |
24 | - (BOOL)m3_containsString:(NSString *)aSubString {
25 | return [self rangeOfString:aSubString].location != NSNotFound;
26 | }
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSXMLElement+M3Extensions.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSXMLElement+M3Extensions.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 10/05/2008.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | /**
11 | This category adds some convienience methods to NSXMLElement
12 | @since M3Foundation 1.0 and later
13 | */
14 | @interface NSXMLElement (M3Extensions)
15 |
16 | /**
17 | Returns the element with the supplied name, or the first element with that name
18 | Equivalent to [[self elementsForName:str] objectAtIndex:0]
19 | @param aName The name of the element
20 | @result The element with the supplied name
21 | @since M3Foundation 1.0 and later
22 | */
23 | - (NSXMLElement *)m3_elementForName:(NSString *)aName;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSXMLElement+M3Extensions.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSXMLElement+M3Extensions.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 10/05/2008.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSXMLElement+M3Extensions.h"
11 |
12 |
13 | @implementation NSXMLElement (M3Extensions)
14 |
15 |
16 | - (NSXMLElement *)m3_elementForName:(NSString *)aName {
17 | NSArray *elements = [self elementsForName:aName];
18 | if (elements.count) {
19 | return elements[0];
20 | }
21 | return nil;
22 | }
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSXMLNode+M3Extensions.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSXMLNode+M3Extensions.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 19/03/2010.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | /**
11 | Extensions to NSXMLNode to simplify accessing data
12 | @since M3Foundation 1.0 or later
13 | */
14 | @interface NSXMLNode (M3Extensions)
15 |
16 | /**
17 | The integer value of the node
18 | @since M3Foundation 1.0 or later
19 | */
20 | @property (readonly) NSInteger m3_integerValue;
21 |
22 | /**
23 | The float value of the node
24 | @since M3Foundation 1.0 or later
25 | */
26 | @property (readonly) CGFloat m3_floatValue;
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/M3Foundation/Source/NSXMLNode+M3Extensions.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSXMLNode+M3Extensions.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 19/03/2010.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSXMLNode+M3Extensions.h"
11 |
12 |
13 | @implementation NSXMLNode (M3Extensions)
14 |
15 |
16 | - (NSInteger)m3_integerValue {
17 | return self.stringValue.integerValue;
18 | }
19 |
20 |
21 | - (CGFloat)m3_floatValue {
22 | return self.stringValue.floatValue;
23 | }
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/M3Foundation/version.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildVersion
6 | 2
7 | CFBundleShortVersionString
8 | 1.0
9 | CFBundleVersion
10 | 1
11 | ProjectName
12 | DevToolsWizardTemplates
13 | SourceVersion
14 | 15920000
15 |
16 |
17 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Headers:
--------------------------------------------------------------------------------
1 | Versions/Current/Headers
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/OCHamcrest:
--------------------------------------------------------------------------------
1 | Versions/Current/OCHamcrest
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Resources:
--------------------------------------------------------------------------------
1 | Versions/Current/Resources
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCAllOf.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCAllOf.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCAllOf : HCBaseMatcher
14 | {
15 | NSArray *matchers;
16 | }
17 |
18 | + (id)allOf:(NSArray *)theMatchers;
19 | - (id)initWithMatchers:(NSArray *)theMatchers;
20 |
21 | @end
22 |
23 |
24 | OBJC_EXPORT id HC_allOf(id match, ...) NS_REQUIRES_NIL_TERMINATION;
25 |
26 | /**
27 | allOf(firstMatcher, ...) -
28 | Matches if all of the given matchers evaluate to @c YES.
29 |
30 | @param firstMatcher,... A comma-separated list of matchers ending with @c nil.
31 |
32 | The matchers are evaluated from left to right using short-circuit evaluation, so evaluation
33 | stops as soon as a matcher returns @c NO.
34 |
35 | Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
36 | equality.
37 |
38 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
39 | @c HC_allOf instead.)
40 |
41 | @ingroup logical_matchers
42 | */
43 | #ifdef HC_SHORTHAND
44 | #define allOf HC_allOf
45 | #endif
46 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCAnyOf.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCAnyOf.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCAnyOf : HCBaseMatcher
14 | {
15 | NSArray *matchers;
16 | }
17 |
18 | + (id)anyOf:(NSArray *)theMatchers;
19 | - (id)initWithMatchers:(NSArray *)theMatchers;
20 |
21 | @end
22 |
23 |
24 | OBJC_EXPORT id HC_anyOf(id match, ...) NS_REQUIRES_NIL_TERMINATION;
25 |
26 | /**
27 | anyOf(firstMatcher, ...) -
28 | Matches if any of the given matchers evaluate to @c YES.
29 |
30 | @param firstMatcher,... A comma-separated list of matchers ending with @c nil.
31 |
32 | The matchers are evaluated from left to right using short-circuit evaluation, so evaluation
33 | stops as soon as a matcher returns @c YES.
34 |
35 | Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
36 | equality.
37 |
38 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
39 | @c HC_anyOf instead.)
40 |
41 | @ingroup logical_matchers
42 | */
43 | #ifdef HC_SHORTHAND
44 | #define anyOf HC_anyOf
45 | #endif
46 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCAssertThat.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCAssertThat.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 | @protocol HCMatcher;
13 |
14 |
15 | OBJC_EXPORT void HC_assertThatWithLocation(id testCase, id actual, id matcher,
16 | const char *fileName, int lineNumber);
17 |
18 | #define HC_assertThat(actual, matcher) \
19 | HC_assertThatWithLocation(self, actual, matcher, __FILE__, __LINE__)
20 |
21 | /**
22 | assertThat(actual, matcher) -
23 | Asserts that actual value satisfies matcher.
24 |
25 | @param actual The object to evaluate as the actual value.
26 | @param matcher The matcher to satisfy as the expected condition.
27 |
28 | @c assertThat passes the actual value to the matcher for evaluation. If the matcher is not
29 | satisfied, an exception is thrown describing the mismatch.
30 |
31 | @c assertThat is designed to integrate well with OCUnit and other unit testing frameworks.
32 | Unmet assertions are reported as test failures. In Xcode, these failures can be clicked to
33 | reveal the line of the assertion.
34 |
35 | In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
36 | @c HC_assertThat instead.
37 |
38 | @ingroup integration
39 | */
40 | #ifdef HC_SHORTHAND
41 | #define assertThat HC_assertThat
42 | #endif
43 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCBaseDescription.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCBaseDescription.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 | #import
12 |
13 |
14 | /**
15 | Base class for all HCDescription implementations.
16 |
17 | @ingroup core
18 | */
19 | @interface HCBaseDescription : NSObject
20 | @end
21 |
22 |
23 | /**
24 | Methods that must be provided by subclasses of HCBaseDescription.
25 | */
26 | @interface HCBaseDescription (SubclassMustImplement)
27 |
28 | /**
29 | Append the string @a str to the description.
30 | */
31 | - (void)append:(NSString *)str;
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCBaseMatcher.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCBaseMatcher.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 | #import
12 |
13 | #import // Convenience header, to provide OBJC_EXPORT
14 |
15 |
16 | /**
17 | Base class for all HCMatcher implementations.
18 |
19 | Most implementations can just implement @c -matches: and let
20 | -matches:describingMismatchTo:
call it. But if it makes more sense to generate the
21 | mismatch description during the matching, override -matches:describingMismatchTo:
22 | and have @c -matches: call it with a @c nil description.
23 |
24 | @ingroup core
25 | */
26 | @interface HCBaseMatcher : NSObject
27 | @end
28 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCBoxNumber.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCBoxNumber.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #ifdef __cplusplus
11 |
12 | namespace hamcrest {
13 |
14 | /**
15 | Boxes a scalar value in an NSNumber, specialized per type.
16 |
17 | @b Deprecated
18 |
19 | @ingroup number_matchers
20 | */
21 | template
22 | inline
23 | NSNumber *boxNumber(T value) __attribute__((deprecated));
24 | { return nil; }
25 |
26 | template <>
27 | inline
28 | NSNumber *boxNumber(BOOL value)
29 | { return [NSNumber numberWithBool:value]; }
30 |
31 | template <>
32 | inline
33 | NSNumber *boxNumber(char value)
34 | { return [NSNumber numberWithChar:value]; }
35 |
36 | template <>
37 | inline
38 | NSNumber *boxNumber(double value)
39 | { return [NSNumber numberWithDouble:value]; }
40 |
41 | template <>
42 | inline
43 | NSNumber *boxNumber(float value)
44 | { return [NSNumber numberWithFloat:value]; }
45 |
46 | template <>
47 | inline
48 | NSNumber *boxNumber(int value)
49 | { return [NSNumber numberWithInt:value]; }
50 |
51 | template <>
52 | inline
53 | NSNumber *boxNumber(long value)
54 | { return [NSNumber numberWithLong:value]; }
55 |
56 | template <>
57 | inline
58 | NSNumber *boxNumber(long long value)
59 | { return [NSNumber numberWithLongLong:value]; }
60 |
61 | template <>
62 | inline
63 | NSNumber *boxNumber(short value)
64 | { return [NSNumber numberWithShort:value]; }
65 |
66 | template <>
67 | inline
68 | NSNumber *boxNumber(unsigned char value)
69 | { return [NSNumber numberWithUnsignedChar:value]; }
70 |
71 | template <>
72 | inline
73 | NSNumber *boxNumber(unsigned int value)
74 | { return [NSNumber numberWithUnsignedInt:value]; }
75 |
76 | template <>
77 | inline
78 | NSNumber *boxNumber(unsigned long value)
79 | { return [NSNumber numberWithUnsignedLong:value]; }
80 |
81 | template <>
82 | inline
83 | NSNumber *boxNumber(unsigned long long value)
84 | { return [NSNumber numberWithUnsignedLongLong:value]; }
85 |
86 | template <>
87 | inline
88 | NSNumber *boxNumber(unsigned short value)
89 | { return [NSNumber numberWithUnsignedShort:value]; }
90 |
91 | } // namespace hamcrest
92 |
93 | #endif // __cplusplus
94 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCCollectMatchers.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCCollectMatchers.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 | #import
12 |
13 | #import
14 |
15 | @protocol HCMatcher;
16 |
17 |
18 | /**
19 | Returns an array of matchers from a variable-length comma-separated list terminated by @c nil.
20 |
21 | @ingroup helpers
22 | */
23 | OBJC_EXPORT NSMutableArray *HCCollectMatchers(id item1, va_list args);
24 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCConformsToProtocol.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCConformsToProtocol.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Todd Farrell
6 | //
7 |
8 | #import
9 |
10 |
11 | @interface HCConformsToProtocol : HCBaseMatcher
12 | {
13 | Protocol *theProtocol;
14 | }
15 |
16 | + (id)conformsToProtocol:(Protocol *)protocol;
17 | - (id)initWithProtocol:(Protocol *)protocol;
18 |
19 | @end
20 |
21 |
22 | OBJC_EXPORT id HC_conformsTo(Protocol *aProtocol);
23 | OBJC_EXPORT id HC_conformsToProtocol(Protocol *aProtocol) __attribute__((deprecated));
24 |
25 | /**
26 | conformsTo(aProtocol) -
27 | Matches if object conforms to a given protocol.
28 |
29 | @param aProtocol The protocol to compare against as the expected protocol.
30 |
31 | This matcher checks whether the evaluated object conforms to @a aProtocol.
32 |
33 | Example:
34 | @li @ref conformsTo(\@protocol(NSObject))
35 |
36 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
37 | @c HC_conformsTo instead.)
38 |
39 | @ingroup object_matchers
40 | */
41 | #ifdef HC_SHORTHAND
42 | #define conformsTo HC_conformsTo
43 | #endif
44 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCDescribedAs.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCDescribedAs.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCDescribedAs : HCBaseMatcher
14 | {
15 | NSString *descriptionTemplate;
16 | id matcher;
17 | NSArray *values;
18 | }
19 |
20 | + (id)describedAs:(NSString *)description
21 | forMatcher:(id)aMatcher
22 | overValues:(NSArray *)templateValues;
23 |
24 | - (id)initWithDescription:(NSString *)description
25 | forMatcher:(id)aMatcher
26 | overValues:(NSArray *)templateValues;
27 |
28 | @end
29 |
30 |
31 | OBJC_EXPORT id HC_describedAs(NSString *description, id matcher, ...) NS_REQUIRES_NIL_TERMINATION;
32 |
33 | /**
34 | describedAs(description, matcher, ...) -
35 | Adds custom failure description to a given matcher.
36 |
37 | @param description Overrides the matcher's description.
38 | @param matcher,... The matcher to satisfy, followed by a comma-separated list of substitution values ending with @c nil.
39 |
40 | The description may contain substitution placeholders \%0, \%1, etc. These will be replaced by
41 | any values that follow the matcher.
42 |
43 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
44 | @c HC_describedAs instead.)
45 |
46 | @ingroup decorator_matchers
47 | */
48 | #ifdef HC_SHORTHAND
49 | #define describedAs HC_describedAs
50 | #endif
51 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCDescription.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCDescription.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | /**
14 | A description of an HCMatcher.
15 |
16 | An HCMatcher will describe itself to a description which can later be used for reporting.
17 |
18 | @ingroup core
19 | */
20 | @protocol HCDescription
21 |
22 | /**
23 | Appends some plain text to the description.
24 |
25 | @return @c self, for chaining.
26 | */
27 | - (id)appendText:(NSString *)text;
28 |
29 | /**
30 | Appends description of given value to @c self.
31 |
32 | If the value implements the @ref HCSelfDescribing protocol, then it will be used.
33 |
34 | @return @c self, for chaining.
35 | */
36 | - (id)appendDescriptionOf:(id)value;
37 |
38 | /**
39 | Appends a list of objects to the description.
40 |
41 | @return @c self, for chaining.
42 | */
43 | - (id)appendList:(NSArray *)values
44 | start:(NSString *)start
45 | separator:(NSString *)separator
46 | end:(NSString *)end;
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCHasCount.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCHasCount.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCHasCount : HCBaseMatcher
14 | {
15 | id countMatcher;
16 | }
17 |
18 | + (id)hasCount:(id)matcher;
19 | - (id)initWithCount:(id)matcher;
20 |
21 | @end
22 |
23 |
24 | OBJC_EXPORT id HC_hasCount(id matcher);
25 |
26 | /**
27 | hasCount(aMatcher) -
28 | Matches if object's @c -count satisfies a given matcher.
29 |
30 | @param aMatcher The matcher to satisfy.
31 |
32 | This matcher invokes @c -count on the evaluated object to get the number of elements it
33 | contains, passing the result to @a aMatcher for evaluation.
34 |
35 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
36 | @c HC_hasCount instead.)
37 |
38 | @ingroup collection_matchers
39 | */
40 | #ifdef HC_SHORTHAND
41 | #define hasCount HC_hasCount
42 | #endif
43 |
44 |
45 | OBJC_EXPORT id HC_hasCountOf(NSUInteger count);
46 |
47 | /**
48 | hasCountOf(value) -
49 | Matches if object's @c -count equals a given value.
50 |
51 | @param value @c NSUInteger value to compare against as the expected value.
52 |
53 | This matcher invokes @c -count on the evaluated object to get the number of elements it
54 | contains, comparing the result to @a value for equality.
55 |
56 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
57 | @c HC_hasCountOf instead.)
58 |
59 | @ingroup collection_matchers
60 | */
61 | #ifdef HC_SHORTHAND
62 | #define hasCountOf HC_hasCountOf
63 | #endif
64 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCHasDescription.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCHasDescription.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCHasDescription : HCInvocationMatcher
14 |
15 | + (id)hasDescription:(id)descriptionMatcher;
16 | - (id)initWithDescription:(id)descriptionMatcher;
17 |
18 | @end
19 |
20 |
21 | OBJC_EXPORT id HC_hasDescription(id match);
22 |
23 | /**
24 | hasDescription(aMatcher) -
25 | Matches if object's @c -description satisfies a given matcher.
26 |
27 | @param aMatcher The matcher to satisfy, or an expected value for @ref equalTo matching.
28 |
29 | This matcher invokes @c -description on the evaluated object to get its description, passing the
30 | result to a given matcher for evaluation. If the @a aMatcher argument is not a matcher, it is
31 | implicitly wrapped in an @ref equalTo matcher to check for equality.
32 |
33 | Examples:
34 | @li @ref hasDescription(@ref startsWith(\@"foo"))
35 | @li @ref hasDescription(\@"bar")
36 |
37 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
38 | @c HC_hasDescription instead.)
39 |
40 | @ingroup object_matchers
41 | */
42 | #ifdef HC_SHORTHAND
43 | #define hasDescription HC_hasDescription
44 | #endif
45 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCHasProperty.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCHasProperty.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Justin Shacklette
6 | //
7 |
8 | #import
9 |
10 |
11 | @interface HCHasProperty : HCBaseMatcher
12 | {
13 | NSString *propertyName;
14 | id valueMatcher;
15 | }
16 |
17 | + (id)hasProperty:(NSString *)property value:(id)aValueMatcher;
18 | - (id)initWithProperty:(NSString *)property value:(id)aValueMatcher;
19 |
20 | @end
21 |
22 |
23 | OBJC_EXPORT id HC_hasProperty(NSString *name, id valueMatch);
24 |
25 | /**
26 | hasProperty(name, valueMatcher) -
27 | Matches if object has a method of a given name whose return value satisfies a given matcher.
28 |
29 | @param name The name of a method without arguments that returns an object.
30 | @param valueMatcher The matcher to satisfy for the return value, or an expected value for @ref equalTo matching.
31 |
32 | This matcher first checks if the evaluated object has a method with a name matching the given
33 | @c name. If so, it invokes the method and sees if the returned value satisfies @c valueMatcher.
34 |
35 | While this matcher is called "hasProperty", it's useful for checking the results of any simple
36 | methods, not just properties.
37 |
38 | Examples:
39 | @li @ref hasProperty(\@"firstName", \@"Joe")
40 | @li @ref hasProperty(\@"firstName", startsWith(\@"J"))
41 |
42 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
43 | @c HC_hasProperty instead.)
44 |
45 | @ingroup object_matchers
46 | */
47 | #ifdef HC_SHORTHAND
48 | #define hasProperty HC_hasProperty
49 | #endif
50 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCInvocationMatcher.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCInvocationMatcher.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | /**
14 | Supporting class for matching a feature of an object.
15 |
16 | Tests whether the result of passing a given invocation to the value satisfies a given matcher.
17 |
18 | @ingroup helpers
19 | */
20 | @interface HCInvocationMatcher : HCBaseMatcher
21 | {
22 | NSInvocation *invocation;
23 | id subMatcher;
24 | BOOL shortMismatchDescription;
25 | }
26 |
27 | /**
28 | Determines whether a mismatch will be described in short form.
29 |
30 | Default is long form, which describes the object, the name of the invocation, and the
31 | sub-matcher's mismatch diagnosis. Short form only has the sub-matcher's mismatch diagnosis.
32 | */
33 | @property (nonatomic, assign) BOOL shortMismatchDescription;
34 |
35 | /**
36 | Helper method for creating an invocation.
37 |
38 | A class is specified only so we can determine the method signature.
39 | */
40 | + (NSInvocation *)invocationForSelector:(SEL)selector onClass:(Class)aClass;
41 |
42 | /**
43 | Returns an HCInvocationMatcher object initialized with an invocation and a matcher.
44 | */
45 | - (id)initWithInvocation:(NSInvocation *)anInvocation matching:(id)aMatcher;
46 |
47 | /**
48 | Invokes stored invocation on given item and returns the result.
49 | */
50 | - (id)invokeOn:(id)item;
51 |
52 | /**
53 | Returns string representation of the invocation's selector.
54 | */
55 | - (NSString *)stringFromSelector;
56 |
57 | @end
58 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCIs.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCIs.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCIs : HCBaseMatcher
14 | {
15 | id matcher;
16 | }
17 |
18 | + (id)is:(id)aMatcher;
19 | - (id)initWithMatcher:(id)aMatcher;
20 |
21 | @end
22 |
23 |
24 | OBJC_EXPORT id HC_is(id match);
25 |
26 | /**
27 | is(aMatcher) -
28 | Decorates another matcher, or provides a shortcut to the frequently used @ref is(equalTo(x)).
29 |
30 | @param aMatcher The matcher to satisfy, or an expected value for @ref equalTo matching.
31 |
32 | This matcher compares the evaluated object to the given matcher.
33 |
34 | If the @a aMatcher argument is a matcher, its behavior is retained, but the test may be more
35 | expressive. For example:
36 | @li @ref assertThatInt(value, equalToInt(5))
37 | @li @ref assertThatInt(value, is(equalToInt(5)))
38 |
39 | If the @a aMatcher argument is not a matcher, it is wrapped in an @ref equalTo matcher. This
40 | makes the following statements equivalent:
41 | @li @ref assertThat(cheese, equalTo(smelly))
42 | @li @ref assertThat(cheese, is(equalTo(smelly)))
43 | @li @ref assertThat(cheese, is(smelly))
44 |
45 | Choose the style that makes your expression most readable. This will vary depending on context.
46 |
47 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
48 | @c HC_is instead.)
49 |
50 | @ingroup decorator_matchers
51 | */
52 | #ifdef HC_SHORTHAND
53 | #define is HC_is
54 | #endif
55 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCIsAnything.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCIsAnything.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCIsAnything : HCBaseMatcher
14 | {
15 | NSString *description;
16 | }
17 |
18 | + (id)isAnything;
19 | + (id)isAnythingWithDescription:(NSString *)aDescription;
20 |
21 | - (id)init;
22 | - (id)initWithDescription:(NSString *)aDescription;
23 |
24 | @end
25 |
26 |
27 | OBJC_EXPORT id HC_anything(void);
28 |
29 | /**
30 | Matches anything.
31 |
32 | This matcher always evaluates to @c YES. Specify this in composite matchers when the value of a
33 | particular element is unimportant.
34 |
35 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
36 | @c HC_anything instead.)
37 |
38 | @ingroup logical_matchers
39 | */
40 | #ifdef HC_SHORTHAND
41 | #define anything() HC_anything()
42 | #endif
43 |
44 |
45 | OBJC_EXPORT id HC_anythingWithDescription(NSString *aDescription);
46 |
47 | /**
48 | anythingWithDescription(description) -
49 | Matches anything.
50 |
51 | @param description A string used to describe this matcher.
52 |
53 | This matcher always evaluates to @c YES. Specify this in collection matchers when the value of a
54 | particular element in a collection is unimportant.
55 |
56 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
57 | @c HC_anything instead.)
58 |
59 | @ingroup logical_matchers
60 | */
61 | #ifdef HC_SHORTHAND
62 | #define anythingWithDescription HC_anythingWithDescription
63 | #endif
64 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCIsCloseTo.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCIsCloseTo.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCIsCloseTo : HCBaseMatcher
14 | {
15 | double value;
16 | double delta;
17 | }
18 |
19 | + (id)isCloseTo:(double)aValue within:(double)aDelta;
20 | - (id)initWithValue:(double)aValue delta:(double)aDelta;
21 |
22 | @end
23 |
24 |
25 | OBJC_EXPORT id HC_closeTo(double aValue, double aDelta);
26 |
27 | /**
28 | closeTo(aValue, aDelta) -
29 | Matches if object is a number close to a given value, within a given delta.
30 |
31 | @param aValue The @c double value to compare against as the expected value.
32 | @param aDelta The @c double maximum delta between the values for which the numbers are considered close.
33 |
34 | This matcher invokes @c -doubleValue on the evaluated object to get its value as a @c double.
35 | The result is compared against @a aValue to see if the difference is within a positive @a aDelta.
36 |
37 | Example:
38 | @li @ref closeTo(3.0, 0.25)
39 |
40 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
41 | @c HC_closeTo instead.)
42 |
43 | @ingroup number_matchers
44 | */
45 | #ifdef HC_SHORTHAND
46 | #define closeTo HC_closeTo
47 | #endif
48 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCIsCollectionContaining.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCIsCollectionContaining.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCIsCollectionContaining : HCBaseMatcher
14 | {
15 | id elementMatcher;
16 | }
17 |
18 | + (id)isCollectionContaining:(id)anElementMatcher;
19 | - (id)initWithMatcher:(id)anElementMatcher;
20 |
21 | @end
22 |
23 |
24 | OBJC_EXPORT id HC_hasItem(id itemMatch);
25 |
26 | /**
27 | hasItem(aMatcher) -
28 | Matches if any element of collection satisfies a given matcher.
29 |
30 | @param aMatcher The matcher to satisfy, or an expected value for @ref equalTo matching.
31 |
32 | This matcher iterates the evaluated collection, searching for any element that satisfies a
33 | given matcher. If a matching element is found, @c hasItem is satisfied.
34 |
35 | If the @a aMatcher argument is not a matcher, it is implicitly wrapped in an @ref equalTo
36 | matcher to check for equality.
37 |
38 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
39 | @c HC_hasItem instead.)
40 |
41 | @ingroup collection_matchers
42 | */
43 | #ifdef HC_SHORTHAND
44 | #define hasItem HC_hasItem
45 | #endif
46 |
47 |
48 | OBJC_EXPORT id HC_hasItems(id itemMatch, ...) NS_REQUIRES_NIL_TERMINATION;
49 |
50 | /**
51 | hasItems(firstMatcher, ...) -
52 | Matches if all of the given matchers are satisfied by any elements of the collection.
53 |
54 | @param firstMatcher,... A comma-separated list of matchers ending with @c nil.
55 |
56 | This matcher iterates the given matchers, searching for any elements in the evaluated collection
57 | that satisfy them. If each matcher is satisfied, then @c hasItems is satisfied.
58 |
59 | Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
60 | equality.
61 |
62 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
63 | @c hasItems instead.)
64 |
65 | @ingroup collection_matchers
66 | */
67 | #ifdef HC_SHORTHAND
68 | #define hasItems HC_hasItems
69 | #endif
70 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCIsCollectionContainingInAnyOrder.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCIsCollectionContainingInAnyOrder.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCIsCollectionContainingInAnyOrder : HCBaseMatcher
14 | {
15 | NSMutableArray *matchers;
16 | }
17 |
18 | + (id)isCollectionContainingInAnyOrder:(NSMutableArray *)itemMatchers;
19 | - (id)initWithMatchers:(NSMutableArray *)itemMatchers;
20 |
21 | @end
22 |
23 |
24 | OBJC_EXPORT id HC_containsInAnyOrder(id itemMatch, ...) NS_REQUIRES_NIL_TERMINATION;
25 |
26 | /**
27 | containsInAnyOrder(firstMatcher, ...) -
28 | Matches if collection's elements, in any order, satisfy a given list of matchers.
29 |
30 | @param firstMatcher,... A comma-separated list of matchers ending with @c nil.
31 |
32 | This matcher iterates the evaluated collection, seeing if each element satisfies any of the
33 | given matchers. The matchers are tried from left to right, and when a satisfied matcher is
34 | found, it is no longer a candidate for the remaining elements. If a one-to-one correspondence is
35 | established between elements and matchers, @c containsInAnyOrder is satisfied.
36 |
37 | Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
38 | equality.
39 |
40 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
41 | @c HC_containsInAnyOrder instead.)
42 |
43 | @ingroup collection_matchers
44 | */
45 | #ifdef HC_SHORTHAND
46 | #define containsInAnyOrder HC_containsInAnyOrder
47 | #endif
48 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCIsCollectionContainingInOrder.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCIsCollectionContainingInOrder.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCIsCollectionContainingInOrder : HCBaseMatcher
14 | {
15 | NSArray *matchers;
16 | }
17 |
18 | + (id)isCollectionContainingInOrder:(NSArray *)itemMatchers;
19 | - (id)initWithMatchers:(NSArray *)itemMatchers;
20 |
21 | @end
22 |
23 |
24 | OBJC_EXPORT id HC_contains(id itemMatch, ...) NS_REQUIRES_NIL_TERMINATION;
25 |
26 | /**
27 | contains(firstMatcher, ...) -
28 | Matches if collection's elements satisfy a given list of matchers, in order.
29 |
30 | @param firstMatcher,... A comma-separated list of matchers ending with @c nil.
31 |
32 | This matcher iterates the evaluated collection and a given list of matchers, seeing if each
33 | element satisfies its corresponding matcher.
34 |
35 | Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
36 | equality.
37 |
38 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
39 | @c HC_contains instead.)
40 |
41 | @ingroup collection_matchers
42 | */
43 | #ifdef HC_SHORTHAND
44 | #define contains HC_contains
45 | #endif
46 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCIsCollectionOnlyContaining.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCIsCollectionOnlyContaining.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCIsCollectionOnlyContaining : HCBaseMatcher
14 | {
15 | id matcher;
16 | }
17 |
18 | + (id)isCollectionOnlyContaining:(id)aMatcher;
19 | - (id)initWithMatcher:(id)aMatcher;
20 |
21 | @end
22 |
23 |
24 | OBJC_EXPORT id HC_onlyContains(id itemMatch, ...) NS_REQUIRES_NIL_TERMINATION;
25 |
26 | /**
27 | onlyContains(firstMatcher, ...) -
28 | Matches if each element of collection satisfies any of the given matchers.
29 |
30 | @param firstMatcher,... A comma-separated list of matchers ending with @c nil.
31 |
32 | This matcher iterates the evaluated collection, confirming whether each element satisfies any of
33 | the given matchers.
34 |
35 | Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
36 | equality.
37 |
38 | Example:
39 |
40 | @par
41 | @ref onlyContains(startsWith(@"Jo"), nil)
42 |
43 | will match a collection [@"Jon", @"John", @"Johann"].
44 |
45 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
46 | @c HC_onlyContains instead.)
47 |
48 | @ingroup collection_matchers
49 | */
50 | #ifdef HC_SHORTHAND
51 | #define onlyContains HC_onlyContains
52 | #endif
53 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCIsDictionaryContaining.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCIsDictionaryContaining.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCIsDictionaryContaining : HCBaseMatcher
14 | {
15 | id keyMatcher;
16 | id valueMatcher;
17 | }
18 |
19 | + (id)isDictionaryContainingKey:(id)aKeyMatcher
20 | value:(id)aValueMatcher;
21 |
22 | - (id)initWithKeyMatcher:(id)aKeyMatcher
23 | valueMatcher:(id)aValueMatcher;
24 |
25 | @end
26 |
27 |
28 | OBJC_EXPORT id HC_hasEntry(id keyMatch, id valueMatch);
29 |
30 | /**
31 | hasEntry(keyMatcher, valueMatcher) -
32 | Matches if dictionary contains key-value entry satisfying a given pair of matchers.
33 |
34 | @param keyMatcher The matcher to satisfy for the key, or an expected value for @ref equalTo matching.
35 | @param valueMatcher The matcher to satisfy for the value, or an expected value for @ref equalTo matching.
36 |
37 | This matcher iterates the evaluated dictionary, searching for any key-value entry that satisfies
38 | @a keyMatcher and @a valueMatcher. If a matching entry is found, @c hasEntry is satisfied.
39 |
40 | Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
41 | equality.
42 |
43 | Examples:
44 | @li @ref hasEntry(@ref equalTo(@"foo"), equalTo(@"bar"))
45 | @li @ref hasEntry(@"foo", @"bar")
46 |
47 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
48 | @c HC_hasEntry instead.)
49 |
50 | @ingroup collection_matchers
51 | */
52 | #ifdef HC_SHORTHAND
53 | #define hasEntry HC_hasEntry
54 | #endif
55 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCIsDictionaryContainingEntries.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCIsDictionaryContainingEntries.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCIsDictionaryContainingEntries : HCBaseMatcher
14 | {
15 | NSArray *keys;
16 | NSArray *valueMatchers;
17 | }
18 |
19 | + (id)isDictionaryContainingKeys:(NSArray *)theKeys
20 | valueMatchers:(NSArray *)theValueMatchers;
21 |
22 | - (id)initWithKeys:(NSArray *)theKeys
23 | valueMatchers:(NSArray *)theValueMatchers;
24 |
25 | @end
26 |
27 |
28 | OBJC_EXPORT id HC_hasEntries(id keysAndValueMatch, ...) NS_REQUIRES_NIL_TERMINATION;
29 |
30 | /**
31 | hasEntries(firstKey, valueMatcher, ...) -
32 | Matches if dictionary contains entries satisfying a list of alternating keys and their value
33 | matchers.
34 |
35 | @param firstKey A key (not a matcher) to look up.
36 | @param valueMatcher,... The matcher to satisfy for the value, or an expected value for @ref equalTo matching.
37 |
38 | Note that the keys must be actual keys, not matchers. Any value argument that is not a matcher
39 | is implicitly wrapped in an @ref equalTo matcher to check for equality. The list must end with
40 | @c nil.
41 |
42 | Examples:
43 | @li @ref hasEntries(@"first", equalTo(@"Jon"), @"last", equalTo(@"Reid"), nil)
44 | @li @ref hasEntries(@"first", @"Jon", @"last", @"Reid", nil)
45 |
46 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
47 | @c HC_hasEntry instead.)
48 |
49 | @ingroup collection_matchers
50 | */
51 | #ifdef HC_SHORTHAND
52 | #define hasEntries HC_hasEntries
53 | #endif
54 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCIsDictionaryContainingKey.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCIsDictionaryContainingKey.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCIsDictionaryContainingKey : HCBaseMatcher
14 | {
15 | id keyMatcher;
16 | }
17 |
18 | + (id)isDictionaryContainingKey:(id)theKeyMatcher;
19 | - (id)initWithKeyMatcher:(id)theKeyMatcher;
20 |
21 | @end
22 |
23 |
24 | OBJC_EXPORT id HC_hasKey(id keyMatch);
25 |
26 | /**
27 | hasKey(keyMatcher) -
28 | Matches if dictionary contains an entry whose key satisfies a given matcher.
29 |
30 | @param keyMatcher The matcher to satisfy for the key, or an expected value for @ref equalTo matching.
31 |
32 | This matcher iterates the evaluated dictionary, searching for any key-value entry whose key
33 | satisfies the given matcher. If a matching entry is found, @c hasKey is satisfied.
34 |
35 | Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
36 | equality.
37 |
38 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
39 | @c HC_hasKey instead.)
40 |
41 | Examples:
42 | @li @ref hasEntry(equalTo(@"foo"))
43 | @li @ref hasEntry(@"foo")
44 |
45 | @ingroup collection_matchers
46 | */
47 | #ifdef HC_SHORTHAND
48 | #define hasKey HC_hasKey
49 | #endif
50 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCIsDictionaryContainingValue.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCIsDictionaryContainingValue.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCIsDictionaryContainingValue : HCBaseMatcher
14 | {
15 | id valueMatcher;
16 | }
17 |
18 | + (id)isDictionaryContainingValue:(id)theValueMatcher;
19 | - (id)initWithValueMatcher:(id)theValueMatcher;
20 |
21 | @end
22 |
23 |
24 | OBJC_EXPORT id HC_hasValue(id valueMatch);
25 |
26 | /**
27 | hasValue(valueMatcher) -
28 | Matches if dictionary contains an entry whose value satisfies a given matcher.
29 |
30 | @param valueMatcher The matcher to satisfy for the value, or an expected value for @ref equalTo matching.
31 |
32 | This matcher iterates the evaluated dictionary, searching for any key-value entry whose value
33 | satisfies the given matcher. If a matching entry is found, @c hasValue is satisfied.
34 |
35 | Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
36 | equality.
37 |
38 | Examples:
39 | @li @ref hasValue(equalTo(@"bar"))
40 | @li @ref hasValue(@"bar")
41 |
42 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
43 | @c HC_hasValue instead.)
44 |
45 | @ingroup collection_matchers
46 | */
47 | #ifdef HC_SHORTHAND
48 | #define hasValue HC_hasValue
49 | #endif
50 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCIsEmptyCollection.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCIsEmptyCollection.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCIsEmptyCollection : HCHasCount
14 |
15 | + (id)isEmptyCollection;
16 | - (id)init;
17 |
18 | @end
19 |
20 |
21 | OBJC_EXPORT id HC_empty(void);
22 |
23 | /**
24 | Matches empty collection.
25 |
26 | This matcher invokes @c -count on the evaluated object to determine if the number of elements it
27 | contains is zero.
28 |
29 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
30 | @c HC_empty instead.)
31 |
32 | @ingroup collection_matchers
33 | */
34 | #ifdef HC_SHORTHAND
35 | #define empty() HC_empty()
36 | #endif
37 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCIsEqual.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCIsEqual.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCIsEqual : HCBaseMatcher
14 | {
15 | id object;
16 | }
17 |
18 | + (id)isEqualTo:(id)anObject;
19 | - (id)initEqualTo:(id)anObject;
20 |
21 | @end
22 |
23 |
24 | OBJC_EXPORT id HC_equalTo(id object);
25 |
26 | /**
27 | equalTo(anObject) -
28 | Matches if object is equal to a given object.
29 |
30 | @param anObject The object to compare against as the expected value.
31 |
32 | This matcher compares the evaluated object to @a anObject for equality, as determined by the
33 | @c -isEqual: method.
34 |
35 | If @a anObject is @c nil, the matcher will successfully match @c nil.
36 |
37 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
38 | @c HC_equalTo instead.)
39 |
40 | @ingroup object_matchers
41 | */
42 | #ifdef HC_SHORTHAND
43 | #define equalTo HC_equalTo
44 | #endif
45 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCIsEqualIgnoringCase.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCIsEqualIgnoringCase.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCIsEqualIgnoringCase : HCBaseMatcher
14 | {
15 | NSString *string;
16 | }
17 |
18 | + (id)isEqualIgnoringCase:(NSString *)aString;
19 | - (id)initWithString:(NSString *)aString;
20 |
21 | @end
22 |
23 |
24 | OBJC_EXPORT id HC_equalToIgnoringCase(NSString *aString);
25 |
26 | /**
27 | equalToIgnoringCase(aString) -
28 | Matches if object is a string equal to a given string, ignoring case differences.
29 |
30 | @param aString The string to compare against as the expected value. This value must not be @c nil.
31 |
32 | This matcher first checks whether the evaluated object is a string. If so, it compares it with
33 | @a aString, ignoring differences of case.
34 |
35 | Example:
36 |
37 | @par
38 | @ref equalToIgnoringCase(@"hello world")
39 |
40 | will match "heLLo WorlD".
41 |
42 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
43 | @c HC_equalToIgnoringCase instead.)
44 |
45 | @ingroup text_matchers
46 | */
47 | #ifdef HC_SHORTHAND
48 | #define equalToIgnoringCase HC_equalToIgnoringCase
49 | #endif
50 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCIsEqualIgnoringWhiteSpace.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCIsEqualIgnoringWhiteSpace.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCIsEqualIgnoringWhiteSpace : HCBaseMatcher
14 | {
15 | NSString *originalString;
16 | NSString *strippedString;
17 | }
18 |
19 | + (id)isEqualIgnoringWhiteSpace:(NSString *)aString;
20 | - (id)initWithString:(NSString *)aString;
21 |
22 | @end
23 |
24 |
25 | OBJC_EXPORT id HC_equalToIgnoringWhiteSpace(NSString *aString);
26 |
27 | /**
28 | equalToIgnoringWhiteSpace(aString) -
29 | Matches if object is a string equal to a given string, ignoring differences in whitespace.
30 |
31 | @param aString The string to compare against as the expected value. This value must not be @c nil.
32 |
33 | This matcher first checks whether the evaluated object is a string. If so, it compares it with
34 | @a aString, ignoring differences in runs of whitespace.
35 |
36 | Example:
37 |
38 | @par
39 | @ref equalToIgnoringWhiteSpace(@"hello world")
40 |
41 | will match @verbatim "hello world" @endverbatim
42 |
43 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
44 | @c HC_equalToIgnoringWhiteSpace instead.)
45 |
46 | @ingroup text_matchers
47 | */
48 | #ifdef HC_SHORTHAND
49 | #define equalToIgnoringWhiteSpace HC_equalToIgnoringWhiteSpace
50 | #endif
51 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCIsEqualToNumber.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCIsEqualToNumber.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | OBJC_EXPORT id HC_equalToBool(BOOL value);
14 |
15 | /**
16 | equalToBool(value) -
17 | Matches if object is equal to @c NSNumber created from a @c BOOL.
18 |
19 | @param value The @c BOOL value from which to create an @c NSNumber.
20 |
21 | This matcher creates an @c NSNumber object from a @c BOOL @a value and compares the evaluated
22 | object to it for equality.
23 |
24 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
25 | @c HC_equalToBool instead.)
26 |
27 | @ingroup primitive_number_matchers
28 | */
29 | #ifdef HC_SHORTHAND
30 | #define equalToBool HC_equalToBool
31 | #endif
32 |
33 |
34 | OBJC_EXPORT id HC_equalToChar(char value);
35 |
36 | /**
37 | equalToChar(value) -
38 | Matches if object is equal to @c NSNumber created from a @c char.
39 |
40 | @param value The @c char value from which to create an @c NSNumber.
41 |
42 | This matcher creates an @c NSNumber object from a @c char @a value and compares the evaluated
43 | object to it for equality.
44 |
45 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
46 | @c HC_equalToChar instead.)
47 |
48 | @ingroup primitive_number_matchers
49 | */
50 | #ifdef HC_SHORTHAND
51 | #define equalToChar HC_equalToChar
52 | #endif
53 |
54 |
55 | OBJC_EXPORT id HC_equalToDouble(double value);
56 |
57 | /**
58 | equalToDouble(value) -
59 | Matches if object is equal to @c NSNumber created from a @c double.
60 |
61 | @param value The @c double value from which to create an @c NSNumber.
62 |
63 | This matcher creates an @c NSNumber object from a @c double @a value and compares the evaluated
64 | object to it for equality.
65 |
66 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
67 | @c HC_equalToDouble instead.)
68 |
69 | @ingroup primitive_number_matchers
70 | */
71 | #ifdef HC_SHORTHAND
72 | #define equalToDouble HC_equalToDouble
73 | #endif
74 |
75 |
76 | OBJC_EXPORT id HC_equalToFloat(float value);
77 |
78 | /**
79 | equalToFloat(value) -
80 | Matches if object is equal to @c NSNumber created from a @c float.
81 |
82 | @param value The @c float value from which to create an @c NSNumber.
83 |
84 | This matcher creates an @c NSNumber object from a @c float @a value and compares the evaluated
85 | object to it for equality.
86 |
87 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
88 | @c HC_equalToFloat instead.)
89 |
90 | @ingroup primitive_number_matchers
91 | */
92 | #ifdef HC_SHORTHAND
93 | #define equalToFloat HC_equalToFloat
94 | #endif
95 |
96 |
97 | OBJC_EXPORT id HC_equalToInt(int value);
98 |
99 | /**
100 | equalToInt(value) -
101 | Matches if object is equal to @c NSNumber created from an @c int.
102 |
103 | @param value The @c int value from which to create an @c NSNumber.
104 |
105 | This matcher creates an @c NSNumber object from a @c int @a value and compares the evaluated
106 | object to it for equality.
107 |
108 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
109 | @c HC_equalToInt instead.)
110 |
111 | @ingroup primitive_number_matchers
112 | */
113 | #ifdef HC_SHORTHAND
114 | #define equalToInt HC_equalToInt
115 | #endif
116 |
117 |
118 | OBJC_EXPORT id HC_equalToLong(long value);
119 |
120 | /**
121 | equalToLong(value) -
122 | Matches if object is equal to @c NSNumber created from a @c long.
123 |
124 | @param value The @c long value from which to create an @c NSNumber.
125 |
126 | This matcher creates an @c NSNumber object from a @c long @a value and compares the evaluated
127 | object to it for equality.
128 |
129 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
130 | @c HC_equalToLong instead.)
131 |
132 | @ingroup primitive_number_matchers
133 | */
134 | #ifdef HC_SHORTHAND
135 | #define equalToLong HC_equalToLong
136 | #endif
137 |
138 |
139 | OBJC_EXPORT id HC_equalToLongLong(long long value);
140 |
141 | /**
142 | equalToLongLong(value) -
143 | Matches if object is equal to @c NSNumber created from a long long
.
144 |
145 | @param value The long long
value from which to create an @c NSNumber.
146 |
147 | This matcher creates an @c NSNumber object from a long long
@a value and compares
148 | the evaluated object to it for equality.
149 |
150 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
151 | @c HC_equalToLongLong instead.)
152 |
153 | @ingroup primitive_number_matchers
154 | */
155 | #ifdef HC_SHORTHAND
156 | #define equalToLongLong HC_equalToLongLong
157 | #endif
158 |
159 |
160 | OBJC_EXPORT id HC_equalToShort(short value);
161 |
162 | /**
163 | equalToShort(value) -
164 | Matches if object is equal to @c NSNumber created from a @c short.
165 |
166 | @param value The @c short value from which to create an @c NSNumber.
167 |
168 | This matcher creates an @c NSNumber object from a @c short @a value and compares the evaluated
169 | object to it for equality.
170 |
171 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
172 | @c HC_equalToShort instead.)
173 |
174 | @ingroup primitive_number_matchers
175 | */
176 | #ifdef HC_SHORTHAND
177 | #define equalToShort HC_equalToShort
178 | #endif
179 |
180 |
181 | OBJC_EXPORT id HC_equalToUnsignedChar(unsigned char value);
182 |
183 | /**
184 | equalToUnsignedChar(value) -
185 | Matches if object is equal to @c NSNumber created from an unsigned char
.
186 |
187 | @param value The unsigned char
value from which to create an @c NSNumber.
188 |
189 | This matcher creates an @c NSNumber object from an unsigned char
@a value and
190 | compares the evaluated object to it for equality.
191 |
192 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
193 | @c HC_equalToUnsignedChar instead.)
194 |
195 | @ingroup primitive_number_matchers
196 | */
197 | #ifdef HC_SHORTHAND
198 | #define equalToUnsignedChar HC_equalToUnsignedChar
199 | #endif
200 |
201 |
202 | OBJC_EXPORT id HC_equalToUnsignedInt(unsigned int value);
203 |
204 | /**
205 | equalToUnsignedInt(value) -
206 | Matches if object is equal to @c NSNumber created from an unsigned int
.
207 |
208 | @param value The unsigned int
value from which to create an @c NSNumber.
209 |
210 | This matcher creates an @c NSNumber object from an unsigned int
@a value and
211 | compares the evaluated object to it for equality.
212 |
213 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
214 | @c HC_equalToUnsignedInt instead.)
215 |
216 | @ingroup primitive_number_matchers
217 | */
218 | #ifdef HC_SHORTHAND
219 | #define equalToUnsignedInt HC_equalToUnsignedInt
220 | #endif
221 |
222 |
223 | OBJC_EXPORT id HC_equalToUnsignedLong(unsigned long value);
224 |
225 | /**
226 | equalToUnsignedLong(value) -
227 | Matches if object is equal to @c NSNumber created from an unsigned long
.
228 |
229 | @param value The unsigned long
value from which to create an @c NSNumber.
230 |
231 | This matcher creates an @c NSNumber object from an unsigned long
@a value and
232 | compares the evaluated object to it for equality.
233 |
234 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
235 | @c HC_equalToUnsignedLong instead.)
236 |
237 | @ingroup primitive_number_matchers
238 | */
239 | #ifdef HC_SHORTHAND
240 | #define equalToUnsignedLong HC_equalToUnsignedLong
241 | #endif
242 |
243 |
244 | OBJC_EXPORT id HC_equalToUnsignedLongLong(unsigned long long value);
245 |
246 | /**
247 | equalToUnsignedLongLong(value) -
248 | Matches if object is equal to @c NSNumber created from an unsigned long long
.
249 |
250 | @param value The unsigned long long
value from which to create an @c NSNumber.
251 |
252 | This matcher creates an @c NSNumber object from an unsigned long long
@a value and
253 | compares the evaluated object to it for equality.
254 |
255 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
256 | @c HC_equalToUnsignedLongLong instead.)
257 |
258 | @ingroup primitive_number_matchers
259 | */
260 | #ifdef HC_SHORTHAND
261 | #define equalToUnsignedLongLong HC_equalToUnsignedLongLong
262 | #endif
263 |
264 |
265 | OBJC_EXPORT id HC_equalToUnsignedShort(unsigned short value);
266 |
267 | /**
268 | equalToUnsignedShort(value) -
269 | Matches if object is equal to @c NSNumber created from an unsigned short
.
270 |
271 | @param value The unsigned short
value from which to create an @c NSNumber.
272 |
273 | This matcher creates an @c NSNumber object from an unsigned short
@a value and
274 | compares the evaluated object to it for equality.
275 |
276 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
277 | @c HC_equalToUnsignedShort instead.)
278 |
279 | @ingroup primitive_number_matchers
280 | */
281 | #ifdef HC_SHORTHAND
282 | #define equalToUnsignedShort HC_equalToUnsignedShort
283 | #endif
284 |
285 |
286 | OBJC_EXPORT id HC_equalToInteger(NSInteger value);
287 |
288 | /**
289 | equalToInteger(value) -
290 | Matches if object is equal to @c NSNumber created from an @c NSInteger.
291 |
292 | @param value The @c NSInteger value from which to create an @c NSNumber.
293 |
294 | This matcher creates an @c NSNumber object from an @c NSInteger @a value and compares the
295 | evaluated object to it for equality.
296 |
297 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
298 | @c HC_equalToInteger instead.)
299 |
300 | @ingroup primitive_number_matchers
301 | */
302 | #ifdef HC_SHORTHAND
303 | #define equalToInteger HC_equalToInteger
304 | #endif
305 |
306 |
307 | OBJC_EXPORT id HC_equalToUnsignedInteger(NSUInteger value);
308 |
309 | /**
310 | equalToUnsignedInteger(value) -
311 | Matches if object is equal to @c NSNumber created from an @c NSUInteger.
312 |
313 | @param value The @c NSUInteger value from which to create an @c NSNumber.
314 |
315 | This matcher creates an @c NSNumber object from an @c NSUInteger @a value and compares the
316 | evaluated object to it for equality.
317 |
318 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
319 | @c HC_equalToUnsignedInteger instead.)
320 |
321 | @ingroup primitive_number_matchers
322 | */
323 | #ifdef HC_SHORTHAND
324 | #define equalToUnsignedInteger HC_equalToUnsignedInteger
325 | #endif
326 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCIsIn.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCIsIn.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCIsIn : HCBaseMatcher
14 | {
15 | id collection;
16 | }
17 |
18 | + (id)isInCollection:(id)aCollection;
19 | - (id)initWithCollection:(id)aCollection;
20 |
21 | @end
22 |
23 |
24 | OBJC_EXPORT id HC_isIn(id aCollection);
25 |
26 | /**
27 | isIn(aCollection) -
28 | Matches if evaluated object is present in a given collection.
29 |
30 | @param aCollection The collection to search.
31 |
32 | This matcher invokes @c -containsObject: on @a aCollection to determine if the evaluated object
33 | is an element of the collection.
34 |
35 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
36 | @c HC_isIn instead.)
37 |
38 | @ingroup collection_matchers
39 | */
40 | #ifdef HC_SHORTHAND
41 | #define isIn HC_isIn
42 | #endif
43 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCIsInstanceOf.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCIsInstanceOf.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCIsInstanceOf : HCBaseMatcher
14 | {
15 | Class theClass;
16 | }
17 |
18 | + (id)isInstanceOf:(Class)type;
19 | - (id)initWithType:(Class)type;
20 |
21 | @end
22 |
23 |
24 | OBJC_EXPORT id HC_instanceOf(Class aClass);
25 |
26 | /**
27 | instanceOf(aClass) -
28 | Matches if object is an instance of, or inherits from, a given class.
29 |
30 | @param aClass The class to compare against as the expected class.
31 |
32 | This matcher checks whether the evaluated object is an instance of @a aClass or an instance of
33 | any class that inherits from @a aClass.
34 |
35 | Example:
36 | @li @ref instanceOf([NSString class])
37 |
38 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
39 | @c HC_instanceOf instead.)
40 |
41 | @ingroup object_matchers
42 | */
43 | #ifdef HC_SHORTHAND
44 | #define instanceOf HC_instanceOf
45 | #endif
46 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCIsNil.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCIsNil.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCIsNil : HCBaseMatcher
14 |
15 | + (id)isNil;
16 |
17 | @end
18 |
19 |
20 | OBJC_EXPORT id HC_nilValue(void);
21 |
22 | /**
23 | Matches if object is @c nil.
24 |
25 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
26 | @c HC_nilValue instead.)
27 |
28 | @ingroup object_matchers
29 | */
30 | #ifdef HC_SHORTHAND
31 | #define nilValue() HC_nilValue()
32 | #endif
33 |
34 |
35 | OBJC_EXPORT id HC_notNilValue(void);
36 |
37 | /**
38 | Matches if object is not @c nil.
39 |
40 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
41 | @c HC_notNilValue instead.)
42 |
43 | @ingroup object_matchers
44 | */
45 | #ifdef HC_SHORTHAND
46 | #define notNilValue() HC_notNilValue()
47 | #endif
48 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCIsNot.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCIsNot.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCIsNot : HCBaseMatcher
14 | {
15 | id matcher;
16 | }
17 |
18 | + (id)isNot:(id)aMatcher;
19 | - (id)initNot:(id)aMatcher;
20 |
21 | @end
22 |
23 |
24 | OBJC_EXPORT id HC_isNot(id aMatcher);
25 |
26 | /**
27 | isNot(aMatcher) -
28 | Inverts the given matcher to its logical negation.
29 |
30 | @param aMatcher The matcher to negate.
31 |
32 | This matcher compares the evaluated object to the negation of the given matcher. If the
33 | @a aMatcher argument is not a matcher, it is implicitly wrapped in an @ref equalTo matcher to
34 | check for equality, and thus matches for inequality.
35 |
36 | Examples:
37 | @li @ref assertThat(cheese, isNot(equalTo(smelly)))
38 | @li @ref assertThat(cheese, isNot(smelly))
39 |
40 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
41 | @c HC_isNot instead.)
42 |
43 | @ingroup logical_matchers
44 | */
45 | #ifdef HC_SHORTHAND
46 | #define isNot HC_isNot
47 | #endif
48 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCIsSame.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCIsSame.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCIsSame : HCBaseMatcher
14 | {
15 | id object;
16 | }
17 |
18 | + (id)isSameAs:(id)anObject;
19 | - (id)initSameAs:(id)anObject;
20 |
21 | @end
22 |
23 |
24 | OBJC_EXPORT id HC_sameInstance(id object);
25 |
26 | /**
27 | sameInstance(anObject) -
28 | Matches if evaluated object is the same instance as a given object.
29 |
30 | @param anObject The object to compare against as the expected value.
31 |
32 | This matcher compares the address of the evaluated object to determine if it is the same object
33 | as @a anObject.
34 |
35 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
36 | @c HC_sameInstance instead.)
37 |
38 | @ingroup object_matchers
39 | */
40 | #ifdef HC_SHORTHAND
41 | #define sameInstance HC_sameInstance
42 | #endif
43 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCMatcher.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCMatcher.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import "HCSelfDescribing.h"
11 |
12 |
13 | /**
14 | A matcher over acceptable values.
15 |
16 | A matcher is able to describe itself to give feedback when it fails.
17 |
18 | HCMatcher implementations should @b not directly implement this protocol.
19 | Instead, @b extend the HCBaseMatcher class, which will ensure that the HCMatcher API can grow
20 | to support new features and remain compatible with all HCMatcher implementations.
21 |
22 | @ingroup core
23 | */
24 | @protocol HCMatcher
25 |
26 | /**
27 | Evaluates the matcher for argument @a item.
28 |
29 | @param item The object against which the matcher is evaluated.
30 | @return @c YES if @a item matches, otherwise @c NO.
31 | */
32 | - (BOOL)matches:(id)item;
33 |
34 | /**
35 | Evaluates the matcher for argument @a item.
36 |
37 | @param item The object against which the matcher is evaluated.
38 | @param mismatchDescription The description to be built or appended to if @a item does not match.
39 | @return @c YES if @a item matches, otherwise @c NO.
40 | */
41 | - (BOOL)matches:(id)item describingMismatchTo:(id)mismatchDescription;
42 |
43 | /**
44 | Generates a description of why the matcher has not accepted the item.
45 |
46 | The description will be part of a larger description of why a matching failed, so it should be
47 | concise.
48 |
49 | This method assumes that @c matches:item is false, but will not check this.
50 |
51 | @param item The item that the HCMatcher has rejected.
52 | @param mismatchDescription The description to be built or appended to.
53 | */
54 | - (void)describeMismatchOf:(id)item to:(id)mismatchDescription;
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCNumberAssert.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCNumberAssert.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 | @protocol HCMatcher;
13 |
14 |
15 | OBJC_EXPORT void HC_assertThatBoolWithLocation(id testCase, BOOL actual,
16 | id matcher, const char* fileName, int lineNumber);
17 |
18 | #define HC_assertThatBool(actual, matcher) \
19 | HC_assertThatBoolWithLocation(self, actual, matcher, __FILE__, __LINE__)
20 |
21 | /**
22 | assertThatBool(actual, matcher) -
23 | Asserts that @c BOOL actual value, converted to an @c NSNumber, satisfies matcher.
24 |
25 | @param actual The @c BOOL value to convert to an @c NSNumber for evaluation.
26 | @param matcher The matcher to satisfy as the expected condition.
27 |
28 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
29 | @c HC_assertThatBool instead.)
30 |
31 | @ingroup integration_numeric
32 | */
33 | #ifdef HC_SHORTHAND
34 | #define assertThatBool HC_assertThatBool
35 | #endif
36 |
37 |
38 | #pragma mark -
39 |
40 | OBJC_EXPORT void HC_assertThatCharWithLocation(id testCase, char actual,
41 | id matcher, const char* fileName, int lineNumber);
42 |
43 | #define HC_assertThatChar(actual, matcher) \
44 | HC_assertThatCharWithLocation(self, actual, matcher, __FILE__, __LINE__)
45 |
46 | /**
47 | assertThatChar(actual, matcher) -
48 | Asserts that @c char actual value, converted to an @c NSNumber, satisfies matcher.
49 |
50 | @param actual The @c char value to convert to an @c NSNumber for evaluation.
51 | @param matcher The matcher to satisfy as the expected condition.
52 |
53 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
54 | @c HC_assertThatChar instead.)
55 |
56 | @ingroup integration_numeric
57 | */
58 | #ifdef HC_SHORTHAND
59 | #define assertThatChar HC_assertThatChar
60 | #endif
61 |
62 |
63 | #pragma mark -
64 |
65 | OBJC_EXPORT void HC_assertThatDoubleWithLocation(id testCase, double actual,
66 | id matcher, const char* fileName, int lineNumber);
67 |
68 | #define HC_assertThatDouble(actual, matcher) \
69 | HC_assertThatDoubleWithLocation(self, actual, matcher, __FILE__, __LINE__)
70 |
71 | /**
72 | HC_assertThatDouble(actual, matcher) -
73 | Asserts that @c double actual value, converted to an @c NSNumber, satisfies matcher.
74 |
75 | @param actual The @c double value to convert to an @c NSNumber for evaluation.
76 | @param matcher The matcher to satisfy as the expected condition.
77 |
78 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
79 | @c HC_assertThatDouble instead.)
80 |
81 | @ingroup integration_numeric
82 | */
83 | #ifdef HC_SHORTHAND
84 | #define assertThatDouble HC_assertThatDouble
85 | #endif
86 |
87 |
88 | #pragma mark -
89 |
90 | OBJC_EXPORT void HC_assertThatFloatWithLocation(id testCase, float actual,
91 | id matcher, const char* fileName, int lineNumber);
92 |
93 | #define HC_assertThatFloat(actual, matcher) \
94 | HC_assertThatFloatWithLocation(self, actual, matcher, __FILE__, __LINE__)
95 |
96 | /**
97 | assertThatFloat(actual, matcher) -
98 | Asserts that @c float actual value, converted to an @c NSNumber, satisfies matcher.
99 |
100 | @param actual The @c float value to convert to an @c NSNumber for evaluation.
101 | @param matcher The matcher to satisfy as the expected condition.
102 |
103 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
104 | @c HC_assertThatFloat instead.)
105 |
106 | @ingroup integration_numeric
107 | */
108 | #ifdef HC_SHORTHAND
109 | #define assertThatFloat HC_assertThatFloat
110 | #endif
111 |
112 |
113 | #pragma mark -
114 |
115 | OBJC_EXPORT void HC_assertThatIntWithLocation(id testCase, int actual,
116 | id matcher, const char* fileName, int lineNumber);
117 |
118 | #define HC_assertThatInt(actual, matcher) \
119 | HC_assertThatIntWithLocation(self, actual, matcher, __FILE__, __LINE__)
120 |
121 | /**
122 | assertThatInt(actual, matcher) -
123 | Asserts that @c int actual value, converted to an @c NSNumber, satisfies matcher.
124 |
125 | @param actual The @c int value to convert to an @c NSNumber for evaluation.
126 | @param matcher The matcher to satisfy as the expected condition.
127 |
128 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
129 | @c HC_assertThatInt instead.)
130 |
131 | @ingroup integration_numeric
132 | */
133 | #ifdef HC_SHORTHAND
134 | #define assertThatInt HC_assertThatInt
135 | #endif
136 |
137 |
138 | #pragma mark -
139 |
140 | OBJC_EXPORT void HC_assertThatLongWithLocation(id testCase, long actual,
141 | id matcher, const char* fileName, int lineNumber);
142 |
143 | #define HC_assertThatLong(actual, matcher) \
144 | HC_assertThatLongWithLocation(self, actual, matcher, __FILE__, __LINE__)
145 |
146 | /**
147 | assertThatLong(actual, matcher) -
148 | Asserts that @c long actual value, converted to an @c NSNumber, satisfies matcher.
149 |
150 | @param actual The @c long value to convert to an @c NSNumber for evaluation.
151 | @param matcher The matcher to satisfy as the expected condition.
152 |
153 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
154 | @c HC_assertThatLong instead.)
155 |
156 | @ingroup integration_numeric
157 | */
158 | #ifdef HC_SHORTHAND
159 | #define assertThatLong HC_assertThatLong
160 | #endif
161 |
162 |
163 | #pragma mark -
164 |
165 | OBJC_EXPORT void HC_assertThatLongLongWithLocation(id testCase, long long actual,
166 | id matcher, const char* fileName, int lineNumber);
167 |
168 | #define HC_assertThatLongLong(actual, matcher) \
169 | HC_assertThatLongLongWithLocation(self, actual, matcher, __FILE__, __LINE__)
170 |
171 | /**
172 | assertThatLongLong(actual, matcher) -
173 | Asserts that long long
actual value, converted to an @c NSNumber, satisfies
174 | matcher.
175 |
176 | @param actual The long long
value to convert to an @c NSNumber for evaluation.
177 | @param matcher The matcher to satisfy as the expected condition.
178 |
179 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
180 | @c HC_assertThatLongLong instead.)
181 |
182 | @ingroup integration_numeric
183 | */
184 | #ifdef HC_SHORTHAND
185 | #define assertThatLongLong HC_assertThatLongLong
186 | #endif
187 |
188 |
189 | #pragma mark -
190 |
191 | OBJC_EXPORT void HC_assertThatShortWithLocation(id testCase, short actual,
192 | id matcher, const char* fileName, int lineNumber);
193 |
194 | #define HC_assertThatShort(actual, matcher) \
195 | HC_assertThatShortWithLocation(self, actual, matcher, __FILE__, __LINE__)
196 |
197 | /**
198 | assertThatShort(actual, matcher) -
199 | Asserts that @c short actual value, converted to an @c NSNumber, satisfies matcher.
200 |
201 | @param actual The @c short value to convert to an @c NSNumber for evaluation.
202 | @param matcher The matcher to satisfy as the expected condition.
203 |
204 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
205 | @c HC_assertThatShort instead.)
206 |
207 | @ingroup integration_numeric
208 | */
209 | #ifdef HC_SHORTHAND
210 | #define assertThatShort HC_assertThatShort
211 | #endif
212 |
213 |
214 | #pragma mark -
215 |
216 | OBJC_EXPORT void HC_assertThatUnsignedCharWithLocation(id testCase, unsigned char actual,
217 | id matcher, const char* fileName, int lineNumber);
218 |
219 | #define HC_assertThatUnsignedChar(actual, matcher) \
220 | HC_assertThatUnsignedCharWithLocation(self, actual, matcher, __FILE__, __LINE__)
221 |
222 | /**
223 | assertThatUnsignedChar(actual, matcher) -
224 | Asserts that unsigned char
actual value, converted to an @c NSNumber, satisfies
225 | matcher.
226 |
227 | @param actual The unsigned char
value to convert to an @c NSNumber for evaluation.
228 | @param matcher The matcher to satisfy as the expected condition.
229 |
230 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
231 | @c HC_assertThatUnsignedChar instead.)
232 |
233 | @ingroup integration_numeric
234 | */
235 | #ifdef HC_SHORTHAND
236 | #define assertThatUnsignedChar HC_assertThatUnsignedChar
237 | #endif
238 |
239 |
240 | #pragma mark -
241 |
242 | OBJC_EXPORT void HC_assertThatUnsignedIntWithLocation(id testCase, unsigned int actual,
243 | id matcher, const char* fileName, int lineNumber);
244 |
245 | #define HC_assertThatUnsignedInt(actual, matcher) \
246 | HC_assertThatUnsignedIntWithLocation(self, actual, matcher, __FILE__, __LINE__)
247 |
248 | /**
249 | assertThatUnsignedInt(actual, matcher) -
250 | Asserts that unsigned int
actual value, converted to an @c NSNumber, satisfies
251 | matcher.
252 |
253 | @param actual The unsigned int
value to convert to an @c NSNumber for evaluation @param matcher The matcher to satisfy as the expected condition.
254 |
255 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
256 | @c HC_assertThatUnsignedInt instead.)
257 |
258 | @ingroup integration_numeric
259 | */
260 | #ifdef HC_SHORTHAND
261 | #define assertThatUnsignedInt HC_assertThatUnsignedInt
262 | #endif
263 |
264 |
265 | #pragma mark -
266 |
267 | OBJC_EXPORT void HC_assertThatUnsignedLongWithLocation(id testCase, unsigned long actual,
268 | id matcher, const char* fileName, int lineNumber);
269 |
270 | #define HC_assertThatUnsignedLong(actual, matcher) \
271 | HC_assertThatUnsignedLongWithLocation(self, actual, matcher, __FILE__, __LINE__)
272 |
273 | /**
274 | assertThatUnsignedLong(actual, matcher) -
275 | Asserts that unsigned long
actual value, converted to an @c NSNumber, satisfies
276 | matcher.
277 |
278 | @param actual The unsigned long
value to convert to an @c NSNumber for evaluation @param matcher The matcher to satisfy as the expected condition.
279 |
280 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
281 | @c HC_assertThatUnsignedLong instead.)
282 |
283 | @ingroup integration_numeric
284 | */
285 | #ifdef HC_SHORTHAND
286 | #define assertThatUnsignedLong HC_assertThatUnsignedLong
287 | #endif
288 |
289 |
290 | #pragma mark -
291 |
292 | OBJC_EXPORT void HC_assertThatUnsignedLongLongWithLocation(id testCase, unsigned long long actual,
293 | id matcher, const char* fileName, int lineNumber);
294 |
295 | #define HC_assertThatUnsignedLongLong(actual, matcher) \
296 | HC_assertThatUnsignedLongLongWithLocation(self, actual, matcher, __FILE__, __LINE__)
297 |
298 | /**
299 | assertThatUnsignedLongLong(actual, matcher) -
300 | Asserts that unsigned long long
actual value, converted to an @c NSNumber,
301 | satisfies matcher.
302 |
303 | @param actual The unsigned long long
value to convert to an @c NSNumber for evaluation @param matcher The matcher to satisfy as the expected condition.
304 |
305 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
306 | @c HC_assertThatUnsignedLongLong instead.)
307 |
308 | @ingroup integration_numeric
309 | */
310 | #ifdef HC_SHORTHAND
311 | #define assertThatUnsignedLongLong HC_assertThatUnsignedLongLong
312 | #endif
313 |
314 |
315 | #pragma mark -
316 |
317 | OBJC_EXPORT void HC_assertThatUnsignedShortWithLocation(id testCase, unsigned short actual,
318 | id matcher, const char* fileName, int lineNumber);
319 |
320 | #define HC_assertThatUnsignedShort(actual, matcher) \
321 | HC_assertThatUnsignedShortWithLocation(self, actual, matcher, __FILE__, __LINE__)
322 |
323 | /**
324 | assertThatUnsignedShort(actual, matcher) -
325 | Asserts that unsigned short
actual value, converted to an @c NSNumber, satisfies
326 | matcher.
327 |
328 | @param actual The unsigned short
value to convert to an @c NSNumber for evaluation @param matcher The matcher to satisfy as the expected condition.
329 |
330 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
331 | @c HC_assertThatUnsignedShort instead.)
332 |
333 | @ingroup integration_numeric
334 | */
335 | #ifdef HC_SHORTHAND
336 | #define assertThatUnsignedShort HC_assertThatUnsignedShort
337 | #endif
338 |
339 |
340 | #pragma mark -
341 |
342 | OBJC_EXPORT void HC_assertThatIntegerWithLocation(id testCase, NSInteger actual,
343 | id matcher, const char* fileName, int lineNumber);
344 |
345 | #define HC_assertThatInteger(actual, matcher) \
346 | HC_assertThatIntegerWithLocation(self, actual, matcher, __FILE__, __LINE__)
347 |
348 | /**
349 | assertThatInteger(actual, matcher) -
350 | Asserts that @c NSInteger actual value, converted to an @c NSNumber, satisfies matcher.
351 |
352 | @param actual The @c NSInteger value to convert to an @c NSNumber for evaluation.
353 | @param matcher The matcher to satisfy as the expected condition.
354 |
355 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
356 | @c HC_assertThatInteger instead.)
357 |
358 | @ingroup integration_numeric
359 | */
360 | #ifdef HC_SHORTHAND
361 | #define assertThatInteger HC_assertThatInteger
362 | #endif
363 |
364 |
365 | #pragma mark -
366 |
367 | OBJC_EXPORT void HC_assertThatUnsignedIntegerWithLocation(id testCase, NSUInteger actual,
368 | id matcher, const char* fileName, int lineNumber);
369 |
370 | #define HC_assertThatUnsignedInteger(actual, matcher) \
371 | HC_assertThatUnsignedIntegerWithLocation(self, actual, matcher, __FILE__, __LINE__)
372 |
373 | /**
374 | assertThatUnsignedInteger(actual, matcher) -
375 | Asserts that @c NSUInteger actual value, converted to an @c NSNumber, satisfies matcher.
376 |
377 | @param actual The @c NSUInteger value to convert to an @c NSNumber for evaluation.
378 | @param matcher The matcher to satisfy as the expected condition.
379 |
380 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
381 | @c HC_assertThatUnsignedInteger instead.)
382 |
383 | @ingroup integration_numeric
384 | */
385 | #ifdef HC_SHORTHAND
386 | #define assertThatUnsignedInteger HC_assertThatUnsignedInteger
387 | #endif
388 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCOrderingComparison.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCOrderingComparison.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCOrderingComparison : HCBaseMatcher
14 | {
15 | id expected;
16 | NSComparisonResult minCompare;
17 | NSComparisonResult maxCompare;
18 | NSString *comparisonDescription;
19 | }
20 |
21 | + (id)compare:(id)expectedValue
22 | minCompare:(NSComparisonResult)min
23 | maxCompare:(NSComparisonResult)max
24 | comparisonDescription:(NSString *)comparisonDescription;
25 |
26 | - (id)initComparing:(id)expectedValue
27 | minCompare:(NSComparisonResult)min
28 | maxCompare:(NSComparisonResult)max
29 | comparisonDescription:(NSString *)comparisonDescription;
30 |
31 | @end
32 |
33 |
34 | OBJC_EXPORT id HC_greaterThan(id expected);
35 |
36 | /**
37 | greaterThan(aNumber) -
38 | Matches if object is greater than a given number.
39 |
40 | @param aNumber The @c NSNumber to compare against.
41 |
42 | Example:
43 | @li @ref greaterThan(\@5)
44 |
45 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
46 | @c HC_greaterThan instead.)
47 |
48 | @ingroup number_matchers
49 | */
50 | #ifdef HC_SHORTHAND
51 | #define greaterThan HC_greaterThan
52 | #endif
53 |
54 |
55 | OBJC_EXPORT id HC_greaterThanOrEqualTo(id expected);
56 |
57 | /**
58 | greaterThanOrEqualTo(aNumber) -
59 | Matches if object is greater than or equal to a given number.
60 |
61 | @param aNumber The @c NSNumber to compare against.
62 |
63 | Example:
64 | @li @ref greaterThanOrEqualTo(\@5)
65 |
66 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
67 | @c HC_greaterThanOrEqualTo instead.)
68 |
69 | @ingroup number_matchers
70 | */
71 | #ifdef HC_SHORTHAND
72 | #define greaterThanOrEqualTo HC_greaterThanOrEqualTo
73 | #endif
74 |
75 |
76 | OBJC_EXPORT id HC_lessThan(id expected);
77 |
78 | /**
79 | lessThan(aNumber) -
80 | Matches if object is less than a given number.
81 |
82 | @param aNumber The @c NSNumber to compare against.
83 |
84 | Example:
85 | @li @ref lessThan(\@5)
86 |
87 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
88 | @c HC_lessThan instead.)
89 |
90 | @ingroup number_matchers
91 | */
92 | #ifdef HC_SHORTHAND
93 | #define lessThan HC_lessThan
94 | #endif
95 |
96 |
97 | OBJC_EXPORT id HC_lessThanOrEqualTo(id expected);
98 |
99 | /**
100 | lessThanOrEqualTo(aNumber) -
101 | Matches if object is less than or equal to a given number.
102 |
103 | @param aNumber The @c NSNumber to compare against.
104 |
105 | Example:
106 | @li @ref lessThanOrEqualTo(\@5)
107 |
108 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
109 | @c HC_lessThanOrEqualTo instead.)
110 |
111 | @ingroup number_matchers
112 | */
113 | #ifdef HC_SHORTHAND
114 | #define lessThanOrEqualTo HC_lessThanOrEqualTo
115 | #endif
116 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCRequireNonNilObject.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCRequireNonNilObject.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 | #import
12 |
13 |
14 | /**
15 | Throws an NSException if @a obj is @c nil.
16 |
17 | @ingroup helpers
18 | */
19 | OBJC_EXPORT void HCRequireNonNilObject(id obj);
20 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCRequireNonNilString.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCRequireNonNilString.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 | #import
12 |
13 |
14 | /**
15 | Throws an NSException if @a string is @c nil.
16 |
17 | @b Deprecated: Use @ref HCRequireNonNilObject instead.
18 |
19 | @ingroup helpers
20 | */
21 | OBJC_EXPORT void HCRequireNonNilString(NSString *string) __attribute__((deprecated));
22 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCSelfDescribing.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCSelfDescribing.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 | @protocol HCDescription;
13 |
14 |
15 | /**
16 | The ability of an object to describe itself.
17 |
18 | @ingroup core
19 | */
20 | @protocol HCSelfDescribing
21 |
22 | /**
23 | Generates a description of the object.
24 |
25 | The description may be part of a description of a larger object of which this is just a
26 | component, so it should be worded appropriately.
27 |
28 | @param description The description to be built or appended to.
29 | */
30 | - (void)describeTo:(id)description;
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCStringContains.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCStringContains.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCStringContains : HCSubstringMatcher
14 |
15 | + (id)stringContains:(NSString *)aSubstring;
16 |
17 | @end
18 |
19 |
20 | OBJC_EXPORT id HC_containsString(NSString *aSubstring);
21 |
22 | /**
23 | containsString(aString) -
24 | Matches if object is a string containing a given string.
25 |
26 | @param aString The string to search for. This value must not be @c nil.
27 |
28 | This matcher first checks whether the evaluated object is a string. If so, it checks whether it
29 | contains @a aString.
30 |
31 | Example:
32 |
33 | @par
34 | @ref containsString(@"def")
35 |
36 | will match "abcdefg".
37 |
38 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
39 | @c HC_containsString instead.)
40 |
41 | @ingroup text_matchers
42 | */
43 | #ifdef HC_SHORTHAND
44 | #define containsString HC_containsString
45 | #endif
46 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCStringContainsInOrder.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCStringContainsInOrder.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCStringContainsInOrder : HCBaseMatcher
14 | {
15 | NSArray *substrings;
16 | }
17 |
18 | + (id)containsInOrder:(NSArray *)substringList;
19 | - (id)initWithSubstrings:(NSArray *)substringList;
20 |
21 | @end
22 |
23 |
24 | OBJC_EXPORT id HC_stringContainsInOrder(NSString *substring, ...) NS_REQUIRES_NIL_TERMINATION;
25 |
26 | /**
27 | stringContainsInOrder(firstString, ...) -
28 | Matches if object is a string containing a given list of substrings in relative order.
29 |
30 | @param firstString,... A comma-separated list of strings ending with @c nil.
31 |
32 | This matcher first checks whether the evaluated object is a string. If so, it checks whether it
33 | contains a given list of strings, in relative order to each other. The searches are performed
34 | starting from the beginning of the evaluated string.
35 |
36 | Example:
37 |
38 | @par
39 | @ref stringContainsInOrder(@"bc", @"fg", @"jkl", nil)
40 |
41 | will match "abcdefghijklm".
42 |
43 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
44 | @c HC_stringContainsInOrder instead.)
45 |
46 | @ingroup text_matchers
47 | */
48 | #ifdef HC_SHORTHAND
49 | #define stringContainsInOrder HC_stringContainsInOrder
50 | #endif
51 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCStringDescription.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCStringDescription.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 | @protocol HCSelfDescribing;
13 |
14 |
15 | /**
16 | An HCDescription that is stored as a string.
17 |
18 | @ingroup core
19 | */
20 | @interface HCStringDescription : HCBaseDescription
21 | {
22 | NSMutableString *accumulator;
23 | }
24 |
25 | /**
26 | Returns the description of an HCSelfDescribing object as a string.
27 |
28 | @param selfDescribing The object to be described.
29 | @return The description of the object.
30 | */
31 | + (NSString *)stringFrom:(id)selfDescribing;
32 |
33 | /**
34 | Returns an empty description.
35 | */
36 | + (HCStringDescription *)stringDescription;
37 |
38 | /**
39 | Returns an initialized HCStringDescription object that is empty.
40 | */
41 | - (id)init;
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCStringEndsWith.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCStringEndsWith.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCStringEndsWith : HCSubstringMatcher
14 |
15 | + (id)stringEndsWith:(NSString *)aSubstring;
16 |
17 | @end
18 |
19 |
20 | OBJC_EXPORT id HC_endsWith(NSString *aSubstring);
21 |
22 | /**
23 | endsWith(aString) -
24 | Matches if object is a string ending with a given string.
25 |
26 | @param aString The string to search for. This value must not be @c nil.
27 |
28 | This matcher first checks whether the evaluated object is a string. If so, it checks if
29 | @a aString matches the ending characters of the evaluated object.
30 |
31 | Example:
32 |
33 | @par
34 | @ref endsWith(@"bar")
35 |
36 | will match "foobar".
37 |
38 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
39 | @c HC_endsWith instead.)
40 |
41 | @ingroup text_matchers
42 | */
43 | #ifdef HC_SHORTHAND
44 | #define endsWith HC_endsWith
45 | #endif
46 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCStringStartsWith.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCStringStartsWith.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCStringStartsWith : HCSubstringMatcher
14 |
15 | + (id)stringStartsWith:(NSString *)aSubstring;
16 |
17 | @end
18 |
19 |
20 | OBJC_EXPORT id HC_startsWith(NSString *aSubstring);
21 |
22 | /**
23 | startsWith(aString) -
24 | Matches if object is a string starting with a given string.
25 |
26 | @param aString The string to search for. This value must not be @c nil.
27 |
28 | This matcher first checks whether the evaluated object is a string. If so, it checks if
29 | @a aString matches the beginning characters of the evaluated object.
30 |
31 | Example:
32 |
33 | @par
34 | @ref endsWith(@"foo")
35 |
36 | will match "foobar".
37 |
38 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
39 | @c HC_startsWith instead.)
40 |
41 | @ingroup text_matchers
42 | */
43 | #ifdef HC_SHORTHAND
44 | #define startsWith HC_startsWith
45 | #endif
46 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCSubstringMatcher.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCSubstringMatcher.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 |
13 | @interface HCSubstringMatcher : HCBaseMatcher
14 | {
15 | NSString *substring;
16 | }
17 |
18 | - (id)initWithSubstring:(NSString *)aString;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/HCWrapInMatcher.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - HCWrapInMatcher.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | #import
11 |
12 | @protocol HCMatcher;
13 |
14 |
15 | /**
16 | Wraps argument in a matcher, if necessary.
17 |
18 | @return The argument as-if if it is already a matcher, otherwise wrapped in an @ref equalTo matcher.
19 |
20 | @ingroup helpers
21 | */
22 | OBJC_EXPORT id HCWrapInMatcher(id matcherOrValue);
23 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Headers/OCHamcrest.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCHamcrest - OCHamcrest.h
3 | // Copyright 2012 hamcrest.org. See LICENSE.txt
4 | //
5 | // Created by: Jon Reid, http://qualitycoding.org/
6 | // Docs: http://hamcrest.github.com/OCHamcrest/
7 | // Source: https://github.com/hamcrest/OCHamcrest
8 | //
9 |
10 | /**
11 | @defgroup library Matcher Library
12 |
13 | Library of Matcher implementations.
14 | */
15 |
16 | /**
17 | @defgroup object_matchers Object Matchers
18 |
19 | Matchers that inspect objects.
20 |
21 | @ingroup library
22 | */
23 | #import
24 | #import
25 | #import
26 | #import
27 | #import
28 | #import
29 | #import
30 |
31 | /**
32 | @defgroup collection_matchers Collection Matchers
33 |
34 | Matchers of collections.
35 |
36 | @ingroup library
37 | */
38 | #import
39 | #import
40 | #import
41 | #import
42 | #import
43 | #import
44 | #import
45 | #import
46 | #import
47 | #import
48 | #import
49 |
50 | /**
51 | @defgroup number_matchers Number Matchers
52 |
53 | Matchers that perform numeric comparisons.
54 |
55 | @ingroup library
56 | */
57 | #import
58 | #import
59 |
60 | /**
61 | @defgroup primitive_number_matchers Primitive Number Matchers
62 |
63 | Matchers for testing equality against primitive numeric types.
64 |
65 | @ingroup number_matchers
66 | */
67 | #import
68 |
69 | /**
70 | @defgroup text_matchers Text Matchers
71 |
72 | Matchers that perform text comparisons.
73 |
74 | @ingroup library
75 | */
76 | #import
77 | #import
78 | #import
79 | #import
80 | #import
81 | #import
82 |
83 | /**
84 | @defgroup logical_matchers Logical Matchers
85 |
86 | Boolean logic using other matchers.
87 |
88 | @ingroup library
89 | */
90 | #import
91 | #import
92 | #import
93 | #import
94 |
95 | /**
96 | @defgroup decorator_matchers Decorator Matchers
97 |
98 | Matchers that decorate other matchers for better expression.
99 |
100 | @ingroup library
101 | */
102 | #import
103 | #import
104 |
105 | /**
106 | @defgroup integration Unit Test Integration
107 | */
108 | #import
109 |
110 | /**
111 | @defgroup integration_numeric Unit Tests of Primitive Numbers
112 |
113 | Unit test integration for primitive numbers.
114 |
115 | The @c assertThat<Type> macros convert the primitive actual value to an @c NSNumber,
116 | passing that to the matcher for evaluation. If the matcher is not satisfied, an exception is
117 | thrown describing the mismatch.
118 |
119 | This family of macros is designed to integrate well with OCUnit and other unit testing
120 | frameworks. Unmet assertions are reported as test failures. In Xcode, they can be clicked to
121 | reveal the line of the assertion.
122 |
123 | @ingroup integration
124 | */
125 | #import
126 |
127 | /**
128 | @defgroup core Core API
129 | */
130 |
131 | /**
132 | @defgroup helpers Helpers
133 |
134 | Utilities for writing Matchers.
135 |
136 | @ingroup core
137 | */
138 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/OCHamcrest:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mcubedsw/M3Foundation/c68b85610037e3ee2929f619ca66f35ddd95eb33/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/OCHamcrest
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/A/Resources/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildMachineOSBuild
6 | 12C60
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | OCHamcrest
11 | CFBundleIdentifier
12 | org.hamcrest.OCHamcrest
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | OCHamcrest
17 | CFBundlePackageType
18 | FMWK
19 | CFBundleShortVersionString
20 | 1.9
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1.9
25 | DTCompiler
26 |
27 | DTPlatformBuild
28 | 4G2008a
29 | DTPlatformVersion
30 | GM
31 | DTSDKBuild
32 | 12C37
33 | DTSDKName
34 | macosx10.8
35 | DTXcode
36 | 0452
37 | DTXcodeBuild
38 | 4G2008a
39 | NSHumanReadableCopyright
40 | Copyright © 2012 hamcrest.org
41 |
42 |
43 |
--------------------------------------------------------------------------------
/M3FoundationTests/Dependencies/OCHamcrest.framework/Versions/Current:
--------------------------------------------------------------------------------
1 | A
--------------------------------------------------------------------------------
/M3FoundationTests/M3FoundationTests-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | com.mcubedsw.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundlePackageType
14 | BNDL
15 | CFBundleShortVersionString
16 | 1.0.1
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/M3FoundationTests/M3FoundationTests_Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // M3FoundationTests_Prefix.pch
3 | // M3Foundation
4 | //
5 | // Created by Martin Pilkington on 28/05/2012.
6 | //
7 | //
8 |
9 | #ifndef M3Foundation_M3FoundationTests_Prefix_pch
10 | #define M3Foundation_M3FoundationTests_Prefix_pch
11 |
12 |
13 | #define HC_SHORTHAND
14 | #import
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/M3FoundationTests/Resources/NSPredicateXMLTestData.txt:
--------------------------------------------------------------------------------
1 | TruePredicate
2 | ====
3 |
4 | ====
5 | FalsePredicate
6 | ====
7 |
8 | ====
9 | EqualTo
10 | ====
11 |
12 | name
13 | Bob
14 |
15 | ====
16 | LessThan
17 | ====
18 |
19 | children.age
20 | 15
21 |
22 | ====
23 | LessThanOrEqualTo
24 | ====
25 |
26 | children.age
27 | 15
28 |
29 | ====
30 | GreaterThan
31 | ====
32 |
33 | children.age
34 | 15
35 |
36 | ====
37 | GreaterThanOrEqualTo
38 | ====
39 |
40 | children.age
41 | 15
42 |
43 | ====
44 | Between
45 | ====
46 |
47 | children.age
48 |
49 | 10
50 | 21
51 |
52 |
53 | ====
54 | Matches
55 | ====
56 |
57 | children.name
58 | F.{1,3}k
59 |
60 | ====
61 | Like
62 | ====
63 |
64 | children.name
65 | S????
66 |
67 | ====
68 | BeginsWith
69 | ====
70 |
71 | children.name
72 | A
73 |
74 | ====
75 | EndsWith
76 | ====
77 |
78 | children.name
79 | E
80 |
81 | ====
82 | Contains
83 | ====
84 |
85 | children.name
86 | l
87 |
88 | ====
89 | In
90 | ====
91 |
92 | children.name
93 |
94 | Frank
95 | Sally
96 | Steve
97 | Alice
98 |
99 |
100 | ====
101 | NoOptions
102 | ====
103 |
104 | name
105 | Bob
106 |
107 | ====
108 | CaseInsensitive
109 | ====
110 |
111 | name
112 | Bob
113 |
114 | ====
115 | DiacriticInsensitive
116 | ====
117 |
118 | name
119 | Bob
120 |
121 | ====
122 | CaseAndDiacriticInsensitive
123 | ====
124 |
125 | name
126 | Bob
127 |
128 | ====
129 | NoModifier
130 | ====
131 |
132 | age
133 | 18
134 |
135 | ====
136 | AnyModifier
137 | ====
138 |
139 | children.age
140 | 18
141 |
142 | ====
143 | AllModifier
144 | ====
145 |
146 | children.age
147 | 18
148 |
149 | ====
150 | NoneModifier
151 | ====
152 |
153 |
154 | children.age
155 | 18
156 |
157 |
158 | ====
159 | StringConstant
160 | ====
161 |
162 | name
163 | Bob
164 |
165 | ====
166 | IntegerConstant
167 | ====
168 |
169 | name
170 | 42
171 |
172 | ====
173 | DoubleConstant
174 | ====
175 |
176 | name
177 | 3.14
178 |
179 | ====
180 | Variable
181 | ====
182 |
183 | name
184 | VARIABLE
185 |
186 | ====
187 | KeyPath
188 | ====
189 |
190 | name
191 | children.parent.name
192 |
193 | ====
194 | Aggregate
195 | ====
196 |
197 | name
198 |
199 | X
200 | Y
201 | Z
202 |
203 |
204 | ====
205 | AndCompoundType
206 | ====
207 |
208 |
209 | name
210 | Bob
211 |
212 |
213 | age
214 | 18
215 |
216 |
217 | ====
218 | OrCompoundType
219 | ====
220 |
221 |
222 | name
223 | Bob
224 |
225 |
226 | age
227 | 18
228 |
229 |
230 | ====
231 | NotCompoundType
232 | ====
233 |
234 |
235 | name
236 | Bob
237 |
238 |
239 | ====
240 | OrAndNestedCompoundType
241 | ====
242 |
243 |
244 |
245 | name
246 | Bob
247 |
248 |
249 | age
250 | 18
251 |
252 |
253 |
254 |
255 | name
256 | Steve
257 |
258 |
259 | age
260 | 21
261 |
262 |
263 |
264 | ====
265 | NotAndNestedCompoundType
266 | ====
267 |
268 |
269 |
270 | name
271 | Bob
272 |
273 |
274 | age
275 | 18
276 |
277 |
278 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/M3CSVValueTransformerTests.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | M3CSVValueTransformerTests.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 09/01/2010.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import
11 |
12 |
13 | @interface M3CSVValueTransformerTests : SenTestCase {
14 |
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/M3CSVValueTransformerTests.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | M3CSVValueTransformerTests.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 09/01/2010.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "M3CSVValueTransformerTests.h"
11 | #import
12 |
13 | @implementation M3CSVValueTransformerTests
14 |
15 | - (void)testForwardTransform {
16 | M3CSVValueTransformer *transform = [[M3CSVValueTransformer alloc] init];
17 | NSArray *expectedArray = [NSArray arrayWithObjects:@"42", @"possums", @"went", @"on", @"holiday", nil];
18 | assertThat([transform transformedValue:@"42,possums,went,on,holiday"], is(equalTo(expectedArray)));
19 | }
20 |
21 | - (void)testReverseTransform {
22 | M3CSVValueTransformer *transform = [[M3CSVValueTransformer alloc] init];
23 | NSArray *componentsArray = [NSArray arrayWithObjects:@"42", @"possums", @"went", @"on", @"holiday", nil];
24 | assertThat([transform reverseTransformedValue:componentsArray], is(equalTo(@"42,possums,went,on,holiday")));
25 | }
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/M3FileSizeValueTransformerTests.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | M3FileSizeValueTransformerTests.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 09/01/2010.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import
11 |
12 |
13 | @interface M3FileSizeValueTransformerTests : SenTestCase {
14 |
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/M3FileSizeValueTransformerTests.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | M3FileSizeValueTransformerTests.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 09/01/2010.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "M3FileSizeValueTransformerTests.h"
11 | #import
12 |
13 | @implementation M3FileSizeValueTransformerTests
14 |
15 | - (void)test_transformFileSizesCorrectly {
16 | M3FileSizeValueTransformer *transform = [[M3FileSizeValueTransformer alloc] init];
17 | assertThat([transform transformedValue:@(602)], is(equalTo(@"602 bytes")));
18 | assertThat([transform transformedValue:@(14394)], is(equalTo(@"14.39 KB")));
19 | assertThat([transform transformedValue:@(53545329)], is(equalTo(@"53.55 MB")));
20 | assertThat([transform transformedValue:@(28958816993)], is(equalTo(@"28.96 GB")));
21 | assertThat([transform transformedValue:@(14293651161088)], is(equalTo(@"14.29 TB")));
22 | }
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/M3TestObject.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | M3TestObject.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 15/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import
11 |
12 | //Used for testing NSObject+M3Extensions
13 | @interface M3TestObject : NSObject
14 |
15 | @property (copy) NSString *storedValue;
16 |
17 | - (void)updateStoredValue; //Sets the storedValue to "foo"
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/M3TestObject.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | M3TestObject.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 15/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "M3TestObject.h"
11 |
12 | @implementation M3TestObject
13 |
14 | - (void)updateStoredValue {
15 | [self setStoredValue:@"foo"];
16 | }
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/M3URLConnectionOperationTests.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | M3URLConnectionOperationTests.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 15/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import
11 |
12 | @interface M3URLConnectionOperationTests : SenTestCase
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/M3URLConnectionOperationTests.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | M3URLConnectionOperationTests.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 15/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "M3URLConnectionOperationTests.h"
11 |
12 | #import
13 |
14 | @implementation M3URLConnectionOperationTests
15 |
16 | - (void)test_storesSuppliedURLRequest {
17 | NSURLRequest *request = [NSURLRequest new];
18 | M3URLConnectionOperation *operation = [[M3URLConnectionOperation alloc] initWithURLRequest:request];
19 |
20 | assertThat(operation.request, is(equalTo(request)));
21 | }
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/NSArray+M3ExtensionsTests.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSArray+M3ExtensionsTests.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 09/01/2010.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import
11 |
12 |
13 | @interface NSArray_M3ExtensionsTests : SenTestCase {
14 |
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/NSArray+M3ExtensionsTests.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSArray+M3ExtensionsTests.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 09/01/2010.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSArray+M3ExtensionsTests.h"
11 | #import
12 |
13 | @implementation NSArray_M3ExtensionsTests
14 |
15 | #pragma mark -
16 | #pragma mark +m3_alphaNumericArray
17 |
18 | - (void)test_returnsAlphaNumericArray {
19 | assertThat([NSArray m3_alphaNumericArray], hasCountOf(36));
20 | }
21 |
22 | - (void)test_alphaNumericArrayContents {
23 | assertThat([NSArray m3_alphaNumericArray][0], is(equalTo(@"0")));
24 | assertThat([NSArray m3_alphaNumericArray][3], is(equalTo(@"3")));
25 | assertThat([NSArray m3_alphaNumericArray][8], is(equalTo(@"8")));
26 | assertThat([NSArray m3_alphaNumericArray][14], is(equalTo(@"e")));
27 | assertThat([NSArray m3_alphaNumericArray][10], is(equalTo(@"a")));
28 | assertThat([NSArray m3_alphaNumericArray][22], is(equalTo(@"m")));
29 | assertThat([NSArray m3_alphaNumericArray][13], is(equalTo(@"d")));
30 | assertThat([NSArray m3_alphaNumericArray][31], is(equalTo(@"v")));
31 | assertThat([NSArray m3_alphaNumericArray][24], is(equalTo(@"o")));
32 | assertThat([NSArray m3_alphaNumericArray][21], is(equalTo(@"l")));
33 | }
34 |
35 |
36 |
37 |
38 |
39 | #pragma mark -
40 | #pragma mark +m3_arrayWithNumbersFrom:to:
41 |
42 | - (void)test_arrayFromAndToNumbersReturnsCorrectNumberOfElements {
43 | assertThat([NSArray m3_arrayWithNumbersFrom:1 to:10], hasCountOf(10));
44 | assertThat([NSArray m3_arrayWithNumbersFrom:-4 to:-8], hasCountOf(5));
45 | assertThat([NSArray m3_arrayWithNumbersFrom:20 to:-21], hasCountOf(42));
46 | }
47 |
48 | - (void)test_arrayFromAndToTheSameNumberReturnsNil {
49 | assertThat([NSArray m3_arrayWithNumbersFrom:42 to:42], is(nilValue()));
50 | }
51 |
52 |
53 |
54 |
55 |
56 | #pragma mark -
57 | #pragma mark -m3_safeObjectAtIndex:
58 |
59 | - (void)test_returnsObjectAtSuppliedIndexIfOneExists {
60 | NSArray *array = @[@"1", @"2", @"3"];
61 | assertThat([array m3_safeObjectAtIndex:0], is(equalTo(@"1")));
62 | assertThat([array m3_safeObjectAtIndex:1], is(equalTo(@"2")));
63 | assertThat([array m3_safeObjectAtIndex:2], is(equalTo(@"3")));
64 | }
65 |
66 | - (void)test_returnsNilIfNoObjectExistsAtSuppliedIndex {
67 | assertThat([@[] m3_safeObjectAtIndex:0], is(nilValue()));
68 | assertThat([@[@"1"] m3_safeObjectAtIndex:1], is(nilValue()));
69 | }
70 |
71 |
72 |
73 |
74 |
75 | #pragma mark -
76 | #pragma mark -m3_firstObjectPassingTest:
77 |
78 | - (void)test_returnsNilIfTestIsNil {
79 | assertThat([@[] m3_firstObjectPassingTest:nil], is(nilValue()));
80 | }
81 |
82 | - (void)test_returnsNilIfNoObjectPassesTest {
83 | NSArray *array = @[@1, @2, @3, @4, @5];
84 | id object = [array m3_firstObjectPassingTest:^BOOL(NSNumber *aObject) {
85 | return aObject.integerValue > 5;
86 | }];
87 | assertThat(object, is(nilValue()));
88 | }
89 |
90 | - (void)test_returnsObjectIfSingleObjectPasses {
91 | NSArray *array = @[@1, @2, @3, @4, @5];
92 | id object = [array m3_firstObjectPassingTest:^BOOL(NSNumber *aObject) {
93 | return aObject.integerValue > 4;
94 | }];
95 | assertThat(object, is(equalTo(@5)));
96 | }
97 |
98 | - (void)test_returnsFirstObjectIfMultipleObjectsPassTest {
99 | NSArray *array = @[@1, @2, @3, @4, @5];
100 | id object = [array m3_firstObjectPassingTest:^BOOL(NSNumber *aObject) {
101 | return aObject.integerValue > 3;
102 | }];
103 | assertThat(object, is(equalTo(@4)));
104 | }
105 |
106 | @end
107 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/NSCountedSet+M3Extensions.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSCountedSet+M3Extensions.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 14/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import
11 |
12 | @interface NSCountedSet_M3Extensions : SenTestCase
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/NSCountedSet+M3Extensions.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSCountedSet+M3Extensions.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 14/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSCountedSet+M3Extensions.h"
11 | #import
12 |
13 | @implementation NSCountedSet_M3Extensions {
14 | NSCountedSet *countedSet;
15 | }
16 |
17 | - (void)setUp {
18 | [super setUp];
19 |
20 | countedSet = [NSCountedSet new];
21 | [countedSet addObjectsFromArray:@[@1, @1, @2, @3, @4, @4, @4, @5, @5, @6, @6, @6, @6, @6]];
22 | }
23 |
24 |
25 |
26 |
27 |
28 | #pragma mark -
29 | #pragma mark -m3_objectsWithCount
30 |
31 | - (void)test_returnsEmptySetIfNoObjectsMatchCount {
32 | assertThat([countedSet m3_objectsWithCount:4], hasCountOf(0));
33 | }
34 |
35 | - (void)test_returnsOnlyObjectsMatchingCountIfSomeMatch {
36 | NSSet *actualSet = [countedSet m3_objectsWithCount:2];
37 | NSSet *expectedSet = [NSSet setWithObjects:@1, @5, nil];
38 | assertThat(actualSet, is(equalTo(expectedSet)));
39 | }
40 |
41 |
42 |
43 |
44 |
45 | #pragma mark -
46 | #pragma mark -m3_countedObjectTotal
47 |
48 | - (void)test_returnsCorrectTotalObjectCount {
49 | assertThatInteger(countedSet.m3_countedObjectTotal, is(equalToInteger(14)));
50 | }
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/NSDictionary+M3ExtensionsTests.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSDictionary+M3ExtensionsTests.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 09/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import
11 |
12 | @interface NSDictionary_M3ExtensionsTests : SenTestCase
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/NSDictionary+M3ExtensionsTests.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSDictionary+M3ExtensionsTests.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 09/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSDictionary+M3ExtensionsTests.h"
11 | #import
12 |
13 | @implementation NSDictionary_M3ExtensionsTests
14 |
15 | - (void)test_settingObjectForNonexistentKeyAddsItToTheReturnedDictionary {
16 | NSDictionary *startingDictionary = @{};
17 | NSDictionary *expectedDictionary = @{@"bar" : @"foo"};
18 |
19 | NSDictionary *actualDictionary = [startingDictionary m3_dictionaryBySettingObject:@"foo" forKey:@"bar"];
20 |
21 | assertThat(actualDictionary, is(equalTo(expectedDictionary)));
22 | }
23 |
24 | - (void)test_settingObjectForExistingKeyReplacesObjectInReturnedDictionary {
25 | NSDictionary *startingDictionary = @{@"foo" : @"1", @"bar" : @"2"};
26 | NSDictionary *expectedDictionary = @{@"foo" : @"1", @"bar" : @"6"};
27 |
28 | NSDictionary *actualDictionary = [startingDictionary m3_dictionaryBySettingObject:@"6" forKey:@"bar"];
29 |
30 | assertThat(actualDictionary, is(equalTo(expectedDictionary)));
31 | }
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/NSMapTable+M3Extensions.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSMapTable+M3Extensions.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 15/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import
11 |
12 | @interface NSMapTable_M3Extensions : SenTestCase
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/NSMapTable+M3Extensions.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSMapTable+M3Extensions.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 15/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSMapTable+M3Extensions.h"
11 |
12 | #import
13 |
14 | @implementation NSMapTable_M3Extensions
15 |
16 | - (void)test_accessingObjectUsingSubscripting {
17 | NSMapTable *table = [NSMapTable strongToStrongObjectsMapTable];
18 | [table setObject:@"foo" forKey:@"bar"];
19 |
20 | assertThat(table[@"bar"], is(equalTo(@"foo")));
21 | }
22 |
23 | - (void)test_settingObjectUsingSubscripting {
24 | NSMapTable *table = [NSMapTable strongToStrongObjectsMapTable];
25 |
26 | table[@"baz"] = @"possum";
27 |
28 | assertThat([table objectForKey:@"baz"], is(equalTo(@"possum")));
29 | }
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/NSMutableArray+M3Extensions.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSMutableArray+M3Extensions.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 10/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import
11 |
12 | @interface NSMutableArray_M3Extensions : SenTestCase
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/NSMutableArray+M3Extensions.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSMutableArray+M3Extensions.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 10/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSMutableArray+M3Extensions.h"
11 | #import
12 |
13 | @implementation NSMutableArray_M3Extensions {
14 | NSMutableArray *testArray;
15 | }
16 |
17 | - (void)setUp {
18 | [super setUp];
19 | testArray = [@[@1, @2, @3, @4, @5] mutableCopy];
20 | }
21 |
22 | - (void)test_movingObjectTo0MovesItToFrontOfArray {
23 | [testArray m3_moveObjectAtIndex:2 toIndex:0];
24 | NSArray *expectedArray = @[@3, @1, @2, @4, @5];
25 | assertThat(testArray, is(equalTo(expectedArray)));
26 | }
27 |
28 | - (void)test_movingObjectToCountMovesItToEndOfArray {
29 | [testArray m3_moveObjectAtIndex:1 toIndex:5];
30 | NSArray *expectedArray = @[@1, @3, @4, @5, @2];
31 | assertThat(testArray, is(equalTo(expectedArray)));
32 | }
33 |
34 | - (void)test_movingObjectUpAnIndexSwapsWithNextObject {
35 | [testArray m3_moveObjectAtIndex:2 toIndex:3];
36 | NSArray *expectedArray = @[@1, @2, @4, @3, @5];
37 | assertThat(testArray, is(equalTo(expectedArray)));
38 | }
39 |
40 | - (void)test_movingObjectDownAnIndexSwapsWithPreviousObject {
41 | [testArray m3_moveObjectAtIndex:4 toIndex:3];
42 | NSArray *expectedArray = @[@1, @2, @3, @5, @4];
43 | assertThat(testArray, is(equalTo(expectedArray)));
44 | }
45 |
46 | - (void)test_movingNonConcurrentObjectsWithinArrayCorrectlyMovesObject {
47 | [testArray m3_moveObjectAtIndex:1 toIndex:3];
48 | NSArray *expectedArray = @[@1, @3, @4, @2, @5];
49 | assertThat(testArray, is(equalTo(expectedArray)));
50 | }
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/NSMutableDictionary+M3ExtensionTests.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSMutableDictionary+M3ExtensionTests.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 10/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import
11 |
12 | @interface NSMutableDictionary_M3ExtensionTests : SenTestCase
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/NSMutableDictionary+M3ExtensionTests.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSMutableDictionary+M3ExtensionTests.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 10/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSMutableDictionary+M3ExtensionTests.h"
11 | #import
12 |
13 | @implementation NSMutableDictionary_M3ExtensionTests
14 |
15 | - (void)test_settingObjectSetsObject {
16 | NSDictionary *expectedDictionary = @{@"bar" : @"foo"};
17 |
18 | NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
19 | [dictionary m3_safeSetObject:@"foo" forKey:@"bar"];
20 | assertThat(dictionary, is(equalTo(expectedDictionary)));
21 | }
22 |
23 | - (void)test_settingNilDoesNothing {
24 | NSDictionary *expectedDictionary = @{};
25 |
26 | NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
27 | [dictionary m3_safeSetObject:nil forKey:@"bar"];
28 | assertThat(dictionary, is(equalTo(expectedDictionary)));
29 | }
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/NSObject+M3ExtensionsTests.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSObject+M3ExtensionsTests.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 15/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import
11 |
12 | @interface NSObject_M3ExtensionsTests : SenTestCase
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/NSObject+M3ExtensionsTests.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSObject+M3ExtensionsTests.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 15/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSObject+M3ExtensionsTests.h"
11 |
12 | #import
13 | #import "M3TestObject.h"
14 |
15 | @implementation NSObject_M3ExtensionsTests {
16 | M3TestObject *testObject;
17 | }
18 |
19 | - (void)setUp {
20 | testObject = [M3TestObject new];
21 | }
22 |
23 |
24 |
25 |
26 |
27 | #pragma mark -
28 | #pragma mark -m3_replaceImplementationOfMethodWithSelector:withBlock:
29 |
30 | - (void)test_replacesImplementationOfSelector {
31 | [testObject updateStoredValue];
32 | assertThat(testObject.storedValue, is(equalTo(@"foo")));
33 |
34 | [testObject m3_replaceImplementationOfMethodWithSelector:@selector(updateStoredValue) withBlock:^(id self) {
35 | [self setStoredValue:@"bar"];
36 | }];
37 |
38 | [testObject updateStoredValue];
39 | assertThat(testObject.storedValue, is(equalTo(@"bar")));
40 | }
41 |
42 | - (void)test_replacesImplementationOnlyOnThisInstance {
43 | M3TestObject *existingObject = [M3TestObject new];
44 |
45 | [testObject m3_replaceImplementationOfMethodWithSelector:@selector(updateStoredValue) withBlock:^(id self) {
46 | [self setStoredValue:@"bar"];
47 | }];
48 |
49 | M3TestObject *newObject = [M3TestObject new];
50 |
51 | [testObject updateStoredValue];
52 | [existingObject updateStoredValue];
53 | [newObject updateStoredValue];
54 |
55 | assertThat(testObject.storedValue, is(equalTo(@"bar")));
56 | assertThat(existingObject.storedValue, is(equalTo(@"foo")));
57 | assertThat(newObject.storedValue, is(equalTo(@"foo")));
58 | }
59 |
60 | @end
61 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/NSPredicate+M3ExtensionsTests.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSPredicate+M3ExtensionsTests.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 31/03/2011.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import
11 | #import
12 |
13 | @interface NSPredicate_M3ExtensionsTests : SenTestCase {
14 |
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/NSString+M3ExtensionsTest.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSString+M3ExtensionsTest.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 09/01/2010.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import
11 |
12 |
13 | @interface NSString_M3ExtensionsTest : SenTestCase {
14 |
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/NSString+M3ExtensionsTest.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSString+M3ExtensionsTest.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 09/01/2010.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSString+M3ExtensionsTest.h"
11 | #import
12 |
13 | @implementation NSString_M3ExtensionsTest
14 |
15 | #pragma mark -
16 | #pragma mark -m3_stringByRemovingCharactersFromEnd
17 |
18 | - (void)test_removesCharactersFromEndOfString {
19 | assertThat([@"hello world" m3_stringByRemovingCharactersFromEnd:6], is(equalTo(@"hello")));
20 | }
21 |
22 | - (void)test_usingNegativeNumberOfCharactersToRemoveReturnsNil {
23 | assertThat([@"hello world" m3_stringByRemovingCharactersFromEnd:-6], is(nilValue()));
24 | }
25 |
26 |
27 |
28 |
29 |
30 | #pragma mark -
31 | #pragma mark -m3_containsString
32 |
33 | - (void)test_returnsNOIfSuppliedStringNotContainedInReceiver {
34 | assertThatBool([@"foobar" m3_containsString:@"bars"], is(equalToBool(NO)));
35 | assertThatBool([@"foobar" m3_containsString:@"afoo"], is(equalToBool(NO)));
36 | }
37 |
38 | - (void)test_returnsYESIfSuppliedStringIsContainedInReceiver {
39 | assertThatBool([@"foobar" m3_containsString:@"bar"], is(equalToBool(YES)));
40 | assertThatBool([@"foobar" m3_containsString:@"foo"], is(equalToBool(YES)));
41 | assertThatBool([@"foobar" m3_containsString:@"oba"], is(equalToBool(YES)));
42 | }
43 |
44 | - (void)test_returnsNOIfReceiverIsEmpty {
45 | assertThatBool([@"" m3_containsString:@"bar"], is(equalToBool(NO)));
46 | }
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/NSXMLElement+M3ExtensionsTests.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSXMLElement+M3ExtensionsTests.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 15/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import
11 |
12 | @interface NSXMLElement_M3ExtensionsTests : SenTestCase
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/NSXMLElement+M3ExtensionsTests.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSXMLElement+M3ExtensionsTests.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 15/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSXMLElement+M3ExtensionsTests.h"
11 |
12 | #import
13 |
14 | @implementation NSXMLElement_M3ExtensionsTests
15 |
16 | - (void)test_returnsNilIfThereAreNoChildElements {
17 | NSXMLElement *element = [NSXMLElement new];
18 |
19 | assertThat([element m3_elementForName:@"foobar"], is(nilValue()));
20 | }
21 |
22 | - (void)test_returnsFirstChildElementMatchingName {
23 | NSXMLElement *child1 = [NSXMLElement new];
24 | [child1 setName:@"foobar"];
25 | NSXMLElement *child2 = [NSXMLElement new];
26 | [child2 setName:@"baz"];
27 | NSXMLElement *child3 = [NSXMLElement new];
28 | [child2 setName:@"foobar"];
29 |
30 | NSXMLElement *element = [NSXMLElement new];
31 | [element addChild:child1];
32 | [element addChild:child2];
33 | [element addChild:child3];
34 |
35 | assertThat([element m3_elementForName:@"foobar"], is(sameInstance(child1)));
36 | }
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/NSXMLNode+M3ExtensionsTests.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSXMLNode+M3ExtensionsTests.h
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 15/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import
11 |
12 | @interface NSXMLNode_M3ExtensionsTests : SenTestCase
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/M3FoundationTests/Source/NSXMLNode+M3ExtensionsTests.m:
--------------------------------------------------------------------------------
1 | /*****************************************************************
2 | NSXMLNode+M3ExtensionsTests.m
3 | M3Foundation
4 |
5 | Created by Martin Pilkington on 15/01/2013.
6 |
7 | Please read the LICENCE.txt for licensing information
8 | *****************************************************************/
9 |
10 | #import "NSXMLNode+M3ExtensionsTests.h"
11 |
12 | #import
13 |
14 | @implementation NSXMLNode_M3ExtensionsTests
15 |
16 | #pragma mark -
17 | #pragma mark Basic queries
18 |
19 | - (void)test_returnsFloatValue {
20 | NSXMLNode *node = [NSXMLNode new];
21 | [node setStringValue:@"1.23"];
22 |
23 | assertThatFloat(node.m3_floatValue, is(equalToFloat(1.23)));
24 | }
25 |
26 | - (void)test_returnsIntegerValue {
27 | NSXMLNode *node = [NSXMLNode new];
28 | [node setStringValue:@"987"];
29 |
30 | assertThatInteger(node.m3_integerValue, is(equalToInteger(987)));
31 | }
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | M3Foundation 1.0.1
2 | ============
3 | M3Foundation is a collection of categories and classes that extend and enhance the Foundation framework. This functionality is taken from various M Cubed applications.
4 |
5 | M3Foundation includes the following:
6 |
7 | - Safer access/editing of arrays and dictionaries
8 | - performBlock:withDelay: methods
9 | - Replace the implementation of a method on a single object
10 | - Bulk KVO operations
11 | - Simplified XML access
12 | - Conversion of predicates and expressions to and from XML representation
13 | - Value transformers for file sizes and CSV strings
14 | - A NSOperation subclass for URL connections
15 |
16 | And more
17 |
18 | M3Foundation is currently Mac-only. An iOS version is in the works for M3Foundation 1.1.
19 |
20 | **M3Foundation requires Lion and Xcode 4.4+**
21 |
22 |
23 |
24 | ## Change Log
25 |
26 | ### 1.0.1
27 | * Moved some headers from Protected to Public
28 |
29 | ### 1.0
30 | * Removed M3Accessibility classes
31 | * Removed the M3DFA class
32 | * Removed the NSFileManager category
33 | * Removed the NSMutableSet category
34 | * No longer supports Garbage Collection, instead uses ARC
35 | * Improved tests
36 | * Updated to modern Obj-C syntax
37 | * Fixed the naming of some methods
38 | * Modified some methods to make more logical and practical sense
39 | * Added category for working with NSCountedSet
40 | * Added NSDictionary category to add equivalent to -[NSArray arrayByAddingObject:]
41 | * Added subscripting to NSMapTable
42 |
43 | #### API changes
44 | _M3AccessibilityController_ **(removed)**
45 |
46 |
47 |
48 | _M3AccessibleUIElement_ **(removed)**
49 |
50 |
51 |
52 | _NSArray+M3Extensions_
53 |
54 | **Changed**
55 | Old: `- (id)m3_objectPassingTest:(BOOL (^)(id))`
56 | New: `- (id)m3_firstObjectPassingTest:(BOOL (^)(id))`
57 |
58 |
59 |
60 | _NSCountedSet+M3Extensions_ **(added)**
61 |
62 | **Added**
63 | `- (NSSet *)m3_objectsWithCount:(NSUInteger)`
64 | `@property (readonly) NSUInteger m3_countedObjectTotal`
65 |
66 |
67 |
68 | _M3DFA_ **(removed)**
69 |
70 |
71 |
72 | _NSDictionary+M3Extensions_ **(added)**
73 |
74 | **Added**
75 | `- (NSDictionary *)m3_dictionaryBySettingObject:(id) forKey:(id )`
76 |
77 |
78 |
79 | _NSExpression+M3Extensions_
80 |
81 | **Changed**
82 | Old: `+ (NSExpression *)m3_expressionFromXMLElement:(NSXMLElement *)`
83 | New: `+ (NSExpression *)m3_expressionWithXMLElement:(NSXMLElement *)`
84 |
85 |
86 |
87 | _NSFileManager+M3Extensions_ **(removed)**
88 |
89 |
90 |
91 | _NSKeyValueObserving+M3Extensions_ **(added)**
92 | **Added**
93 | `- (void)m3_addObserver:(NSObject *) forKeyPathsInArray:(NSArray *) options:(NSKeyValueObservingOptions) context:(void *)`
94 | `- (void)m3_removeObserver:(NSObject *) forKeyPathsInArray:(NSArray *)`
95 | `- (void)m3_willChangeValueForKeys:(NSArray *)`
96 | `- (void)m3_didChangeValueForKeys:(NSArray *)`
97 |
98 |
99 |
100 | _NSMapTable+M3Extensions_ **(added)**
101 |
102 | **Added**
103 | `- (id)objectForKeyedSubscript:(id)`
104 | `- (void)setObject:(id) forKeyedSubscript:(id)`
105 |
106 |
107 |
108 | _NSMutableArray+M3Extensions_
109 |
110 | **Changed**
111 | Old: `- (void)m3_moveObject:(id) toIndex:(NSUInteger)`
112 | New: `- (void)m3_moveObjectAtIndex:(NSUInteger) toIndex:(NSUInteger)`
113 |
114 |
115 |
116 | _NSMutableSet+M3Extensions_ **(removed)**
117 |
118 |
119 |
120 | _NSObject+M3Extensions_
121 |
122 | **Changed**
123 | Old: `- (id)m3_replaceImplementationOfMethodWithSelector:(SEL) with:(void *)`
124 | New: `- (id)m3_replaceImplementationOfMethodWithSelector:(SEL) withBlock:(id)`
125 |
126 | **Removed**
127 | `- (void)m3_addObserver:(NSObject *) forKeyPathsInArray:(NSArray *) options:(NSKeyValueObservingOptions) context:(void *)`
128 | `- (void)m3_removeObserver:(NSObject *) forKeyPathsInArray:(NSArray *)`
129 | `- (void)m3_willChangeValueForKeys:(NSArray *)`
130 | `- (void)m3_didChangeValueForKeys:(NSArray *)`
131 |
132 |
133 |
134 | _NSPredicate+M3Extensions_
135 |
136 | **Changed**
137 | Old: `+ (NSPredicate *)m3_predicateFromXMLElement:(NSXMLElement *)`
138 | New: `+ (NSPredicate *)m3_predicateWithXMLElement:(NSXMLElement *)`
139 |
140 |
141 |
142 | _NSXMLNode+M3Extensions_
143 |
144 | **Removed**
145 | `- (NSXMLNode *)m3_nodeForXPath:(NSString *) error:(NSError **)`
--------------------------------------------------------------------------------
/Scripts/processbuildnumbers.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/ruby
2 |
3 | if (!File.exists?(".git"))
4 | print "This project is not versioned"
5 | exit
6 | end
7 |
8 | inputCount = ENV["SCRIPT_INPUT_FILE_COUNT"].to_i
9 | outputCount = ENV["SCRIPT_OUTPUT_FILE_COUNT"].to_i
10 |
11 | if (inputCount != outputCount)
12 | print "Need the same number of input and output files"
13 | end
14 |
15 | files = []
16 | for i in 0..(inputCount-1)
17 | files << {"input" => ENV["SCRIPT_INPUT_FILE_#{i}"], "output" => ENV["SCRIPT_OUTPUT_FILE_#{i}"]}
18 | end
19 |
20 | gitlocation = %x[which git].strip
21 |
22 | #get the revision count
23 | revno = %x[\"#{gitlocation}\" rev-list HEAD | wc -l]
24 | revno = revno.strip
25 |
26 | #Get the
27 | commit = %x[\"#{gitlocation}\" show --abbrev-commit | grep "^commit"]
28 | commitString = /commit (.*)/.match(commit)[1]
29 |
30 | files.each do |path|
31 | output = ""
32 | File.open(path["input"], "r") do |file|
33 | file.each_line do |line|
34 | if line =~ /__BUNDLE_VERSION__/
35 | output += line.gsub(/__BUNDLE_VERSION__/, "#{revno}")
36 | elsif line =~ /__COMMIT_HASH__/
37 | output += line.gsub(/__COMMIT_HASH__/, "#{commitString}")
38 | else
39 | output += line
40 | end
41 | end
42 | end
43 |
44 | if (output.length)
45 | File.open(path["output"], "w") do |file|
46 | file.puts(output)
47 | end
48 | end
49 | end
--------------------------------------------------------------------------------