0
Files
src/testing/gtest_mac.h
Avi Drissman dfd8808526 Update copyright headers in testing/, tools/
The methodology used to generate this CL is documented in
https://crbug.com/1098010#c95.

No-Try: true
No-Presubmit: true
Bug: 1098010
Change-Id: I3a8a7b150e7bd64690534727150646081df50439
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3900697
Reviewed-by: Mark Mentovai <mark@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1047644}
2022-09-15 20:11:09 +00:00

95 lines
4.3 KiB
Objective-C

// Copyright 2010 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef TESTING_GTEST_MAC_H_
#define TESTING_GTEST_MAC_H_
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/googletest/src/googletest/include/gtest/internal/gtest-port.h"
#ifdef GTEST_OS_MAC
#import <Foundation/Foundation.h>
namespace testing {
namespace internal {
// This overloaded version allows comparison between ObjC objects that conform
// to the NSObject protocol. Used to implement {ASSERT|EXPECT}_NSEQ().
GTEST_API_ AssertionResult CmpHelperNSEQ(const char* expected_expression,
const char* actual_expression,
id<NSObject> expected,
id<NSObject> actual);
// This overloaded version allows comparison between ObjC objects that conform
// to the NSObject protocol. Used to implement {ASSERT|EXPECT}_NSNE().
GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
const char* actual_expression,
id<NSObject> expected,
id<NSObject> actual);
#if !defined(GTEST_OS_IOS)
// This overloaded version allows comparison between NSRect objects using
// NSEqualRects. Used to implement {ASSERT|EXPECT}_NSEQ().
GTEST_API_ AssertionResult CmpHelperNSEQ(const char* expected_expression,
const char* actual_expression,
const NSRect& expected,
const NSRect& actual);
// This overloaded version allows comparison between NSRect objects using
// NSEqualRects. Used to implement {ASSERT|EXPECT}_NSNE().
GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
const char* actual_expression,
const NSRect& expected,
const NSRect& actual);
// This overloaded version allows comparison between NSPoint objects using
// NSEqualPoints. Used to implement {ASSERT|EXPECT}_NSEQ().
GTEST_API_ AssertionResult CmpHelperNSEQ(const char* expected_expression,
const char* actual_expression,
const NSPoint& expected,
const NSPoint& actual);
// This overloaded version allows comparison between NSPoint objects using
// NSEqualPoints. Used to implement {ASSERT|EXPECT}_NSNE().
GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
const char* actual_expression,
const NSPoint& expected,
const NSPoint& actual);
// This overloaded version allows comparison between NSRange objects using
// NSEqualRanges. Used to implement {ASSERT|EXPECT}_NSEQ().
GTEST_API_ AssertionResult CmpHelperNSEQ(const char* expected_expression,
const char* actual_expression,
const NSRange& expected,
const NSRange& actual);
// This overloaded version allows comparison between NSRange objects using
// NSEqualRanges. Used to implement {ASSERT|EXPECT}_NSNE().
GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
const char* actual_expression,
const NSRange& expected,
const NSRange& actual);
#endif // !GTEST_OS_IOS
} // namespace internal
} // namespace testing
// Tests that [expected isEqual:actual].
#define EXPECT_NSEQ(expected, actual) \
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNSEQ, expected, actual)
#define EXPECT_NSNE(val1, val2) \
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNSNE, val1, val2)
#define ASSERT_NSEQ(expected, actual) \
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNSEQ, expected, actual)
#define ASSERT_NSNE(val1, val2) \
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNSNE, val1, val2)
#endif // GTEST_OS_MAC
#endif // TESTING_GTEST_MAC_H_