/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. #define typeof __typeof__ // fixes http://www.brethorsting.com/blog/2006/02/stupid-issue-with-ocunit.html
  16. #import <SenTestingKit/SenTestingKit.h>
  17. #import "GDataFramework.h"
  18. @interface GDataFrameworkTest : SenTestCase
  19. @end
  20. @implementation GDataFrameworkTest
  21. - (void)testFrameworkVersion {
  22. NSUInteger major = NSUIntegerMax;
  23. NSUInteger minor = NSUIntegerMax;
  24. NSUInteger release = NSUIntegerMax;
  25. GDataFrameworkVersion(&major, &minor, &release);
  26. STAssertTrue(major != NSUIntegerMax, @"version unset");
  27. STAssertTrue(minor != NSUIntegerMax, @"version unset");
  28. STAssertTrue(release != NSUIntegerMax, @"version unset");
  29. // Check that the Framework bundle's Info.plist has the proper version,
  30. // matching the GDataFrameworkVersion call
  31. //
  32. // Note: we're assuming that the current directory when this unit
  33. // test runs is the framework's Source directory/
  34. NSString *plistPath = @"Resources/GDataFramework-Info.plist";
  35. NSDictionary *infoDict = [NSDictionary dictionaryWithContentsOfFile:plistPath];
  36. STAssertNotNil(infoDict, @"Could not find GDataFramework-Info.plist");
  37. if (infoDict) {
  38. NSString *binaryVersionStr = GDataFrameworkVersionString();
  39. NSString *plistVersionStr = [infoDict valueForKey:@"CFBundleVersion"];
  40. STAssertEqualObjects(plistVersionStr, binaryVersionStr,
  41. @"Binary/plist version mismatch");
  42. }
  43. }
  44. @end