aboutsummaryrefslogtreecommitdiff
path: root/Foundation/GTMSystemVersionTest.m
diff options
context:
space:
mode:
Diffstat (limited to 'Foundation/GTMSystemVersionTest.m')
-rw-r--r--Foundation/GTMSystemVersionTest.m26
1 files changed, 26 insertions, 0 deletions
diff --git a/Foundation/GTMSystemVersionTest.m b/Foundation/GTMSystemVersionTest.m
index b881233..42a1b77 100644
--- a/Foundation/GTMSystemVersionTest.m
+++ b/Foundation/GTMSystemVersionTest.m
@@ -90,4 +90,30 @@
XCTAssertTrue([GTMSystemVersion isBuildLessThan:largeVersion]);
}
+
+#ifdef GTM_MACOS_SDK
+- (void)testMacOSVersion {
+ SInt32 major = -1;
+ SInt32 minor = -1;
+ SInt32 bugfix = -1;
+
+ [GTMSystemVersion getMajor:&major minor:&minor bugFix:&bugfix];
+ NSDictionary *versionPlistContents =
+ [NSDictionary dictionaryWithContentsOfFile:
+ @"/System/Library/CoreServices/SystemVersion.plist"];
+ XCTAssertNotNil(versionPlistContents);
+ NSString *version =
+ [versionPlistContents objectForKey:@"ProductVersion"];
+ XCTAssertNotNil(version);
+ NSArray *pieces = [version componentsSeparatedByString:@"."];
+ XCTAssertTrue([pieces count] > 2);
+ XCTAssertEqual(major, (SInt32)[[pieces objectAtIndex:0] integerValue]);
+ XCTAssertEqual(minor, [[pieces objectAtIndex:1] integerValue]);
+ if ([pieces count] > 2) {
+ XCTAssertEqual(bugfix, [[pieces objectAtIndex:2] integerValue]);
+ } else {
+ XCTAssertEqual(bugfix, 0, @"possible beta OS");
+ }
+}
+#endif
@end