blob: 8b6ec3a185fa1a1215c0a3b5f6f42dfc8f6f3959 [file] [log] [blame]
Avi Drissmandfd880852022-09-15 20:11:091// Copyright 2010 The Chromium Authors
[email protected]ecebcc92010-08-06 02:39:262// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef TESTING_GTEST_MAC_H_
6#define TESTING_GTEST_MAC_H_
7
pwnall52e27a32017-05-05 00:44:278#include "testing/gtest/include/gtest/gtest.h"
9#include "third_party/googletest/src/googletest/include/gtest/internal/gtest-port.h"
[email protected]ecebcc92010-08-06 02:39:2610
11#ifdef GTEST_OS_MAC
12
13#import <Foundation/Foundation.h>
14
15namespace testing {
16namespace internal {
17
18// This overloaded version allows comparison between ObjC objects that conform
jackhoub22ade82015-07-01 00:44:3919// to the NSObject protocol. Used to implement {ASSERT|EXPECT}_NSEQ().
[email protected]ecebcc92010-08-06 02:39:2620GTEST_API_ AssertionResult CmpHelperNSEQ(const char* expected_expression,
21 const char* actual_expression,
22 id<NSObject> expected,
23 id<NSObject> actual);
24
25// This overloaded version allows comparison between ObjC objects that conform
jackhoub22ade82015-07-01 00:44:3926// to the NSObject protocol. Used to implement {ASSERT|EXPECT}_NSNE().
[email protected]ecebcc92010-08-06 02:39:2627GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
28 const char* actual_expression,
29 id<NSObject> expected,
30 id<NSObject> actual);
31
jackhoub22ade82015-07-01 00:44:3932#if !defined(GTEST_OS_IOS)
33
34// This overloaded version allows comparison between NSRect objects using
35// NSEqualRects. Used to implement {ASSERT|EXPECT}_NSEQ().
36GTEST_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().
43GTEST_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().
50GTEST_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().
57GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
58 const char* actual_expression,
59 const NSPoint& expected,
60 const NSPoint& actual);
61
Elly Fong-Jones96e8b3f82019-02-27 21:41:5362// This overloaded version allows comparison between NSRange objects using
63// NSEqualRanges. Used to implement {ASSERT|EXPECT}_NSEQ().
64GTEST_API_ AssertionResult CmpHelperNSEQ(const char* expected_expression,
65 const char* actual_expression,
66 const NSRange& expected,
67 const NSRange& actual);
68
69// This overloaded version allows comparison between NSRange objects using
70// NSEqualRanges. Used to implement {ASSERT|EXPECT}_NSNE().
71GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
72 const char* actual_expression,
73 const NSRange& expected,
74 const NSRange& actual);
75
jackhoub22ade82015-07-01 00:44:3976#endif // !GTEST_OS_IOS
77
[email protected]ecebcc92010-08-06 02:39:2678} // namespace internal
79} // namespace testing
80
81// Tests that [expected isEqual:actual].
82#define EXPECT_NSEQ(expected, actual) \
83 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNSEQ, expected, actual)
84#define EXPECT_NSNE(val1, val2) \
85 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNSNE, val1, val2)
86
87#define ASSERT_NSEQ(expected, actual) \
88 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNSEQ, expected, actual)
89#define ASSERT_NSNE(val1, val2) \
90 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNSNE, val1, val2)
91
[email protected]ecebcc92010-08-06 02:39:2692#endif // GTEST_OS_MAC
93
94#endif // TESTING_GTEST_MAC_H_