Skip to content

Commit

Permalink
Initial empty starting point
Browse files Browse the repository at this point in the history
  • Loading branch information
jonreid committed Apr 9, 2011
0 parents commit 69bdd04
Show file tree
Hide file tree
Showing 64 changed files with 3,625 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
build/
*.pbxuser
*.perspectivev3
xcuserdata/
27 changes: 27 additions & 0 deletions Frameworks/OCHamcrest-1.4/LICENSE.txt
@@ -0,0 +1,27 @@
BSD License

Copyright 2011 hamcrest.org
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer. Redistributions in binary form must reproduce
the above copyright notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.

Neither the name of Hamcrest nor the names of its contributors may be used to endorse
or promote products derived from this software without specific prior written
permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
1 change: 1 addition & 0 deletions Frameworks/OCHamcrest-1.4/OCHamcrestIOS.framework/Headers
@@ -0,0 +1,53 @@
//
// OCHamcrest - HCAllOf.h
// Copyright 2011 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid
//

// Inherited
#import <OCHamcrestIOS/HCBaseMatcher.h>


/**
Calculates the logical conjunction of multiple matchers.
Evaluation is shortcut, so subsequent matchers are not called if an earlier matcher returns
@c NO.
@ingroup core_matchers
*/
@interface HCAllOf : HCBaseMatcher
{
NSArray *matchers;
}

+ (id)allOf:(NSArray *)theMatchers;
- (id)initWithMatchers:(NSArray *)theMatchers;

@end

//--------------------------------------------------------------------------------------------------

/**
Evaluates to @c YES only if @em all of the given matchers evaluate to @c YES.
@b Synonym: @ref allOf
@param matcher1 Comma-separated list of matchers ending with @c nil.
@see HCAllOf
@ingroup core_matchers
*/
OBJC_EXPORT id<HCMatcher> HC_allOf(id<HCMatcher> matcher1, ...);

/**
allOf(matcher1, ...) -
Evaluates to @c YES only if @em all of the given matchers evaluate to @c YES.
Synonym for @ref HC_allOf, available if @c HC_SHORTHAND is defined.
@param matcher1 Comma-separated list of matchers ending with @c nil.
@see HCAllOf
@ingroup core_matchers
*/
#ifdef HC_SHORTHAND
#define allOf HC_allOf
#endif
@@ -0,0 +1,53 @@
//
// OCHamcrest - HCAnyOf.h
// Copyright 2011 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid
//

// Inherited
#import <OCHamcrestIOS/HCBaseMatcher.h>


/**
Calculates the logical disjunction of multiple matchers.
Evaluation is shortcut, so the subsequent matchers are not called if an earlier matcher returns
@c YES.
@ingroup core_matchers
*/
@interface HCAnyOf : HCBaseMatcher
{
NSArray *matchers;
}

+ (id)anyOf:(NSArray *)theMatchers;
- (id)initWithMatchers:(NSArray *)theMatchers;

@end

//--------------------------------------------------------------------------------------------------

/**
Evaluates to @c YES if @em any of the given matchers evaluate to @c YES.
@b Synonym: @ref anyOf
@param matcher1 Comma-separated list of matchers ending with @c nil.
@see HCAnyOf
@ingroup core_matchers
*/
OBJC_EXPORT id<HCMatcher> HC_anyOf(id<HCMatcher> matcher1, ...);

/**
anyOf(matcher1, ...) -
Evaluates to @c YES if @em any of the given matchers evaluate to @c YES.
Synonym for @ref HC_anyOf, available if @c HC_SHORTHAND is defined.
@param matcher1 Comma-separated list of matchers ending with @c nil.
@see HCAnyOf
@ingroup core_matchers
*/
#ifdef HC_SHORTHAND
#define anyOf HC_anyOf
#endif
@@ -0,0 +1,50 @@
//
// OCHamcrest - HCAssertThat.h
// Copyright 2011 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid
//

#import <objc/objc-api.h>

@protocol HCMatcher;


/**
Asserts that actual value satisfies matcher.
If the matcher is not satisfied, an exception describing the mismatch is thrown. If you have
linked against a OCUnit-compatible testing framework, this exception is a test failure.
@param testCase A test case object that answers to @c -failWithException:
@ingroup integration
*/
OBJC_EXPORT void HC_assertThatWithLocation(id testCase, id actual, id<HCMatcher> matcher,
const char *fileName, int lineNumber);

/**
Asserts that actual value satisfies matcher.
If the matcher is not satisfied, an exception describing the mismatch is thrown.
@b Synonym: @ref assertThat
@see HC_assertThatWithLocation
@ingroup integration
*/
#define HC_assertThat(actual, matcher) \
HC_assertThatWithLocation(self, actual, matcher, __FILE__, __LINE__)

/**
assertThat(actual, matcher) -
Asserts that actual value satisfies matcher.
If the matcher is not satisfied, an exception describing the mismatch is thrown.
Synonym for @ref HC_assertThat, available if @c HC_SHORTHAND is defined.
@see HC_assertThatWithLocation
@ingroup integration
*/
#ifdef HC_SHORTHAND
#define assertThat HC_assertThat
#endif
@@ -0,0 +1,32 @@
//
// OCHamcrest - HCBaseDescription.h
// Copyright 2011 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid
//

// Inherited
#import <Foundation/Foundation.h>
#import <OCHamcrestIOS/HCDescription.h>


/**
Base class for all HCDescription implementations.
@ingroup core
*/
@interface HCBaseDescription : NSObject <HCDescription>
@end


/**
Methods that must be provided by subclasses of HCBaseDescription.
*/
@interface HCBaseDescription (SubclassMustImplement)

/**
Append the string @a str to the description.
*/
- (void)append:(NSString *)str;

@end
@@ -0,0 +1,27 @@
//
// OCHamcrest - HCBaseMatcher.h
// Copyright 2011 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid
//

// Inherited
#import <Foundation/Foundation.h>
#import <OCHamcrestIOS/HCMatcher.h>

// Convenience header, to provide OBJC_EXPORT
#import <objc/objc-api.h>


/**
Base class for all HCMatcher implementations.
Most implementations can just implement @c -matches: and let
<tt>-matches:describingMismatchTo:</tt> call it. But if it makes more sense to generate the
mismatch description during the matching, override <tt>-matches:describingMismatchTo:</tt> and
have @c -matches: call it with a @c nil description.
@ingroup core
*/
@interface HCBaseMatcher : NSObject <HCMatcher>
@end
@@ -0,0 +1,88 @@
//
// OCHamcrest - HCBoxNumber.h
// Copyright 2011 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid
//

#ifdef __cplusplus

namespace hamcrest {

/**
Boxes scalar value in NSNumber, specialized per type.
@ingroup number_matchers
*/
template <typename T>
inline
NSNumber *boxNumber(T value)
{ return nil; }

template <>
inline
NSNumber *boxNumber(BOOL value)
{ return [NSNumber numberWithBool:value]; }

template <>
inline
NSNumber *boxNumber(char value)
{ return [NSNumber numberWithChar:value]; }

template <>
inline
NSNumber *boxNumber(double value)
{ return [NSNumber numberWithDouble:value]; }

template <>
inline
NSNumber *boxNumber(float value)
{ return [NSNumber numberWithFloat:value]; }

template <>
inline
NSNumber *boxNumber(int value)
{ return [NSNumber numberWithInt:value]; }

template <>
inline
NSNumber *boxNumber(long value)
{ return [NSNumber numberWithLong:value]; }

template <>
inline
NSNumber *boxNumber(long long value)
{ return [NSNumber numberWithLongLong:value]; }

template <>
inline
NSNumber *boxNumber(short value)
{ return [NSNumber numberWithShort:value]; }

template <>
inline
NSNumber *boxNumber(unsigned char value)
{ return [NSNumber numberWithUnsignedChar:value]; }

template <>
inline
NSNumber *boxNumber(unsigned int value)
{ return [NSNumber numberWithUnsignedInt:value]; }

template <>
inline
NSNumber *boxNumber(unsigned long value)
{ return [NSNumber numberWithUnsignedLong:value]; }

template <>
inline
NSNumber *boxNumber(unsigned long long value)
{ return [NSNumber numberWithUnsignedLongLong:value]; }

template <>
inline
NSNumber *boxNumber(unsigned short value)
{ return [NSNumber numberWithUnsignedShort:value]; }

} // namespace hamcrest

#endif // __cplusplus
@@ -0,0 +1,21 @@
//
// OCHamcrest - HCCollectMatchers.h
// Copyright 2011 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid
//

#import <Foundation/Foundation.h>
#import <objc/objc-api.h>

// C
#import <stdarg.h>

@protocol HCMatcher;


/**
Returns an array of matchers from a variable-length comma-separated list terminated by @c nil.
@ingroup helpers
*/
OBJC_EXPORT NSMutableArray *HCCollectMatchers(id<HCMatcher> matcher1, va_list args);

0 comments on commit 69bdd04

Please sign in to comment.