iut 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. data/.gitignore +9 -0
  2. data/Gemfile +4 -0
  3. data/Rakefile +1 -0
  4. data/bin/iut +2 -0
  5. data/iut.gemspec +24 -0
  6. data/lib/iut.rb +17 -0
  7. data/lib/iut/generator.rb +28 -0
  8. data/lib/iut/version.rb +4 -0
  9. data/template/project/iUnitTest/iUnitTest.xcodeproj/project.pbxproj +480 -0
  10. data/template/project/iUnitTest/iUnitTest/Classes/.do_not_remove_this_directory +0 -0
  11. data/template/project/iUnitTest/iUnitTest/Tests/.do_not_remove_this_directory +0 -0
  12. data/template/project/iUnitTest/iUnitTest/en.lproj/InfoPlist.strings +2 -0
  13. data/template/project/iUnitTest/iUnitTest/iUnitTest-Info.plist +44 -0
  14. data/template/project/iUnitTest/iUnitTest/iUnitTest-Prefix.pch +14 -0
  15. data/template/project/iUnitTest/iUnitTest/iunittest/Default.png +0 -0
  16. data/template/project/iUnitTest/iUnitTest/iunittest/IUTAppDelegate.h +20 -0
  17. data/template/project/iUnitTest/iUnitTest/iunittest/IUTAppDelegate.m +38 -0
  18. data/template/project/iUnitTest/iUnitTest/iunittest/IUTDetailView.xib +184 -0
  19. data/template/project/iUnitTest/iUnitTest/iunittest/IUTMainWindow.xib +732 -0
  20. data/template/project/iUnitTest/iUnitTest/iunittest/IUTTestView.xib +432 -0
  21. data/template/project/iUnitTest/iUnitTest/iunittest/Settings.bundle/Japanese.lproj/Root.strings +0 -0
  22. data/template/project/iUnitTest/iUnitTest/iunittest/Settings.bundle/Root.plist +39 -0
  23. data/template/project/iUnitTest/iUnitTest/iunittest/Settings.bundle/en.lproj/Root.strings +0 -0
  24. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/AppAgent.h +33 -0
  25. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/AppAgent.m +135 -0
  26. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/AppAgentHelper.h +63 -0
  27. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UINavigationBarBasedTest.h +25 -0
  28. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UINavigationBarBasedTest.m +49 -0
  29. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITabBarAndNavigationBarBasedTest.h +23 -0
  30. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITabBarAndNavigationBarBasedTest.m +42 -0
  31. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITabBarBasedTest.h +25 -0
  32. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITabBarBasedTest.m +50 -0
  33. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITableViewBasedTest.h +23 -0
  34. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITableViewBasedTest.m +57 -0
  35. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITableViewControllerTest.h +22 -0
  36. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITableViewControllerTest.m +44 -0
  37. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UIViewBasedTest.h +21 -0
  38. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UIViewBasedTest.m +52 -0
  39. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UIViewControllerTest.h +63 -0
  40. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UIViewControllerTest.m +162 -0
  41. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/GTMSenTestCase.h +17 -0
  42. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/GTMSenTestCase.m +15 -0
  43. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTAssertion.h +135 -0
  44. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTAssertion.m +216 -0
  45. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTAssertionInfo.h +60 -0
  46. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTAssertionInfo.m +104 -0
  47. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTDetailViewController.h +24 -0
  48. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTDetailViewController.m +81 -0
  49. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTLog.h +14 -0
  50. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTPreference.h +34 -0
  51. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTPreference.m +125 -0
  52. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTResultTableViewCell.h +27 -0
  53. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTResultTableViewCell.m +83 -0
  54. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTResultTableViewController.h +26 -0
  55. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTResultTableViewController.m +193 -0
  56. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTest.h +74 -0
  57. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTest.m +127 -0
  58. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTestRunner.h +66 -0
  59. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTestRunner.m +449 -0
  60. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTestRunnerViewController.h +59 -0
  61. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTestRunnerViewController.m +163 -0
  62. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/NSExceptionExtension.h +21 -0
  63. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/NSExceptionExtension.m +52 -0
  64. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/SenTestAssertion.h +82 -0
  65. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/SourceCodeOpener.h +65 -0
  66. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/SourceCodeOpener.m +176 -0
  67. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/UITableViewControllerTestHelper.h +35 -0
  68. data/template/project/iUnitTest/iUnitTest/iunittest/isd_logo_60x40.png +0 -0
  69. data/template/project/iUnitTest/iUnitTest/iunittest/isd_logo_60x40_w.png +0 -0
  70. data/template/project/iUnitTest/iUnitTest/iunittest/iunittest_icon.png +0 -0
  71. data/template/project/iUnitTest/iUnitTest/main.m +18 -0
  72. data/template/project/iUnitTest/script/sync_source.rb +27 -0
  73. metadata +119 -0
@@ -0,0 +1,17 @@
1
+ //
2
+ // GTMSenTestCase.h
3
+ // iUnitTest
4
+ //
5
+ // Created by Katsuyoshi Ito on 09/02/09.
6
+ // Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import "IUTTest.h"
11
+
12
+
13
+ @interface SenTestCase : IUTTest {
14
+
15
+ }
16
+
17
+ @end
@@ -0,0 +1,15 @@
1
+ //
2
+ // GTMSenTestCase.m
3
+ // iUnitTest
4
+ //
5
+ // Created by Katsuyoshi Ito on 09/02/09.
6
+ // Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ //
8
+
9
+ #import "GTMSenTestCase.h"
10
+
11
+
12
+
13
+ @implementation SenTestCase
14
+
15
+ @end
@@ -0,0 +1,135 @@
1
+ //
2
+ // IUTAssertion.h
3
+ // iUnitTest
4
+ //
5
+ // Created by Katsuyoshi Ito on 09/01/16.
6
+ // Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import "IUTAssertionInfo.h"
11
+ #import "SenTestAssertion.h"
12
+
13
+
14
+ #define ASSERT(value) [self assert:(value) info:IUTASSERTION_INF(nil)]
15
+
16
+ #define ASSERT_FAIL(m) [self assert:NO info:IUTASSERTION_INF(m)]
17
+
18
+ #define ASSERT_SAME(_expected, _value) [self assertSame:(_value) expected:(_expected) info:IUTASSERTION_INF(nil)]
19
+ #define ASSERT_NOT_SAME(_expected, _value) [self assertNotSame:(_value) expected:(_expected) info:IUTASSERTION_INF(nil)]
20
+
21
+
22
+ #define ASSERT_EQUAL(_expected, _value) [self assertEqual:(_value) expected:(_expected) info:IUTASSERTION_INF(nil)]
23
+ #define ASSERT_NOT_EQUAL(_expected, _value) [self assertNotEqual:(_value) expected:(_expected) info:IUTASSERTION_INF(nil)]
24
+
25
+ #define ASSERT_EQUAL_INT(_expected, _value) [self assertEqualInt:(int)(_value) expected:(int)(_expected) info:IUTASSERTION_INF(nil)]
26
+ #define ASSERT_NOT_EQUAL_INT(_expected, _value) [self assertNotEqualInt:(int)(_value) expected:(int)(_expected) info:IUTASSERTION_INF(nil)]
27
+
28
+ #define ASSERT_EQUAL_FLOAT(_expected, _value) [self assertEqualFloat:(float)(_value) expected:(float)(_expected) info:IUTASSERTION_INF(nil)]
29
+ #define ASSERT_NOT_EQUAL_FLOAT(_expected, _value) [self assertNotEqualFloat:(float)(_value) expected:(float)(_expected) info:IUTASSERTION_INF(nil)]
30
+ #define ASSERT_EQUAL_FLOAT_DELTA(_expected, _value, _delta) [self assertEqualFloat:(float)(_value) expected:(float)(_expected) delta:(float)_delta info:IUTASSERTION_INF(nil)]
31
+
32
+ #define ASSERT_EQUAL_DOUBLE(_expected, _value) [self assertEqualDouble:(float)(_value) expected:(float)(_expected) info:IUTASSERTION_INF(nil)]
33
+ #define ASSERT_NOT_EQUAL_DOUBLE(_expected, _value) [self assertNotEqualDouble:(float)(_value) expected:(float)(_expected) info:IUTASSERTION_INF(nil)]
34
+ #define ASSERT_EQUAL_DOUBLE_DELTA(_expected, _value, _delta) [self assertEqualDouble:(float)(_value) expected:(float)(_expected) delta:(float)_delta info:IUTASSERTION_INF(nil)]
35
+
36
+
37
+ #define ASSERT_NIL(_value) [self assertNil:(_value) info:IUTASSERTION_INF(nil)]
38
+ #define ASSERT_NOT_NIL(_value) [self assertNotNil:(_value) info:IUTASSERTION_INF(nil)]
39
+
40
+
41
+ #define ASSERT_EQUAL_POINT(_expected, _value) [self assertEqualPoint:(_value) expected:(_expected) info:IUTASSERTION_INF(nil)]
42
+ #define ASSERT_EQUAL_SIZE(_expected, _value) [self assertEqualSize:(_value) expected:(_expected) info:IUTASSERTION_INF(nil)]
43
+ #define ASSERT_EQUAL_RECT(_expected, _value) [self assertEqualRect:(_value) expected:(_expected) info:IUTASSERTION_INF(nil)]
44
+
45
+
46
+ #define ASSERT_RAISE(expr) \
47
+ do { \
48
+ @try { \
49
+ {expr;}\
50
+ } \
51
+ @catch (id anException) { \
52
+ assertedCount++; \
53
+ continue; \
54
+ } \
55
+ ASSERT_FAIL(@"exception expected but none was thrown."); \
56
+ } while(0)
57
+
58
+ #define ASSERT_NOTHING_RAISED(expr) \
59
+ do { \
60
+ @try { \
61
+ {expr;}\
62
+ assertedCount++; \
63
+ } \
64
+ @catch (id anException) { \
65
+ ASSERT_FAIL(([NSString stringWithFormat:@"Exception raised:%@", anException])); \
66
+ } \
67
+ } while(0)
68
+
69
+
70
+ #define ASSERT_EQUAL_LOCALIZED_STRING(_expected, _value) ASSERT_EQUAL(NSLocalizedString(_expected, nil), _value)
71
+
72
+ #define ASSERT_EQUAL_LOCALIZED_STRING_FROM_TABLE(_expected, _table, _value) ASSERT_EQUAL(NSLocalizedStringFromTable(_expected, _table, nil), _value)
73
+
74
+
75
+ #pragma mark -
76
+ #pragma mark helper
77
+
78
+ #define TEST_IDLE(sel,t) \
79
+ [self performTest:@selector(_ ## sel) afterDelay:t];\
80
+ }\
81
+ - (void)_ ## sel {\
82
+
83
+
84
+ #define SETUP_IDLE(sel,t) \
85
+ [self performSetUpSequence:@selector(_ ## sel) afterDelay:t];\
86
+ }\
87
+ - (void)_ ## sel {\
88
+
89
+
90
+
91
+ #pragma mark -
92
+
93
+ extern NSString * const IUTAssertionExceptionName;
94
+ extern NSString * const IUTAssertionErrorExceptionName;
95
+
96
+ extern NSString * const IUTAssertionInfoKey;
97
+
98
+
99
+ @interface IUTAssertion : NSObject {
100
+ int assertedCount;
101
+ }
102
+
103
+ @property (readonly) int assertedCount;
104
+
105
+ + (NSException *)assertionErrorExceptionFrom:(NSException *)exception klass:(Class)klass selectorName:(NSString *)selectorString;
106
+
107
+ - (void)clearAssertedCount;
108
+
109
+ - (void)assert:(BOOL)value info:(IUTAssertionInfo *)info;
110
+
111
+ - (void)assertSame:(id)value expected:(id)expected info:(IUTAssertionInfo *)info;
112
+ - (void)assertNotSame:(id)value expected:(id)expected info:(IUTAssertionInfo *)info;
113
+
114
+ - (void)assertEqual:(id)value expected:(id)expected info:(IUTAssertionInfo *)info;
115
+ - (void)assertNotEqual:(id)value expected:(id)expected info:(IUTAssertionInfo *)info;
116
+
117
+ - (void)assertEqualInt:(int)value expected:(int)expected info:(IUTAssertionInfo *)info;
118
+ - (void)assertNotEqualInt:(int)value expected:(int)expected info:(IUTAssertionInfo *)info;
119
+
120
+ - (void)assertEqualFloat:(float)value expected:(float)expected info:(IUTAssertionInfo *)info;
121
+ - (void)assertNotEqualFloat:(float)value expected:(float)expected info:(IUTAssertionInfo *)info;
122
+ - (void)assertEqualFloat:(float)value expected:(float)expected delta:(float)delta info:(IUTAssertionInfo *)info;
123
+
124
+ - (void)assertEqualDouble:(double)value expected:(double)expected info:(IUTAssertionInfo *)info;
125
+ - (void)assertNotEqualDouble:(double)value expected:(double)expected info:(IUTAssertionInfo *)info;
126
+ - (void)assertEqualDouble:(double)value expected:(double)expected delta:(double)delta info:(IUTAssertionInfo *)info;
127
+
128
+ - (void)assertNil:(id)value info:(IUTAssertionInfo *)info;
129
+ - (void)assertNotNil:(id)value info:(IUTAssertionInfo *)info;
130
+
131
+ - (void)assertEqualPoint:(CGPoint)value expected:(CGPoint)expected info:(IUTAssertionInfo *)info;
132
+ - (void)assertEqualSize:(CGSize)value expected:(CGSize)expected info:(IUTAssertionInfo *)info;
133
+ - (void)assertEqualRect:(CGRect)value expected:(CGRect)expected info:(IUTAssertionInfo *)info;
134
+
135
+ @end
@@ -0,0 +1,216 @@
1
+ //
2
+ // IUTAssertion.m
3
+ // iUnitTest
4
+ //
5
+ // Created by Katsuyoshi Ito on 09/01/16.
6
+ // Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ //
8
+
9
+ #import "IUTAssertion.h"
10
+
11
+
12
+ NSString * const IUTAssertionExceptionName = @"IUTAssertException";
13
+ NSString * const IUTAssertionErrorExceptionName = @"IUTAssertErrorException";
14
+
15
+ NSString * const IUTAssertionInfoKey = @"IUTAssertionInfoKey";
16
+
17
+
18
+ @interface IUTAssertion(_private)
19
+ - (NSException *)assertExceptionWithInfo:(IUTAssertionInfo *)info;
20
+ @end
21
+
22
+
23
+ @implementation IUTAssertion
24
+
25
+ @synthesize assertedCount;
26
+
27
+ + (NSException *)assertionErrorExceptionFrom:(NSException *)anException klass:(Class)klass selectorName:(NSString *)selectorString
28
+ {
29
+ IUTAssertionInfo *info = [IUTAssertionInfo assertionInfoWithClass:klass selector:NSSelectorFromString(selectorString) message:anException.reason filePath:[NSString stringWithFormat:@"%@.m", NSStringFromClass(klass)] line:0];
30
+
31
+ return [NSException exceptionWithName:IUTAssertionErrorExceptionName reason:nil userInfo:[NSDictionary dictionaryWithObjectsAndKeys:info, IUTAssertionInfoKey, nil]];
32
+ }
33
+
34
+
35
+
36
+
37
+ - (void)clearAssertedCount
38
+ {
39
+ assertedCount = 0;
40
+ }
41
+
42
+
43
+ - (NSException *)assertExceptionWithInfo:(IUTAssertionInfo *)info
44
+ {
45
+ return [NSException exceptionWithName:IUTAssertionExceptionName reason:nil userInfo:[NSDictionary dictionaryWithObjectsAndKeys:info, IUTAssertionInfoKey, nil]];
46
+ }
47
+
48
+ - (void)assert:(BOOL)value info:(IUTAssertionInfo *)info
49
+ {
50
+ assertedCount++;
51
+ info.expected = @"YES";
52
+ info.actual = value ? @"YES" : @"NO";
53
+ if (value == NO) {
54
+ @throw [self assertExceptionWithInfo:info];
55
+ }
56
+ }
57
+
58
+ - (void)assertSame:(id)value expected:(id)expected info:(IUTAssertionInfo *)info
59
+ {
60
+ assertedCount++;
61
+ info.actual = value;
62
+ info.expected = expected;
63
+ if (value != expected) {
64
+ @throw [self assertExceptionWithInfo:info];
65
+ }
66
+ }
67
+
68
+ - (void)assertNotSame:(id)value expected:(id)expected info:(IUTAssertionInfo *)info
69
+ {
70
+ assertedCount++;
71
+ info.actual = value;
72
+ info.expected = expected;
73
+ info.negativeCase = YES;
74
+ if (value == expected) {
75
+ @throw [self assertExceptionWithInfo:info];
76
+ }
77
+ }
78
+
79
+
80
+
81
+ - (void)assertEqual:(id)value expected:(id)expected info:(IUTAssertionInfo *)info
82
+ {
83
+ if (expected == nil) {
84
+ [self assertNil:value info:info];
85
+ } else {
86
+ assertedCount++;
87
+ info.actual = value;
88
+ info.expected = expected;
89
+ if ([value isEqual:expected] == NO) {
90
+ @throw [self assertExceptionWithInfo:info];
91
+ }
92
+ }
93
+ }
94
+
95
+ - (void)assertNotEqual:(id)value expected:(id)expected info:(IUTAssertionInfo *)info
96
+ {
97
+ if (expected == nil) {
98
+ [self assertNotNil:value info:info];
99
+ } else {
100
+ assertedCount++;
101
+ info.actual = value;
102
+ info.expected = expected;
103
+ info.negativeCase = YES;
104
+ if ([value isEqual:expected]) {
105
+ @throw [self assertExceptionWithInfo:info];
106
+ }
107
+ }
108
+ }
109
+
110
+
111
+
112
+ - (void)assertEqualInt:(int)value expected:(int)expected info:(IUTAssertionInfo *)info
113
+ {
114
+ [self assertEqual:[NSNumber numberWithInt:value] expected:[NSNumber numberWithInt:expected] info:info];
115
+ }
116
+
117
+ - (void)assertNotEqualInt:(int)value expected:(int)expected info:(IUTAssertionInfo *)info
118
+ {
119
+ [self assertNotEqual:[NSNumber numberWithInt:value] expected:[NSNumber numberWithInt:expected] info:info];
120
+ }
121
+
122
+
123
+ - (void)assertEqualFloat:(float)value expected:(float)expected info:(IUTAssertionInfo *)info
124
+ {
125
+ [self assertEqual:[NSNumber numberWithFloat:value] expected:[NSNumber numberWithFloat:expected] info:info];
126
+ }
127
+
128
+ - (void)assertNotEqualFloat:(float)value expected:(float)expected info:(IUTAssertionInfo *)info
129
+ {
130
+ [self assertNotEqual:[NSNumber numberWithFloat:value] expected:[NSNumber numberWithFloat:expected] info:info];
131
+ }
132
+
133
+ - (void)assertEqualFloat:(float)value expected:(float)expected delta:(float)delta info:(IUTAssertionInfo *)info
134
+ {
135
+ assertedCount++;
136
+ info.actual = [NSNumber numberWithFloat:value];
137
+ info.expected = [NSNumber numberWithFloat:expected];
138
+ info.delta = [NSNumber numberWithFloat:delta];
139
+ if (fabsf(expected - value) > delta) {
140
+ @throw [self assertExceptionWithInfo:info];
141
+ }
142
+ }
143
+
144
+ - (void)assertEqualDouble:(double)value expected:(double)expected info:(IUTAssertionInfo *)info
145
+ {
146
+ [self assertEqual:[NSNumber numberWithDouble:value] expected:[NSNumber numberWithDouble:expected] info:info];
147
+ }
148
+
149
+ - (void)assertNotEqualDouble:(double)value expected:(double)expected info:(IUTAssertionInfo *)info
150
+ {
151
+ [self assertNotEqual:[NSNumber numberWithDouble:value] expected:[NSNumber numberWithDouble:expected] info:info];
152
+ }
153
+
154
+ - (void)assertEqualDouble:(double)value expected:(double)expected delta:(double)delta info:(IUTAssertionInfo *)info
155
+ {
156
+ assertedCount++;
157
+ info.actual = [NSNumber numberWithDouble:value];
158
+ info.expected = [NSNumber numberWithDouble:expected];
159
+ info.delta = [NSNumber numberWithDouble:delta];
160
+ if (fabs(expected - value) > delta) {
161
+ @throw [self assertExceptionWithInfo:info];
162
+ }
163
+ }
164
+
165
+ - (void)assertNil:(id)value info:(IUTAssertionInfo *)info
166
+ {
167
+ assertedCount++;
168
+ info.expected = nil;
169
+ info.actual = value;
170
+ if (value != nil) {
171
+ @throw [self assertExceptionWithInfo:info];
172
+ }
173
+ }
174
+
175
+ - (void)assertNotNil:(id)value info:(IUTAssertionInfo *)info
176
+ {
177
+ assertedCount++;
178
+ info.expected = nil;
179
+ info.actual = value;
180
+ info.negativeCase = YES;
181
+ if (value == nil) {
182
+ @throw [self assertExceptionWithInfo:info];
183
+ }
184
+ }
185
+
186
+ - (void)assertEqualPoint:(CGPoint)value expected:(CGPoint)expected info:(IUTAssertionInfo *)info
187
+ {
188
+ assertedCount++;
189
+ info.expected = NSStringFromCGPoint(expected);
190
+ info.actual = NSStringFromCGPoint(value);
191
+ if (!CGPointEqualToPoint(value, expected)) {
192
+ @throw [self assertExceptionWithInfo:info];
193
+ }
194
+ }
195
+
196
+ - (void)assertEqualSize:(CGSize)value expected:(CGSize)expected info:(IUTAssertionInfo *)info
197
+ {
198
+ assertedCount++;
199
+ info.expected = NSStringFromCGSize(expected);
200
+ info.actual = NSStringFromCGSize(value);
201
+ if (!CGSizeEqualToSize(value, expected)) {
202
+ @throw [self assertExceptionWithInfo:info];
203
+ }
204
+ }
205
+
206
+ - (void)assertEqualRect:(CGRect)value expected:(CGRect)expected info:(IUTAssertionInfo *)info
207
+ {
208
+ assertedCount++;
209
+ info.expected = NSStringFromCGRect(expected);
210
+ info.actual = NSStringFromCGRect(value);
211
+ if (!CGRectEqualToRect(value, expected)) {
212
+ @throw [self assertExceptionWithInfo:info];
213
+ }
214
+ }
215
+
216
+ @end
@@ -0,0 +1,60 @@
1
+ //
2
+ // AssertionInfo.h
3
+ // iUnitTest
4
+ //
5
+ // Created by Katsuyoshi Ito on 09/01/16.
6
+ // Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import "SourceCodeOpener.h"
11
+
12
+
13
+ #define IUTASSERTION_INF(m) [IUTAssertionInfo assertionInfoWithClass:[self class] selector:_cmd message:m filePath:[[[NSString alloc] initWithCString:__FILE__ encoding:NSUTF8StringEncoding] autorelease] line:__LINE__]
14
+
15
+ @interface IUTAssertionInfo : NSObject {
16
+
17
+ NSString *className;
18
+ NSString *methodName;
19
+ NSString *message;
20
+ NSString *filePath;
21
+ NSInteger line;
22
+
23
+ id expected;
24
+ id actual;
25
+ id delta;
26
+
27
+ BOOL negativeCase;
28
+ }
29
+
30
+ @property (retain, readonly) NSString *className;
31
+ @property (retain, readonly) NSString *methodName;
32
+ @property (retain, readonly) NSString *message;
33
+ @property (assign, readonly) NSString *reason;
34
+ @property (retain, readonly) NSString *filePath;
35
+ @property (assign, readonly) NSString *fileName;
36
+ @property NSInteger line;
37
+
38
+ @property (retain) id expected;
39
+ @property (retain) id actual;
40
+ @property (retain) id delta;
41
+
42
+ @property BOOL negativeCase;
43
+
44
+ + (id)assertionInfoWithClass:(Class)klass selector:(SEL)selector message:(NSString *)message filePath:(NSString *)path line:(NSInteger)line;
45
+
46
+ - (id)initWithWithClass:(Class)klass selector:(SEL)selector message:(NSString *)message filePath:(NSString *)path line:(NSInteger)line;
47
+
48
+
49
+ @end
50
+
51
+
52
+ #if TARGET_IPHONE_SIMULATOR
53
+
54
+ @interface SourceCodeOpener(IUTAssertionInfo)
55
+
56
+ - (void)open:(IUTAssertionInfo *)info;
57
+
58
+ @end
59
+
60
+ #endif