Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: testing/gtest_mac.h

Issue 1211283003: Overload EXPECT_NSEQ to handle NSRect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also handle NSPoint. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | testing/gtest_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef TESTING_GTEST_MAC_H_ 5 #ifndef TESTING_GTEST_MAC_H_
6 #define TESTING_GTEST_MAC_H_ 6 #define TESTING_GTEST_MAC_H_
7 7
8 #include <gtest/internal/gtest-port.h> 8 #include <gtest/internal/gtest-port.h>
9 #include <gtest/gtest.h> 9 #include <gtest/gtest.h>
10 10
11 #ifdef GTEST_OS_MAC 11 #ifdef GTEST_OS_MAC
12 12
13 #import <Foundation/Foundation.h> 13 #import <Foundation/Foundation.h>
14 14
15 namespace testing { 15 namespace testing {
16 namespace internal { 16 namespace internal {
17 17
18 // This overloaded version allows comparison between ObjC objects that conform 18 // This overloaded version allows comparison between ObjC objects that conform
19 // to the NSObject protocol. Used to implement {ASSERT|EXPECT}_EQ(). 19 // to the NSObject protocol. Used to implement {ASSERT|EXPECT}_NSEQ().
20 GTEST_API_ AssertionResult CmpHelperNSEQ(const char* expected_expression, 20 GTEST_API_ AssertionResult CmpHelperNSEQ(const char* expected_expression,
21 const char* actual_expression, 21 const char* actual_expression,
22 id<NSObject> expected, 22 id<NSObject> expected,
23 id<NSObject> actual); 23 id<NSObject> actual);
24 24
25 // This overloaded version allows comparison between ObjC objects that conform 25 // This overloaded version allows comparison between ObjC objects that conform
26 // to the NSObject protocol. Used to implement {ASSERT|EXPECT}_NE(). 26 // to the NSObject protocol. Used to implement {ASSERT|EXPECT}_NSNE().
27 GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression, 27 GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
28 const char* actual_expression, 28 const char* actual_expression,
29 id<NSObject> expected, 29 id<NSObject> expected,
30 id<NSObject> actual); 30 id<NSObject> actual);
31 31
32 #if !defined(GTEST_OS_IOS)
33
34 // This overloaded version allows comparison between NSRect objects using
35 // NSEqualRects. Used to implement {ASSERT|EXPECT}_NSEQ().
36 GTEST_API_ AssertionResult CmpHelperNSEQ(const char* expected_expression,
37 const char* actual_expression,
38 const NSRect& expected,
39 const NSRect& actual);
40
41 // This overloaded version allows comparison between NSRect objects using
42 // NSEqualRects. Used to implement {ASSERT|EXPECT}_NSNE().
43 GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
44 const char* actual_expression,
45 const NSRect& expected,
46 const NSRect& actual);
47
48 // This overloaded version allows comparison between NSPoint objects using
49 // NSEqualPoints. Used to implement {ASSERT|EXPECT}_NSEQ().
50 GTEST_API_ AssertionResult CmpHelperNSEQ(const char* expected_expression,
51 const char* actual_expression,
52 const NSPoint& expected,
53 const NSPoint& actual);
54
55 // This overloaded version allows comparison between NSPoint objects using
56 // NSEqualPoints. Used to implement {ASSERT|EXPECT}_NSNE().
57 GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
58 const char* actual_expression,
59 const NSPoint& expected,
60 const NSPoint& actual);
61
62 #endif // !GTEST_OS_IOS
63
32 } // namespace internal 64 } // namespace internal
33 } // namespace testing 65 } // namespace testing
34 66
35 // Tests that [expected isEqual:actual]. 67 // Tests that [expected isEqual:actual].
36 #define EXPECT_NSEQ(expected, actual) \ 68 #define EXPECT_NSEQ(expected, actual) \
37 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNSEQ, expected, actual) 69 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNSEQ, expected, actual)
38 #define EXPECT_NSNE(val1, val2) \ 70 #define EXPECT_NSNE(val1, val2) \
39 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNSNE, val1, val2) 71 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNSNE, val1, val2)
40 72
41 #define ASSERT_NSEQ(expected, actual) \ 73 #define ASSERT_NSEQ(expected, actual) \
42 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNSEQ, expected, actual) 74 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNSEQ, expected, actual)
43 #define ASSERT_NSNE(val1, val2) \ 75 #define ASSERT_NSNE(val1, val2) \
44 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNSNE, val1, val2) 76 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNSNE, val1, val2)
45 77
46 #endif // GTEST_OS_MAC 78 #endif // GTEST_OS_MAC
47 79
48 #endif // TESTING_GTEST_MAC_H_ 80 #endif // TESTING_GTEST_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | testing/gtest_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698