gtest_mac.h 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // Copyright (c) 2010 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef TESTING_GTEST_MAC_H_
  5. #define TESTING_GTEST_MAC_H_
  6. #include "testing/gtest/include/gtest/gtest.h"
  7. #include "third_party/googletest/src/googletest/include/gtest/internal/gtest-port.h"
  8. #ifdef GTEST_OS_MAC
  9. #import <Foundation/Foundation.h>
  10. namespace testing {
  11. namespace internal {
  12. // This overloaded version allows comparison between ObjC objects that conform
  13. // to the NSObject protocol. Used to implement {ASSERT|EXPECT}_NSEQ().
  14. GTEST_API_ AssertionResult CmpHelperNSEQ(const char* expected_expression,
  15. const char* actual_expression,
  16. id<NSObject> expected,
  17. id<NSObject> actual);
  18. // This overloaded version allows comparison between ObjC objects that conform
  19. // to the NSObject protocol. Used to implement {ASSERT|EXPECT}_NSNE().
  20. GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
  21. const char* actual_expression,
  22. id<NSObject> expected,
  23. id<NSObject> actual);
  24. #if !defined(GTEST_OS_IOS)
  25. // This overloaded version allows comparison between NSRect objects using
  26. // NSEqualRects. Used to implement {ASSERT|EXPECT}_NSEQ().
  27. GTEST_API_ AssertionResult CmpHelperNSEQ(const char* expected_expression,
  28. const char* actual_expression,
  29. const NSRect& expected,
  30. const NSRect& actual);
  31. // This overloaded version allows comparison between NSRect objects using
  32. // NSEqualRects. Used to implement {ASSERT|EXPECT}_NSNE().
  33. GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
  34. const char* actual_expression,
  35. const NSRect& expected,
  36. const NSRect& actual);
  37. // This overloaded version allows comparison between NSPoint objects using
  38. // NSEqualPoints. Used to implement {ASSERT|EXPECT}_NSEQ().
  39. GTEST_API_ AssertionResult CmpHelperNSEQ(const char* expected_expression,
  40. const char* actual_expression,
  41. const NSPoint& expected,
  42. const NSPoint& actual);
  43. // This overloaded version allows comparison between NSPoint objects using
  44. // NSEqualPoints. Used to implement {ASSERT|EXPECT}_NSNE().
  45. GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
  46. const char* actual_expression,
  47. const NSPoint& expected,
  48. const NSPoint& actual);
  49. // This overloaded version allows comparison between NSRange objects using
  50. // NSEqualRanges. Used to implement {ASSERT|EXPECT}_NSEQ().
  51. GTEST_API_ AssertionResult CmpHelperNSEQ(const char* expected_expression,
  52. const char* actual_expression,
  53. const NSRange& expected,
  54. const NSRange& actual);
  55. // This overloaded version allows comparison between NSRange objects using
  56. // NSEqualRanges. Used to implement {ASSERT|EXPECT}_NSNE().
  57. GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
  58. const char* actual_expression,
  59. const NSRange& expected,
  60. const NSRange& actual);
  61. #endif // !GTEST_OS_IOS
  62. } // namespace internal
  63. } // namespace testing
  64. // Tests that [expected isEqual:actual].
  65. #define EXPECT_NSEQ(expected, actual) \
  66. EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNSEQ, expected, actual)
  67. #define EXPECT_NSNE(val1, val2) \
  68. EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNSNE, val1, val2)
  69. #define ASSERT_NSEQ(expected, actual) \
  70. ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNSEQ, expected, actual)
  71. #define ASSERT_NSNE(val1, val2) \
  72. ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNSNE, val1, val2)
  73. #endif // GTEST_OS_MAC
  74. #endif // TESTING_GTEST_MAC_H_