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

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: Ditch a pointless |explicit|, add a comment on SadTabView ownership. 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(Uncopyable&&) = default;
39 Uncopyable(const Uncopyable&) = delete;
40 };
41
42 static_assert(
43 std::is_same<decltype(underlying_value(Uncopyable{})), Uncopyable>::value,
44 "underlying_value: failed to return an object without copying.");
45
46 static_assert(
47 std::is_same<decltype(underlying_value(int64_t(10))), int64_t>::value,
48 "underlying_value: failed to return an integer as its own type.");
49
50 static_assert(
51 std::is_integral<decltype(underlying_value(CLASSIC_ENUM_A))>::value,
52 "underlying_value: failed to return an unscoped enum as an integer.");
53
54 static_assert(
55 std::is_integral<decltype(underlying_value(ClassyEnum::A))>::value,
56 "underlying_value: failed to return a scoped enum as an integer.");
57
33 class AssignParent {}; 58 class AssignParent {};
34 class AssignChild : AssignParent {}; 59 class AssignChild : AssignParent {};
35 60
36 // is_assignable<Type1, Type2> 61 // is_assignable<Type1, Type2>
37 static_assert(!is_assignable<int, int>::value, "IsAssignable"); // 1 = 1; 62 static_assert(!is_assignable<int, int>::value, "IsAssignable"); // 1 = 1;
38 static_assert(!is_assignable<int, double>::value, "IsAssignable"); 63 static_assert(!is_assignable<int, double>::value, "IsAssignable");
39 static_assert(is_assignable<int&, int>::value, "IsAssignable"); 64 static_assert(is_assignable<int&, int>::value, "IsAssignable");
40 static_assert(is_assignable<int&, double>::value, "IsAssignable"); 65 static_assert(is_assignable<int&, double>::value, "IsAssignable");
41 static_assert(is_assignable<int&, int&>::value, "IsAssignable"); 66 static_assert(is_assignable<int&, int&>::value, "IsAssignable");
42 static_assert(is_assignable<int&, int const&>::value, "IsAssignable"); 67 static_assert(is_assignable<int&, int const&>::value, "IsAssignable");
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 }; 145 };
121 146
122 static_assert(is_trivially_destructible<int>::value, "IsTriviallyDestructible"); 147 static_assert(is_trivially_destructible<int>::value, "IsTriviallyDestructible");
123 static_assert(is_trivially_destructible<TriviallyDestructible>::value, 148 static_assert(is_trivially_destructible<TriviallyDestructible>::value,
124 "IsTriviallyDestructible"); 149 "IsTriviallyDestructible");
125 static_assert(!is_trivially_destructible<NonTriviallyDestructible>::value, 150 static_assert(!is_trivially_destructible<NonTriviallyDestructible>::value,
126 "IsTriviallyDestructible"); 151 "IsTriviallyDestructible");
127 152
128 } // namespace 153 } // namespace
129 } // namespace base 154 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698