Skip to content

Commit d14df11

Browse files
committed
Fixes for running unit tests on 64 bit.
Former-commit-id: 3add678
1 parent b16deea commit d14df11

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

Chipmunk7-ios.xcodeproj/project.pbxproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@
380380
isa = XCBuildConfiguration;
381381
buildSettings = {
382382
ALWAYS_SEARCH_USER_PATHS = NO;
383-
ARCHS = "$(ARCHS_STANDARD)";
384383
CLANG_ENABLE_MODULES = YES;
385384
CLANG_ENABLE_OBJC_ARC = NO;
386385
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
@@ -406,7 +405,6 @@
406405
isa = XCBuildConfiguration;
407406
buildSettings = {
408407
ALWAYS_SEARCH_USER_PATHS = NO;
409-
ARCHS = "$(ARCHS_STANDARD)";
410408
CLANG_ENABLE_MODULES = YES;
411409
CLANG_ENABLE_OBJC_ARC = NO;
412410
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;

UnitTests/CCPhysicsTests.m

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -361,46 +361,50 @@ -(void)testBasicSequences11
361361

362362
-(void)testDynamicAnchorPoint
363363
{
364+
cpFloat accuracy = 1e-4;
365+
364366
CCPhysicsNode *physicsNode = [CCPhysicsNode node];
365367

366368
CCNode *node = [CCNode node];
367369
node.contentSize = CGSizeMake(2, 2);
368370
node.anchorPoint = ccp(0.5, 0.5);
369-
XCTAssert(ccpDistance(node.position, CGPointZero) == 0.0, @"");
371+
XCTAssert(ccpDistance(node.position, CGPointZero) < accuracy, @"");
370372

371373
node.physicsBody = [CCPhysicsBody bodyWithCircleOfRadius:1.0 andCenter:CGPointZero];
372374
node.physicsBody.type = CCPhysicsBodyTypeDynamic;
373-
XCTAssert(ccpDistance(node.position, CGPointZero) == 0.0, @"");
375+
XCTAssert(ccpDistance(node.position, CGPointZero) < accuracy, @"");
374376

375377
[physicsNode addChild:node];
376378
[physicsNode onEnter];
377-
XCTAssert(ccpDistance(node.position, CGPointZero) == 0.0, @"");
379+
XCTAssert(ccpDistance(node.position, CGPointZero) < accuracy, @"");
378380

379381
node.rotation = 90;
380-
XCTAssert(ccpDistance(node.position, CGPointZero) == 0.0, @"");
382+
XCTAssert(ccpDistance(node.position, CGPointZero) < accuracy, @"");
381383

382384
[physicsNode onExit];
383385
}
384386

385387
-(void)testStaticAnchorPoint
386388
{
389+
cpFloat accuracy = 1e-4;
390+
387391
CCPhysicsNode *physicsNode = [CCPhysicsNode node];
388392

389393
CCNode *node = [CCNode node];
390394
node.contentSize = CGSizeMake(2, 2);
391395
node.anchorPoint = ccp(0.5, 0.5);
392-
XCTAssert(ccpDistance(node.position, CGPointZero) == 0.0, @"");
396+
XCTAssert(ccpDistance(node.position, CGPointZero) < accuracy, @"");
393397

394398
node.physicsBody = [CCPhysicsBody bodyWithCircleOfRadius:1.0 andCenter:CGPointZero];
395399
node.physicsBody.type = CCPhysicsBodyTypeStatic;
396-
XCTAssert(ccpDistance(node.position, CGPointZero) == 0.0, @"");
400+
XCTAssert(ccpDistance(node.position, CGPointZero) < accuracy, @"");
397401

398402
[physicsNode addChild:node];
399403
[physicsNode onEnter];
400-
XCTAssert(ccpDistance(node.position, CGPointZero) == 0.0, @"");
404+
XCTAssert(ccpDistance(node.position, CGPointZero) < accuracy, @"");
401405

402406
node.rotation = 90;
403-
XCTAssert(ccpDistance(node.position, CGPointZero) == 0.0, @"");
407+
XCTAssert(ccpDistance(node.position, CGPointZero) < accuracy, @"");
404408

405409
[physicsNode onExit];
406410
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c242ea53588adc36df5dfa4687bac683e8c60efa
1+
ff4a2d3466bfd917096f6f892ba450058e0d59b5

cocos2d/CCPhysicsNode.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,10 @@ -(void)registerDelegateMethodsForClass:(Class)class
348348
method_getReturnType(methods[i], returnType, 2);
349349

350350
if([phase isEqualToString:@"ccPhysicsCollisionBegin"]){
351-
NSAssert(strcmp(returnType, "c") == 0, @"CCPhysicsCollisionBegin delegate methods must return a BOOL.");
351+
NSAssert(strcmp(returnType, @encode(BOOL)) == 0, @"CCPhysicsCollisionBegin delegate methods must return a BOOL.");
352352
[self handlerForTypeA:typeA typeB:typeB].begin = methods[i];
353353
} else if([phase isEqualToString:@"ccPhysicsCollisionPreSolve"]){
354-
NSAssert(strcmp(returnType, "c") == 0, @"CCPhysicsCollisionPreSolve delegate methods must return a BOOL.");
354+
NSAssert(strcmp(returnType, @encode(BOOL)) == 0, @"CCPhysicsCollisionPreSolve delegate methods must return a BOOL.");
355355
[self handlerForTypeA:typeA typeB:typeB].preSolve = methods[i];
356356
} else if([phase isEqualToString:@"ccPhysicsCollisionPostSolve"]){
357357
// TODO check for no return value?

0 commit comments

Comments
 (0)