forked from pivotalforks/OCHamcrest
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added assertThat___ and equalTo___ for all types understood by NSNumb…
…er. For example: assertThatInt(42, equalToInt(42)) git-svn-id: http://hamcrest.googlecode.com/svn/trunk/hamcrest-objectivec@477 2aa0e9f1-8e24-0410-adc4-1b6a3a6e65e2
- Loading branch information
jon.m.reid
committed
Dec 1, 2009
1 parent
99890c2
commit 67ed2b5
Showing
19 changed files
with
1,435 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,32 @@ | ||
01 Dec 2009: | ||
* Added assertThat___ and equalTo___ for all types understood by NSNumber. For example: assertThatInt(42, equalToInt(42)) | ||
|
||
24 Nov 2009: | ||
* Changed assertThat behavior to work more seamlessly with OCUnit: Instead of throwing an exception, it calls the same method as OCUnit's assertion macros to fail the test. As a result, a failing assertThat will not terminate the test, so that the test can record other failures. (Following normal OCUnit behavior, you can instruct the test case to terminate at the first failure by invoking raiseAfterFailure.) | ||
This change requires that assertThat be called only within subclasses of SenTestCase, which wasn't the case before. You will need to recompile your tests. | ||
If you need an original-style assertion that can be called outside of a SenTestCase, email your request to hamcrest-dev@googlegroups.com | ||
(24 Nov 2009) | ||
|
||
* Support Xcode 3.2's redesigned Build Results window by removing colons from assertThat description. (24 Nov 2009) | ||
24 Nov 2009: | ||
* Support Xcode 3.2's redesigned Build Results window by removing colons from assertThat description. | ||
|
||
* Added helper class HCInvocationMatcher for building other matchers from NSInvocations. See HCHasDescription for an example. (17 Oct 2009) | ||
17 Oct 2009: | ||
* Added helper class HCInvocationMatcher for building other matchers from NSInvocations. See HCHasDescription for an example. | ||
|
||
* Renamed framework to OCHamcrest. (11 Aug 2009) | ||
11 Aug 2009: | ||
* Renamed framework to OCHamcrest. | ||
|
||
* Added support for Mac OS X 10.4 projects. (07 Jul 2009) | ||
07 Jul 2009: | ||
* Added support for Mac OS X 10.4 projects. | ||
|
||
* Fixed compiler errors when used with Objective-C++ (.mm files). (28 Jan 2009) | ||
28 Jan 2009: | ||
* Fixed compiler errors when used with Objective-C++ (.mm files). | ||
|
||
* Added means for matchers to describe mismatches. You can use either matches:describingMismatchTo: to do it one shot, or call describeMismatchOf:To: once you know a particular item does not match. (24 Jan 2009) | ||
24 Jan 2009: | ||
* Added means for matchers to describe mismatches. You can use either matches:describingMismatchTo: to do it one shot, or call describeMismatchOf:To: once you know a particular item does not match. | ||
|
||
* Changed matchers whose description looks similar to a function call so that the description matches the name of the factory function. (18 Jul 2008) | ||
18 Jul 2008: | ||
* Changed matchers whose description looks similar to a function call so that the description matches the name of the factory function. | ||
|
||
* Initial release (13 Apr 2008) | ||
13 Apr 2008: | ||
* Initial release | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,8 @@ | |
|
||
// OCHamcrest | ||
#import "HCDescription.h" | ||
|
||
// OCHamcrest internal | ||
#import "HCIntegerTypes.h" | ||
|
||
// C++ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// | ||
// OCHamcrest - HCBoxNumber.h | ||
// Copyright 2009 www.hamcrest.org. See LICENSE.txt | ||
// | ||
// Created by: Jon Reid | ||
// | ||
|
||
#ifdef __cplusplus | ||
|
||
namespace hamcrest { | ||
|
||
/** | ||
Boxes scalar value in NSNumber, specialized per type. | ||
*/ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
// | ||
// OCHamcrest - HCIsEqualToNumber.h | ||
// Copyright 2009 www.hamcrest.org. See LICENSE.txt | ||
// | ||
// Created by: Jon Reid | ||
// | ||
|
||
// Inherited | ||
#import <OCHamcrest/HCBaseMatcher.h> | ||
|
||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
Is the value, when converted to an NSNumber, equal to another object? | ||
*/ | ||
id<HCMatcher> HC_equalToBool(BOOL value); | ||
|
||
/** | ||
Is the value, when converted to an NSNumber, equal to another object? | ||
*/ | ||
id<HCMatcher> HC_equalToChar(char value); | ||
|
||
/** | ||
Is the value, when converted to an NSNumber, equal to another object? | ||
*/ | ||
id<HCMatcher> HC_equalToDouble(double value); | ||
|
||
/** | ||
Is the value, when converted to an NSNumber, equal to another object? | ||
*/ | ||
id<HCMatcher> HC_equalToFloat(float value); | ||
|
||
/** | ||
Is the value, when converted to an NSNumber, equal to another object? | ||
*/ | ||
id<HCMatcher> HC_equalToInt(int value); | ||
|
||
/** | ||
Is the value, when converted to an NSNumber, equal to another object? | ||
*/ | ||
id<HCMatcher> HC_equalToLong(long value); | ||
|
||
/** | ||
Is the value, when converted to an NSNumber, equal to another object? | ||
*/ | ||
id<HCMatcher> HC_equalToLongLong(long long value); | ||
|
||
/** | ||
Is the value, when converted to an NSNumber, equal to another object? | ||
*/ | ||
id<HCMatcher> HC_equalToShort(short value); | ||
|
||
/** | ||
Is the value, when converted to an NSNumber, equal to another object? | ||
*/ | ||
id<HCMatcher> HC_equalToUnsignedChar(unsigned char value); | ||
|
||
/** | ||
Is the value, when converted to an NSNumber, equal to another object? | ||
*/ | ||
id<HCMatcher> HC_equalToUnsignedInt(unsigned int value); | ||
|
||
/** | ||
Is the value, when converted to an NSNumber, equal to another object? | ||
*/ | ||
id<HCMatcher> HC_equalToUnsignedLong(unsigned long value); | ||
|
||
/** | ||
Is the value, when converted to an NSNumber, equal to another object? | ||
*/ | ||
id<HCMatcher> HC_equalToUnsignedLongLong(unsigned long long value); | ||
|
||
/** | ||
Is the value, when converted to an NSNumber, equal to another object? | ||
*/ | ||
id<HCMatcher> HC_equalToUnsignedShort(unsigned short value); | ||
|
||
|
||
#if defined(OBJC_API_VERSION) && OBJC_API_VERSION >= 2 | ||
|
||
/** | ||
Is the value, when converted to an NSNumber, equal to another object? | ||
*/ | ||
id<HCMatcher> HC_equalToInteger(NSInteger value); | ||
|
||
/** | ||
Is the value, when converted to an NSNumber, equal to another object? | ||
*/ | ||
id<HCMatcher> HC_equalToUnsignedInteger(NSUInteger value); | ||
|
||
#endif // Objective-C 2.0 | ||
|
||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
|
||
#ifdef HC_SHORTHAND | ||
|
||
/** | ||
Shorthand for HC_equalToBool, available if HC_SHORTHAND is defined. | ||
*/ | ||
#define equalToBool HC_equalToBool | ||
|
||
/** | ||
Shorthand for HC_equalToChar, available if HC_SHORTHAND is defined. | ||
*/ | ||
#define equalToChar HC_equalToChar | ||
|
||
/** | ||
Shorthand for HC_equalToDouble, available if HC_SHORTHAND is defined. | ||
*/ | ||
#define equalToDouble HC_equalToDouble | ||
|
||
/** | ||
Shorthand for HC_equalToFloat, available if HC_SHORTHAND is defined. | ||
*/ | ||
#define equalToFloat HC_equalToFloat | ||
|
||
/** | ||
Shorthand for HC_equalToInt, available if HC_SHORTHAND is defined. | ||
*/ | ||
#define equalToInt HC_equalToInt | ||
|
||
/** | ||
Shorthand for HC_equalToLong, available if HC_SHORTHAND is defined. | ||
*/ | ||
#define equalToLong HC_equalToLong | ||
|
||
/** | ||
Shorthand for HC_equalToLongLong, available if HC_SHORTHAND is defined. | ||
*/ | ||
#define equalToLongLong HC_equalToLongLong | ||
|
||
/** | ||
Shorthand for HC_equalToShort, available if HC_SHORTHAND is defined. | ||
*/ | ||
#define equalToShort HC_equalToShort | ||
|
||
/** | ||
Shorthand for HC_equalToUnsignedChar, available if HC_SHORTHAND is defined. | ||
*/ | ||
#define equalToUnsignedChar HC_equalToUnsignedChar | ||
|
||
/** | ||
Shorthand for HC_equalToUnsignedInt, available if HC_SHORTHAND is defined. | ||
*/ | ||
#define equalToUnsignedInt HC_equalToUnsignedInt | ||
|
||
/** | ||
Shorthand for HC_equalToUnsignedLong, available if HC_SHORTHAND is defined. | ||
*/ | ||
#define equalToUnsignedLong HC_equalToUnsignedLong | ||
|
||
/** | ||
Shorthand for HC_equalToUnsignedLongLong, available if HC_SHORTHAND is defined. | ||
*/ | ||
#define equalToUnsignedLongLong HC_equalToUnsignedLongLong | ||
|
||
/** | ||
Shorthand for HC_equalToUnsignedShort, available if HC_SHORTHAND is defined. | ||
*/ | ||
#define equalToUnsignedShort HC_equalToUnsignedShort | ||
|
||
|
||
#if defined(OBJC_API_VERSION) && OBJC_API_VERSION >= 2 | ||
|
||
/** | ||
Shorthand for HC_equalToInteger, available if HC_SHORTHAND is defined. | ||
*/ | ||
#define equalToInteger HC_equalToInteger | ||
|
||
/** | ||
Shorthand for HC_equalToUnsignedInteger, available if HC_SHORTHAND is defined. | ||
*/ | ||
#define equalToUnsignedInteger HC_equalToUnsignedInteger | ||
|
||
#endif // Objective-C 2.0 | ||
|
||
|
||
#endif // HC_SHORTHAND |
Oops, something went wrong.