/core/externals/google-toolbox-for-mac/DebugUtils/GTMMethodCheckTest.m

http://macfuse.googlecode.com/ · Objective C · 54 lines · 25 code · 9 blank · 20 comment · 0 complexity · 48b8ed9a998a7193be5424ef0363b338 MD5 · raw file

  1. //
  2. // GTMMethodCheckTest.m
  3. // Copyright 2006-2008 Google Inc.
  4. //
  5. // Licensed under the Apache License, Version 2.0 (the "License"); you may not
  6. // use this file except in compliance with the License. You may obtain a copy
  7. // of the License at
  8. //
  9. // http://www.apache.org/licenses/LICENSE-2.0
  10. //
  11. // Unless required by applicable law or agreed to in writing, software
  12. // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  13. // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  14. // License for the specific language governing permissions and limitations under
  15. // the License.
  16. //
  17. #import "GTMSenTestCase.h"
  18. #import "GTMMethodCheck.h"
  19. static BOOL gTestCheckVar = NO;
  20. @interface GTMMethodCheckTest : GTMTestCase
  21. + (void)GTMMethodCheckTestClassMethod;
  22. - (void)GTMMethodCheckTestMethod;
  23. @end
  24. @implementation GTMMethodCheckTest
  25. GTM_METHOD_CHECK(GTMMethodCheckTest, GTMMethodCheckTestMethod);
  26. GTM_METHOD_CHECK(GTMMethodCheckTest, GTMMethodCheckTestClassMethod);
  27. - (void)GTMMethodCheckTestMethod {
  28. }
  29. + (void)GTMMethodCheckTestClassMethod {
  30. }
  31. + (void)xxGTMMethodCheckMethodTestCheck {
  32. // This gets called because of its special name by GMMethodCheck
  33. // Look at the Macros in GMMethodCheck.h for details.
  34. gTestCheckVar = YES;
  35. }
  36. - (void)testGTMMethodCheck {
  37. #ifdef DEBUG
  38. // GTMMethodCheck only runs in debug
  39. STAssertTrue(gTestCheckVar, @"Should be true");
  40. #endif
  41. // Next two calls just verify our code coverage
  42. [self GTMMethodCheckTestMethod];
  43. [[self class] GTMMethodCheckTestClassMethod];
  44. }
  45. @end