Ben Copsey

iPhone tests now working

Moved all SenTestCases to GHTestCases
@@ -6,9 +6,9 @@ @@ -6,9 +6,9 @@
6 // Copyright 2008 All-Seeing Interactive. All rights reserved. 6 // Copyright 2008 All-Seeing Interactive. All rights reserved.
7 // 7 //
8 8
9 -#import <SenTestingKit/SenTestingKit.h> 9 +#import "GHUnit.h"
10 10
11 -@interface ASIFormDataRequestTests : SenTestCase { 11 +@interface ASIFormDataRequestTests : GHTestCase {
12 float progress; 12 float progress;
13 } 13 }
14 14
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease]; 25 ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
26 26
27 NSDate *d = [NSDate new]; 27 NSDate *d = [NSDate new];
28 - NSValue *v = [NSValue valueWithRect:NSMakeRect(0, 0, 200, 200)]; 28 + NSValue *v = [NSValue valueWithCGRect:CGRectMake(0, 0, 200, 200)];
29 [request setPostValue:@"foo" forKey:@"post_var"]; 29 [request setPostValue:@"foo" forKey:@"post_var"];
30 [request setPostValue:d forKey:@"post_var2"]; 30 [request setPostValue:d forKey:@"post_var2"];
31 [request setPostValue:v forKey:@"post_var3"]; 31 [request setPostValue:v forKey:@"post_var3"];
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 [request start]; 33 [request start];
34 34
35 BOOL success = ([[request responseString] isEqualToString:[NSString stringWithFormat:@"post_var: %@\r\npost_var2: %@\r\npost_var3: %@\r\nfile_name: %@\r\nfile_size: %hu",@"foo",d,v,@"bigfile",size]]); 35 BOOL success = ([[request responseString] isEqualToString:[NSString stringWithFormat:@"post_var: %@\r\npost_var2: %@\r\npost_var3: %@\r\nfile_name: %@\r\nfile_size: %hu",@"foo",d,v,@"bigfile",size]]);
36 - STAssertTrue(success,@"Failed to upload the correct data (using local file)"); 36 + GHAssertTrue(success,@"Failed to upload the correct data (using local file)");
37 37
38 //Try the same with the raw data 38 //Try the same with the raw data
39 request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease]; 39 request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
@@ -44,7 +44,7 @@ @@ -44,7 +44,7 @@
44 [request start]; 44 [request start];
45 45
46 success = ([[request responseString] isEqualToString:[NSString stringWithFormat:@"post_var: %@\r\npost_var2: %@\r\npost_var3: %@\r\nfile_name: %@\r\nfile_size: %hu",@"foo",d,v,@"file",size]]); 46 success = ([[request responseString] isEqualToString:[NSString stringWithFormat:@"post_var: %@\r\npost_var2: %@\r\npost_var3: %@\r\nfile_name: %@\r\nfile_size: %hu",@"foo",d,v,@"file",size]]);
47 - STAssertTrue(success,@"Failed to upload the correct data (using NSData)"); 47 + GHAssertTrue(success,@"Failed to upload the correct data (using NSData)");
48 } 48 }
49 49
50 50
@@ -6,10 +6,9 @@ @@ -6,10 +6,9 @@
6 // Copyright 2008 All-Seeing Interactive. All rights reserved. 6 // Copyright 2008 All-Seeing Interactive. All rights reserved.
7 // 7 //
8 8
9 -#import <SenTestingKit/SenTestingKit.h> 9 +#import "GHUnit.h"
10 10
11 - 11 +@interface ASIHTTPRequestTests : GHTestCase {
12 -@interface ASIHTTPRequestTests : SenTestCase {  
13 float progress; 12 float progress;
14 } 13 }
15 14
This diff is collapsed. Click to expand it.
@@ -6,12 +6,12 @@ @@ -6,12 +6,12 @@
6 // Copyright 2008 All-Seeing Interactive. All rights reserved. 6 // Copyright 2008 All-Seeing Interactive. All rights reserved.
7 // 7 //
8 8
9 -#import <SenTestingKit/SenTestingKit.h> 9 +#import "GHUnit.h"
10 10
11 @class ASIHTTPRequest; 11 @class ASIHTTPRequest;
12 @class ASINetworkQueue; 12 @class ASINetworkQueue;
13 13
14 -@interface ASINetworkQueueTests : SenTestCase { 14 +@interface ASINetworkQueueTests : GHTestCase {
15 ASIHTTPRequest *requestThatShouldFail; 15 ASIHTTPRequest *requestThatShouldFail;
16 ASINetworkQueue *networkQueue; 16 ASINetworkQueue *networkQueue;
17 BOOL complete; 17 BOOL complete;
@@ -45,7 +45,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod @@ -45,7 +45,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod
45 } 45 }
46 46
47 BOOL success = (progress == 1.0); 47 BOOL success = (progress == 1.0);
48 - STAssertTrue(success,@"Failed to increment progress properly"); 48 + GHAssertTrue(success,@"Failed to increment progress properly");
49 49
50 //Now test again with accurate progress 50 //Now test again with accurate progress
51 [networkQueue cancelAllOperations]; 51 [networkQueue cancelAllOperations];
@@ -69,7 +69,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod @@ -69,7 +69,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod
69 69
70 // Progress maths are inexact for queues 70 // Progress maths are inexact for queues
71 success = (progress > 0.95); 71 success = (progress > 0.95);
72 - STAssertTrue(success,@"Failed to increment progress properly"); 72 + GHAssertTrue(success,@"Failed to increment progress properly");
73 73
74 74
75 [networkQueue release]; 75 [networkQueue release];
@@ -126,31 +126,31 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod @@ -126,31 +126,31 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod
126 126
127 BOOL success; 127 BOOL success;
128 success = ([request1 error] == nil); 128 success = ([request1 error] == nil);
129 - STAssertTrue(success,@"Request 1 failed"); 129 + GHAssertTrue(success,@"Request 1 failed");
130 130
131 success = [[request1 responseString] isEqualToString:@"This is the expected content for the first string"]; 131 success = [[request1 responseString] isEqualToString:@"This is the expected content for the first string"];
132 - STAssertTrue(success,@"Failed to download the correct data for request 1"); 132 + GHAssertTrue(success,@"Failed to download the correct data for request 1");
133 133
134 success = ([request2 error] == nil); 134 success = ([request2 error] == nil);
135 - STAssertTrue(success,@"Request 2 failed"); 135 + GHAssertTrue(success,@"Request 2 failed");
136 136
137 success = [[request2 responseString] isEqualToString:@"This is the expected content for the second string"]; 137 success = [[request2 responseString] isEqualToString:@"This is the expected content for the second string"];
138 - STAssertTrue(success,@"Failed to download the correct data for request 2"); 138 + GHAssertTrue(success,@"Failed to download the correct data for request 2");
139 139
140 success = ([request3 error] == nil); 140 success = ([request3 error] == nil);
141 - STAssertTrue(success,@"Request 3 failed"); 141 + GHAssertTrue(success,@"Request 3 failed");
142 142
143 success = [[request3 responseString] isEqualToString:@"This is the expected content for the third string"]; 143 success = [[request3 responseString] isEqualToString:@"This is the expected content for the third string"];
144 - STAssertTrue(success,@"Failed to download the correct data for request 3"); 144 + GHAssertTrue(success,@"Failed to download the correct data for request 3");
145 145
146 success = ([requestThatShouldFail error] != nil); 146 success = ([requestThatShouldFail error] != nil);
147 - STAssertTrue(success,@"Request 4 succeed when it should have failed"); 147 + GHAssertTrue(success,@"Request 4 succeed when it should have failed");
148 148
149 success = ([request5 error] == nil); 149 success = ([request5 error] == nil);
150 - STAssertTrue(success,@"Request 5 failed"); 150 + GHAssertTrue(success,@"Request 5 failed");
151 151
152 success = ([request5 responseStatusCode] == 404); 152 success = ([request5 responseStatusCode] == 404);
153 - STAssertTrue(success,@"Failed to obtain the correct status code for request 5"); 153 + GHAssertTrue(success,@"Failed to obtain the correct status code for request 5");
154 154
155 155
156 156
@@ -203,7 +203,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod @@ -203,7 +203,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod
203 - (void)requestFailed:(ASIHTTPRequest *)request 203 - (void)requestFailed:(ASIHTTPRequest *)request
204 { 204 {
205 BOOL success = (request == requestThatShouldFail); 205 BOOL success = (request == requestThatShouldFail);
206 - STAssertTrue(success,@"Wrong request failed"); 206 + GHAssertTrue(success,@"Wrong request failed");
207 } 207 }
208 208
209 - (void)queueFinished:(ASINetworkQueue *)queue 209 - (void)queueFinished:(ASINetworkQueue *)queue
@@ -237,7 +237,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod @@ -237,7 +237,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod
237 } 237 }
238 238
239 NSError *error = [request error]; 239 NSError *error = [request error];
240 - STAssertNotNil(error,@"The HEAD request failed, but it didn't tell the main request to fail"); 240 + GHAssertNotNil(error,@"The HEAD request failed, but it didn't tell the main request to fail");
241 [networkQueue release]; 241 [networkQueue release];
242 242
243 243
@@ -259,7 +259,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod @@ -259,7 +259,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod
259 } 259 }
260 260
261 error = [request error]; 261 error = [request error];
262 - STAssertNil(error,@"Failed to use authentication in a queue"); 262 + GHAssertNil(error,@"Failed to use authentication in a queue");
263 [networkQueue release]; 263 [networkQueue release];
264 264
265 } 265 }
This diff was suppressed by a .gitattributes entry.
@@ -17,6 +17,6 @@ @@ -17,6 +17,6 @@
17 <key>CFBundleVersion</key> 17 <key>CFBundleVersion</key>
18 <string>1.0</string> 18 <string>1.0</string>
19 <key>NSMainNibFile</key> 19 <key>NSMainNibFile</key>
20 - <string>GHUnitIPhone.xib</string> 20 + <string>GHUnitIPhone</string>
21 </dict> 21 </dict>
22 </plist> 22 </plist>