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

Side by Side Diff: test/unittests/base/logging-unittest.cc

Issue 2586203002: Fix memory leak in logging-unittest. (Closed)
Patch Set: Created 4 years 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project 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 #include <cstdint> 5 #include <cstdint>
6 6
7 #include "src/base/logging.h" 7 #include "src/base/logging.h"
8 #include "src/objects.h" 8 #include "src/objects.h"
9 #include "testing/gtest-support.h" 9 #include "testing/gtest-support.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace base { 12 namespace base {
13 13
14 namespace { 14 namespace {
15 15
16 #define CHECK_SUCCEED(NAME, lhs, rhs) \ 16 #define CHECK_SUCCEED(NAME, lhs, rhs) \
17 { \ 17 { \
18 std::string* error_message = \ 18 std::string* error_message = \
19 Check##NAME##Impl<decltype(lhs), decltype(rhs)>((lhs), (rhs), ""); \ 19 Check##NAME##Impl<decltype(lhs), decltype(rhs)>((lhs), (rhs), ""); \
20 EXPECT_EQ(nullptr, error_message); \ 20 EXPECT_EQ(nullptr, error_message); \
21 } 21 }
22 22
23 #define CHECK_FAIL(NAME, lhs, rhs) \ 23 #define CHECK_FAIL(NAME, lhs, rhs) \
24 { \ 24 { \
25 std::string* error_message = \ 25 std::string* error_message = \
26 Check##NAME##Impl<decltype(lhs), decltype(rhs)>((lhs), (rhs), ""); \ 26 Check##NAME##Impl<decltype(lhs), decltype(rhs)>((lhs), (rhs), ""); \
27 EXPECT_NE(nullptr, error_message); \ 27 EXPECT_NE(nullptr, error_message); \
28 delete error_message; \
28 } 29 }
29 30
30 } // namespace 31 } // namespace
31 32
32 TEST(LoggingTest, CheckEQImpl) { 33 TEST(LoggingTest, CheckEQImpl) {
33 CHECK_SUCCEED(EQ, 0.0, 0.0) 34 CHECK_SUCCEED(EQ, 0.0, 0.0)
34 CHECK_SUCCEED(EQ, 0.0, -0.0) 35 CHECK_SUCCEED(EQ, 0.0, -0.0)
35 CHECK_SUCCEED(EQ, -0.0, 0.0) 36 CHECK_SUCCEED(EQ, -0.0, 0.0)
36 CHECK_SUCCEED(EQ, -0.0, -0.0) 37 CHECK_SUCCEED(EQ, -0.0, -0.0)
37 } 38 }
(...skipping 19 matching lines...) Expand all
57 } 58 }
58 59
59 TEST(LoggingTest, CompareAgainstStaticConstPointer) { 60 TEST(LoggingTest, CompareAgainstStaticConstPointer) {
60 // These used to produce link errors before http://crrev.com/2524093002. 61 // These used to produce link errors before http://crrev.com/2524093002.
61 CHECK_FAIL(EQ, v8::internal::Smi::kZero, v8::internal::Smi::FromInt(17)); 62 CHECK_FAIL(EQ, v8::internal::Smi::kZero, v8::internal::Smi::FromInt(17));
62 CHECK_SUCCEED(GT, 0, v8::internal::Smi::kMinValue); 63 CHECK_SUCCEED(GT, 0, v8::internal::Smi::kMinValue);
63 } 64 }
64 65
65 } // namespace base 66 } // namespace base
66 } // namespace v8 67 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698