1 // Copyright (c) 2012 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.
5 // Note that while this file is in testing/ and tests GTest macros, it is built
6 // as part of Chromium's unit_tests target because the project does not build
7 // or run GTest's internal test suite.
9 #import "testing/gtest_mac.h"
11 #import <Foundation/Foundation.h>
13 #include "base/mac/scoped_nsautorelease_pool.h"
14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "testing/gtest/include/gtest/internal/gtest-port.h"
17 TEST(GTestMac, ExpectNSEQ) {
18 base::mac::ScopedNSAutoreleasePool pool;
20 EXPECT_NSEQ(@"a", @"a");
22 NSString* s1 = [NSString stringWithUTF8String:"a"];
28 TEST(GTestMac, AssertNSEQ) {
29 base::mac::ScopedNSAutoreleasePool pool;
31 NSString* s1 = [NSString stringWithUTF8String:"a"];
37 TEST(GTestMac, ExpectNSNE) {
38 base::mac::ScopedNSAutoreleasePool pool;
40 EXPECT_NSNE([NSNumber numberWithInt:2], [NSNumber numberWithInt:42]);
43 TEST(GTestMac, AssertNSNE) {
44 base::mac::ScopedNSAutoreleasePool pool;
46 ASSERT_NSNE(@"a", @"b");
49 TEST(GTestMac, ExpectNSNil) {
50 base::mac::ScopedNSAutoreleasePool pool;
52 EXPECT_NSEQ(nil, nil);
53 EXPECT_NSNE(nil, @"a");
54 EXPECT_NSNE(@"a", nil);
56 // TODO(shess): Test that EXPECT_NSNE(nil, nil) fails.
59 #if !defined(GTEST_OS_IOS)
61 TEST(GTestMac, ExpectNSEQRect) {
62 base::mac::ScopedNSAutoreleasePool pool;
64 EXPECT_NSEQ(NSMakeRect(1, 2, 3, 4), NSMakeRect(1, 2, 3, 4));
67 TEST(GTestMac, AssertNSEQRect) {
68 base::mac::ScopedNSAutoreleasePool pool;
70 ASSERT_NSEQ(NSMakeRect(1, 2, 3, 4), NSMakeRect(1, 2, 3, 4));
73 TEST(GTestMac, ExpectNSNERect) {
74 base::mac::ScopedNSAutoreleasePool pool;
76 EXPECT_NSNE(NSMakeRect(1, 2, 3, 4), NSMakeRect(5, 6, 7, 8));
79 TEST(GTestMac, AssertNSNERect) {
80 base::mac::ScopedNSAutoreleasePool pool;
82 ASSERT_NSNE(NSMakeRect(1, 2, 3, 4), NSMakeRect(5, 6, 7, 8));
85 TEST(GTestMac, ExpectNSEQPoint) {
86 base::mac::ScopedNSAutoreleasePool pool;
88 EXPECT_NSEQ(NSMakePoint(1, 2), NSMakePoint(1, 2));
91 TEST(GTestMac, AssertNSEQPoint) {
92 base::mac::ScopedNSAutoreleasePool pool;
94 ASSERT_NSEQ(NSMakePoint(1, 2), NSMakePoint(1, 2));
97 TEST(GTestMac, ExpectNSNEPoint) {
98 base::mac::ScopedNSAutoreleasePool pool;
100 EXPECT_NSNE(NSMakePoint(1, 2), NSMakePoint(3, 4));
103 TEST(GTestMac, AssertNSNEPoint) {
104 base::mac::ScopedNSAutoreleasePool pool;
106 ASSERT_NSNE(NSMakePoint(1, 2), NSMakePoint(3, 4));
109 #endif // !GTEST_OS_IOS