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

Side by Side Diff: base/optional_unittest.cc

Issue 2792183003: Remove base::is_trivially_destructible and use the standard library. (Closed)
Patch Set: triviallydestruct: rm-tests Created 3 years, 8 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 | « base/optional.h ('k') | base/template_util.h » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "base/optional.h" 5 #include "base/optional.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 void swap(TestObject& lhs, TestObject& rhs) { 82 void swap(TestObject& lhs, TestObject& rhs) {
83 lhs.Swap(&rhs); 83 lhs.Swap(&rhs);
84 } 84 }
85 85
86 class NonTriviallyDestructible { 86 class NonTriviallyDestructible {
87 ~NonTriviallyDestructible() {} 87 ~NonTriviallyDestructible() {}
88 }; 88 };
89 89
90 } // anonymous namespace 90 } // anonymous namespace
91 91
92 static_assert(is_trivially_destructible<Optional<int>>::value, 92 static_assert(std::is_trivially_destructible<Optional<int>>::value,
93 "OptionalIsTriviallyDestructible"); 93 "OptionalIsTriviallyDestructible");
94 94
95 static_assert( 95 static_assert(
96 !is_trivially_destructible<Optional<NonTriviallyDestructible>>::value, 96 !std::is_trivially_destructible<Optional<NonTriviallyDestructible>>::value,
97 "OptionalIsTriviallyDestructible"); 97 "OptionalIsTriviallyDestructible");
98 98
99 TEST(OptionalTest, DefaultConstructor) { 99 TEST(OptionalTest, DefaultConstructor) {
100 { 100 {
101 constexpr Optional<float> o; 101 constexpr Optional<float> o;
102 EXPECT_FALSE(o); 102 EXPECT_FALSE(o);
103 } 103 }
104 104
105 { 105 {
106 Optional<std::string> o; 106 Optional<std::string> o;
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 1337
1338 TEST(OptionalTest, Reset_NoOp) { 1338 TEST(OptionalTest, Reset_NoOp) {
1339 Optional<int> a; 1339 Optional<int> a;
1340 EXPECT_FALSE(a.has_value()); 1340 EXPECT_FALSE(a.has_value());
1341 1341
1342 a.reset(); 1342 a.reset();
1343 EXPECT_FALSE(a.has_value()); 1343 EXPECT_FALSE(a.has_value());
1344 } 1344 }
1345 1345
1346 } // namespace base 1346 } // namespace base
OLDNEW
« no previous file with comments | « base/optional.h ('k') | base/template_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698