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

Side by Side Diff: base/template_util_unittest.cc

Issue 2790403003: Remove base::is_*assignable as these are now in the linux sysroot. (Closed)
Patch Set: isassign: removed-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/template_util.h ('k') | 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 (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 class AssignParent {};
34 class AssignChild : AssignParent {};
35
36 // is_assignable<Type1, Type2>
37 static_assert(!is_assignable<int, int>::value, "IsAssignable"); // 1 = 1;
38 static_assert(!is_assignable<int, double>::value, "IsAssignable");
39 static_assert(is_assignable<int&, int>::value, "IsAssignable");
40 static_assert(is_assignable<int&, double>::value, "IsAssignable");
41 static_assert(is_assignable<int&, int&>::value, "IsAssignable");
42 static_assert(is_assignable<int&, int const&>::value, "IsAssignable");
43 static_assert(!is_assignable<int const&, int>::value, "IsAssignable");
44 static_assert(!is_assignable<AssignParent&, AssignChild>::value,
45 "IsAssignable");
46 static_assert(!is_assignable<AssignChild&, AssignParent>::value,
47 "IsAssignable");
48
49 struct AssignCopy {};
50 struct AssignNoCopy {
51 AssignNoCopy& operator=(AssignNoCopy&&) { return *this; }
52 AssignNoCopy& operator=(const AssignNoCopy&) = delete;
53 };
54 struct AssignNoMove {
55 AssignNoMove& operator=(AssignNoMove&&) = delete;
56 AssignNoMove& operator=(const AssignNoMove&) = delete;
57 };
58
59 static_assert(is_copy_assignable<AssignCopy>::value, "IsCopyAssignable");
60 static_assert(!is_copy_assignable<AssignNoCopy>::value, "IsCopyAssignable");
61
62 static_assert(is_move_assignable<AssignCopy>::value, "IsMoveAssignable");
63 static_assert(is_move_assignable<AssignNoCopy>::value, "IsMoveAssignable");
64 static_assert(!is_move_assignable<AssignNoMove>::value, "IsMoveAssignable");
65
66 // A few standard types that definitely support printing. 33 // A few standard types that definitely support printing.
67 static_assert(internal::SupportsOstreamOperator<int>::value, 34 static_assert(internal::SupportsOstreamOperator<int>::value,
68 "ints should be printable"); 35 "ints should be printable");
69 static_assert(internal::SupportsOstreamOperator<const char*>::value, 36 static_assert(internal::SupportsOstreamOperator<const char*>::value,
70 "C strings should be printable"); 37 "C strings should be printable");
71 static_assert(internal::SupportsOstreamOperator<std::string>::value, 38 static_assert(internal::SupportsOstreamOperator<std::string>::value,
72 "std::string should be printable"); 39 "std::string should be printable");
73 40
74 // Various kinds of enums operator<< support. 41 // Various kinds of enums operator<< support.
75 static_assert(internal::SupportsOstreamOperator<SimpleEnum>::value, 42 static_assert(internal::SupportsOstreamOperator<SimpleEnum>::value,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 }; 87 };
121 88
122 static_assert(is_trivially_destructible<int>::value, "IsTriviallyDestructible"); 89 static_assert(is_trivially_destructible<int>::value, "IsTriviallyDestructible");
123 static_assert(is_trivially_destructible<TriviallyDestructible>::value, 90 static_assert(is_trivially_destructible<TriviallyDestructible>::value,
124 "IsTriviallyDestructible"); 91 "IsTriviallyDestructible");
125 static_assert(!is_trivially_destructible<NonTriviallyDestructible>::value, 92 static_assert(!is_trivially_destructible<NonTriviallyDestructible>::value,
126 "IsTriviallyDestructible"); 93 "IsTriviallyDestructible");
127 94
128 } // namespace 95 } // namespace
129 } // namespace base 96 } // namespace base
OLDNEW
« no previous file with comments | « base/template_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698