• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <gtest/internal/gtest-port.h>
7 #include <gtest/gtest.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 #endif  // !GTEST_OS_IOS
50 }  // namespace internal
51 }  // namespace testing
52 // Tests that [expected isEqual:actual].
53 #define EXPECT_NSEQ(expected, actual) \
54   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNSEQ, expected, actual)
55 #define EXPECT_NSNE(val1, val2) \
56   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNSNE, val1, val2)
57 #define ASSERT_NSEQ(expected, actual) \
58   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNSEQ, expected, actual)
59 #define ASSERT_NSNE(val1, val2) \
60   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNSNE, val1, val2)
61 #endif  // GTEST_OS_MAC
62 #endif  // TESTING_GTEST_MAC_H_
63