Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <type_traits>
00016
00017 #include "absl/base/internal/inline_variable.h"
00018 #include "absl/base/internal/inline_variable_testing.h"
00019
00020 #include "gtest/gtest.h"
00021
00022 namespace absl {
00023 namespace inline_variable_testing_internal {
00024 namespace {
00025
00026 TEST(InlineVariableTest, Constexpr) {
00027 static_assert(inline_variable_foo.value == 5, "");
00028 static_assert(other_inline_variable_foo.value == 5, "");
00029 static_assert(inline_variable_int == 5, "");
00030 static_assert(other_inline_variable_int == 5, "");
00031 }
00032
00033 TEST(InlineVariableTest, DefaultConstructedIdentityEquality) {
00034 EXPECT_EQ(get_foo_a().value, 5);
00035 EXPECT_EQ(get_foo_b().value, 5);
00036 EXPECT_EQ(&get_foo_a(), &get_foo_b());
00037 }
00038
00039 TEST(InlineVariableTest, DefaultConstructedIdentityInequality) {
00040 EXPECT_NE(&inline_variable_foo, &other_inline_variable_foo);
00041 }
00042
00043 TEST(InlineVariableTest, InitializedIdentityEquality) {
00044 EXPECT_EQ(get_int_a(), 5);
00045 EXPECT_EQ(get_int_b(), 5);
00046 EXPECT_EQ(&get_int_a(), &get_int_b());
00047 }
00048
00049 TEST(InlineVariableTest, InitializedIdentityInequality) {
00050 EXPECT_NE(&inline_variable_int, &other_inline_variable_int);
00051 }
00052
00053 TEST(InlineVariableTest, FunPtrType) {
00054 static_assert(
00055 std::is_same<void(*)(),
00056 std::decay<decltype(inline_variable_fun_ptr)>::type>::value,
00057 "");
00058 }
00059
00060 }
00061 }
00062 }