Index: base/template_util_unittest.cc |
diff --git a/base/template_util_unittest.cc b/base/template_util_unittest.cc |
index 921596474b6d9a38991506396a1c64148025885d..31808bbde88aa0e4ed4d6ba347ea4b4d9e91bee4 100644 |
--- a/base/template_util_unittest.cc |
+++ b/base/template_util_unittest.cc |
@@ -30,6 +30,22 @@ static_assert(!is_non_const_reference<const int&>::value, |
"IsNonConstReference"); |
static_assert(is_non_const_reference<int&>::value, "IsNonConstReference"); |
+// underlying_number |
+enum ClassicEnum : int { CLASSIC_ENUM_A }; |
+enum class ClassyEnum : int { A }; |
+ |
+static_assert( |
+ std::is_same<decltype(underlying_number(int64_t(10))), int64_t>::value, |
+ "underlying_number: failed to return an integer as its own type."); |
+ |
+static_assert( |
+ std::is_integral<decltype(underlying_number(CLASSIC_ENUM_A))>::value, |
+ "underlying_number: failed to return an unscoped enum as an integer."); |
+ |
+static_assert( |
+ std::is_integral<decltype(underlying_number(ClassyEnum::A))>::value, |
+ "underlying_number: failed to return a scoped enum as an integer."); |
+ |
class AssignParent {}; |
class AssignChild : AssignParent {}; |