Skip to content

Commit

Permalink
CORE-1391 fix tests for apple processor macs
Browse files Browse the repository at this point in the history
  • Loading branch information
echo-branch committed May 26, 2021
1 parent af8f3c0 commit 2696ab4
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 11 deletions.
22 changes: 14 additions & 8 deletions Branch-TestBed/Branch-SDK-Tests/BNCDeviceInfoTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ - (void)testBrandName {
}

- (void)testModelName_Simulator {
XCTAssert([@"x86_64" isEqualToString:self.deviceInfo.modelName]);
// intel processor
bool x86_64 = [@"x86_64" isEqualToString:self.deviceInfo.modelName];

// apple processor
bool arm64 = [@"arm64" isEqualToString:self.deviceInfo.modelName];

XCTAssert(x86_64 || arm64);
}

//- (void)testModelName_iPhone7 {
Expand All @@ -59,15 +65,15 @@ - (void)testEnvironment {
}

- (void)testCpuType_Simulator {
NSString *expected = @"7";
XCTAssert([expected isEqualToString:self.deviceInfo.cpuType]);
// intel processors
bool x86 = [@"7" isEqualToString:self.deviceInfo.cpuType];

// apple processors
bool arm = [@"16777228" isEqualToString:self.deviceInfo.cpuType];

XCTAssert(x86 || arm);
}

//- (void)testCpuType_iPhone7 {
// NSString *expected = @"16777228";
// XCTAssert([expected isEqualToString:self.deviceInfo.cpuType]);
//}

- (void)testScreenWidth {
XCTAssert(self.deviceInfo.screenWidth.intValue > 320);
}
Expand Down
24 changes: 21 additions & 3 deletions Branch-TestBed/Branch-SDK-Tests/BNCDeviceSystemTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,30 @@ - (void)testSystemBuildVersion {
}

- (void)testMachine_Simulator {
XCTAssert([@"x86_64" isEqualToString:self.deviceSystem.machine]);
// intel processor
bool x86_64 = [@"x86_64" isEqualToString:self.deviceSystem.machine];

// apple processor
bool arm64 = [@"arm64" isEqualToString:self.deviceSystem.machine];

XCTAssert(x86_64 || arm64);
}

- (void)testCPUType_Simulator {
XCTAssert([@(7) isEqualToNumber:self.deviceSystem.cpuType]);
XCTAssert([@(8) isEqualToNumber:self.deviceSystem.cpuSubType]);
// intel processor
bool x86 = [@(7) isEqualToNumber:self.deviceSystem.cpuType];
bool x86_sub = [@(8) isEqualToNumber:self.deviceSystem.cpuSubType];

// apple processor
bool arm = [@(16777228) isEqualToNumber:self.deviceSystem.cpuType];
bool arm_sub = [@(2) isEqualToNumber:self.deviceSystem.cpuSubType];

XCTAssert(x86 || arm);
if (x86) {
XCTAssert(x86_sub);
} else {
XCTAssert(arm_sub);
}
}

@end

0 comments on commit 2696ab4

Please sign in to comment.