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

Side by Side Diff: base/template_util_unittest.cc

Issue 2261793002: Bring the feedback button to the Mac sad tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Trybots caught this, but not the local presubmit check. Will investigate. Created 4 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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/template_util.h" 5 #include "base/template_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 12 matching lines...) Expand all
23 std::ostream& operator<<(std::ostream& os, const StructWithOperator& v) { 23 std::ostream& operator<<(std::ostream& os, const StructWithOperator& v) {
24 return os; 24 return os;
25 } 25 }
26 26
27 // is_non_const_reference<Type> 27 // is_non_const_reference<Type>
28 static_assert(!is_non_const_reference<int>::value, "IsNonConstReference"); 28 static_assert(!is_non_const_reference<int>::value, "IsNonConstReference");
29 static_assert(!is_non_const_reference<const int&>::value, 29 static_assert(!is_non_const_reference<const int&>::value,
30 "IsNonConstReference"); 30 "IsNonConstReference");
31 static_assert(is_non_const_reference<int&>::value, "IsNonConstReference"); 31 static_assert(is_non_const_reference<int&>::value, "IsNonConstReference");
32 32
33 // underlying_value
34 enum ClassicEnum : int { CLASSIC_ENUM_A };
35 enum class ClassyEnum : int { A };
36
37 struct Uncopyable {
38 // Uncopyable() = default;
Nico 2016/08/30 21:11:11 ?
Sidney San Martín 2016/08/30 21:24:32 Thanks, missed that. Done.
39 Uncopyable(Uncopyable&&) = default;
40 Uncopyable(const Uncopyable&) = delete;
41 };
42
43 static_assert(
44 std::is_same<decltype(underlying_value(Uncopyable{})), Uncopyable>::value,
45 "underlying_value: failed to return an object without copying.");
46
47 static_assert(
48 std::is_same<decltype(underlying_value(int64_t(10))), int64_t>::value,
49 "underlying_value: failed to return an integer as its own type.");
50
51 static_assert(
52 std::is_integral<decltype(underlying_value(CLASSIC_ENUM_A))>::value,
53 "underlying_value: failed to return an unscoped enum as an integer.");
54
55 static_assert(
56 std::is_integral<decltype(underlying_value(ClassyEnum::A))>::value,
57 "underlying_value: failed to return a scoped enum as an integer.");
58
33 class AssignParent {}; 59 class AssignParent {};
34 class AssignChild : AssignParent {}; 60 class AssignChild : AssignParent {};
35 61
36 // is_assignable<Type1, Type2> 62 // is_assignable<Type1, Type2>
37 static_assert(!is_assignable<int, int>::value, "IsAssignable"); // 1 = 1; 63 static_assert(!is_assignable<int, int>::value, "IsAssignable"); // 1 = 1;
38 static_assert(!is_assignable<int, double>::value, "IsAssignable"); 64 static_assert(!is_assignable<int, double>::value, "IsAssignable");
39 static_assert(is_assignable<int&, int>::value, "IsAssignable"); 65 static_assert(is_assignable<int&, int>::value, "IsAssignable");
40 static_assert(is_assignable<int&, double>::value, "IsAssignable"); 66 static_assert(is_assignable<int&, double>::value, "IsAssignable");
41 static_assert(is_assignable<int&, int&>::value, "IsAssignable"); 67 static_assert(is_assignable<int&, int&>::value, "IsAssignable");
42 static_assert(is_assignable<int&, int const&>::value, "IsAssignable"); 68 static_assert(is_assignable<int&, int const&>::value, "IsAssignable");
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 }; 146 };
121 147
122 static_assert(is_trivially_destructible<int>::value, "IsTriviallyDestructible"); 148 static_assert(is_trivially_destructible<int>::value, "IsTriviallyDestructible");
123 static_assert(is_trivially_destructible<TriviallyDestructible>::value, 149 static_assert(is_trivially_destructible<TriviallyDestructible>::value,
124 "IsTriviallyDestructible"); 150 "IsTriviallyDestructible");
125 static_assert(!is_trivially_destructible<NonTriviallyDestructible>::value, 151 static_assert(!is_trivially_destructible<NonTriviallyDestructible>::value,
126 "IsTriviallyDestructible"); 152 "IsTriviallyDestructible");
127 153
128 } // namespace 154 } // namespace
129 } // namespace base 155 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698