PageRenderTime 52ms CodeModel.GetById 30ms app.highlight 18ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/update-engine/externals/gdata-objectivec-client/Source/Tests/GDataFrameworkTest.m

http://macfuse.googlecode.com/
Objective C | 60 lines | 25 code | 16 blank | 19 comment | 4 complexity | d41f3c173d57e9e9a6ff2f19b3fc5d7d MD5 | raw file
 1/* Copyright (c) 2007 Google Inc.
 2*
 3* Licensed under the Apache License, Version 2.0 (the "License");
 4* you may not use this file except in compliance with the License.
 5* You may obtain a copy of the License at
 6*
 7*     http://www.apache.org/licenses/LICENSE-2.0
 8*
 9* Unless required by applicable law or agreed to in writing, software
10* distributed under the License is distributed on an "AS IS" BASIS,
11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12* See the License for the specific language governing permissions and
13* limitations under the License.
14*/
15
16#define typeof __typeof__ // fixes http://www.brethorsting.com/blog/2006/02/stupid-issue-with-ocunit.html
17
18#import <SenTestingKit/SenTestingKit.h>
19
20#import "GDataFramework.h"
21
22@interface GDataFrameworkTest : SenTestCase
23@end
24
25@implementation GDataFrameworkTest
26
27- (void)testFrameworkVersion {
28  
29  NSUInteger major = NSUIntegerMax;
30  NSUInteger minor = NSUIntegerMax;
31  NSUInteger release = NSUIntegerMax;
32  
33  GDataFrameworkVersion(&major, &minor, &release);
34
35  STAssertTrue(major != NSUIntegerMax, @"version unset");
36  STAssertTrue(minor != NSUIntegerMax, @"version unset");
37  STAssertTrue(release != NSUIntegerMax, @"version unset");
38  
39  // Check that the Framework bundle's Info.plist has the proper version,
40  // matching the GDataFrameworkVersion call
41  //
42  // Note: we're assuming that the current directory when this unit
43  // test runs is the framework's Source directory/
44
45  NSString *plistPath = @"Resources/GDataFramework-Info.plist";
46  NSDictionary *infoDict = [NSDictionary dictionaryWithContentsOfFile:plistPath];
47  STAssertNotNil(infoDict, @"Could not find GDataFramework-Info.plist");
48  
49  if (infoDict) {
50    
51    NSString *binaryVersionStr = GDataFrameworkVersionString();
52    
53    NSString *plistVersionStr = [infoDict valueForKey:@"CFBundleVersion"];
54
55    STAssertEqualObjects(plistVersionStr, binaryVersionStr, 
56                         @"Binary/plist version mismatch");
57  }
58}
59
60@end