• Home
  • Raw
  • Download

Lines Matching refs:val

16   Any val;  in TEST()  local
17 EXPECT_TRUE(val.IsEmpty()); in TEST()
19 Any val2 = val; in TEST()
20 EXPECT_TRUE(val.IsEmpty()); in TEST()
23 Any val3 = std::move(val); in TEST()
24 EXPECT_TRUE(val.IsEmpty()); in TEST()
29 Any val(20); in TEST() local
30 EXPECT_FALSE(val.IsEmpty()); in TEST()
31 EXPECT_TRUE(val.IsTypeCompatible<int>()); in TEST()
32 EXPECT_EQ(20, val.Get<int>()); in TEST()
46 Any val('x'); in TEST() local
47 EXPECT_FALSE(val.IsEmpty()); in TEST()
48 EXPECT_EQ('x', val.Get<char>()); in TEST()
50 val.Clear(); in TEST()
51 EXPECT_TRUE(val.IsEmpty()); in TEST()
55 Any val(20); in TEST() local
56 EXPECT_EQ(20, val.Get<int>()); in TEST()
58 val = 3.1415926; in TEST()
59 EXPECT_FALSE(val.IsEmpty()); in TEST()
60 EXPECT_TRUE(val.IsTypeCompatible<double>()); in TEST()
61 EXPECT_DOUBLE_EQ(3.1415926, val.Get<double>()); in TEST()
63 val = std::string("blah"); in TEST()
64 EXPECT_EQ("blah", val.Get<std::string>()); in TEST()
68 val2 = val; in TEST()
69 EXPECT_FALSE(val.IsEmpty()); in TEST()
71 EXPECT_EQ("blah", val.Get<std::string>()); in TEST()
73 val.Clear(); in TEST()
74 EXPECT_TRUE(val.IsEmpty()); in TEST()
79 val = std::vector<int>{100, 20, 3}; in TEST()
80 auto v = val.Get<std::vector<int>>(); in TEST()
85 val2 = std::move(val); in TEST()
86 EXPECT_TRUE(val.IsEmpty()); in TEST()
90 val = val2; in TEST()
91 EXPECT_TRUE(val.IsTypeCompatible<std::vector<int>>()); in TEST()
93 EXPECT_EQ(3, val.Get<std::vector<int>>().size()); in TEST()
99 Any val(Dummy::bar); in TEST() local
100 EXPECT_FALSE(val.IsEmpty()); in TEST()
101 EXPECT_TRUE(val.IsConvertibleToInteger()); in TEST()
102 EXPECT_EQ(Dummy::bar, val.Get<Dummy>()); in TEST()
103 EXPECT_EQ(1, val.GetAsInteger()); in TEST()
105 val = Dummy::baz; in TEST()
106 EXPECT_EQ(2, val.GetAsInteger()); in TEST()
108 val = Dummy::foo; in TEST()
109 EXPECT_EQ(0, val.GetAsInteger()); in TEST()
113 Any val(14); in TEST() local
114 EXPECT_TRUE(val.IsConvertibleToInteger()); in TEST()
115 EXPECT_EQ(14, val.Get<int>()); in TEST()
116 EXPECT_EQ(14, val.GetAsInteger()); in TEST()
118 val = '\x40'; in TEST()
119 EXPECT_TRUE(val.IsConvertibleToInteger()); in TEST()
120 EXPECT_EQ(64, val.Get<char>()); in TEST()
121 EXPECT_EQ(64, val.GetAsInteger()); in TEST()
123 val = static_cast<uint16_t>(65535); in TEST()
124 EXPECT_TRUE(val.IsConvertibleToInteger()); in TEST()
125 EXPECT_EQ(65535, val.Get<uint16_t>()); in TEST()
126 EXPECT_EQ(65535, val.GetAsInteger()); in TEST()
128 val = static_cast<uint64_t>(0xFFFFFFFFFFFFFFFFULL); in TEST()
129 EXPECT_TRUE(val.IsConvertibleToInteger()); in TEST()
130 EXPECT_EQ(0xFFFFFFFFFFFFFFFFULL, val.Get<uint64_t>()); in TEST()
131 EXPECT_EQ(-1, val.GetAsInteger()); in TEST()
133 val = "abc"; in TEST()
134 EXPECT_FALSE(val.IsConvertibleToInteger()); in TEST()
137 val = &a; in TEST()
138 EXPECT_FALSE(val.IsConvertibleToInteger()); in TEST()
142 Any val("abc"); // const char* in TEST() local
143 EXPECT_FALSE(val.IsTypeCompatible<char*>()); in TEST()
144 EXPECT_TRUE(val.IsTypeCompatible<const char*>()); in TEST()
145 EXPECT_FALSE(val.IsTypeCompatible<volatile char*>()); in TEST()
146 EXPECT_TRUE(val.IsTypeCompatible<volatile const char*>()); in TEST()
147 EXPECT_STREQ("abc", val.Get<const char*>()); in TEST()
150 val = &a; in TEST()
151 EXPECT_TRUE(val.IsTypeCompatible<int*>()); in TEST()
152 EXPECT_TRUE(val.IsTypeCompatible<const int*>()); in TEST()
153 EXPECT_TRUE(val.IsTypeCompatible<volatile int*>()); in TEST()
154 EXPECT_TRUE(val.IsTypeCompatible<volatile const int*>()); in TEST()
155 EXPECT_EQ(10, *val.Get<const int*>()); in TEST()
156 *val.Get<int*>() = 3; in TEST()
170 Any val = int_array; in TEST() local
171 EXPECT_TRUE(val.IsTypeCompatible<int*>()); in TEST()
172 EXPECT_TRUE(val.IsTypeCompatible<const int*>()); in TEST()
173 EXPECT_TRUE(val.IsTypeCompatible<int[]>()); in TEST()
174 EXPECT_TRUE(val.IsTypeCompatible<const int[]>()); in TEST()
175 EXPECT_EQ(3, val.Get<int*>()[2]); in TEST()
178 val = const_int_array; in TEST()
179 EXPECT_FALSE(val.IsTypeCompatible<int*>()); in TEST()
180 EXPECT_TRUE(val.IsTypeCompatible<const int*>()); in TEST()
181 EXPECT_FALSE(val.IsTypeCompatible<int[]>()); in TEST()
182 EXPECT_TRUE(val.IsTypeCompatible<const int[]>()); in TEST()
183 EXPECT_EQ(30, val.Get<const int*>()[2]); in TEST()
195 Any val(std::ref(a)); // int& in TEST() local
196 EXPECT_EQ(5, val.Get<std::reference_wrapper<int>>().get()); in TEST()
197 val.Get<std::reference_wrapper<int>>().get() = 7; in TEST()
198 EXPECT_EQ(7, val.Get<std::reference_wrapper<int>>().get()); in TEST()
205 EXPECT_EQ(10, val.Get<std::reference_wrapper<int>>().get()); in TEST()
214 Any val(Person{"Jack", 40}); in TEST() local
215 Any val2 = val; in TEST()
216 EXPECT_EQ("Jack", val.Get<Person>().name); in TEST()
217 val.GetPtr<Person>()->name = "Joe"; in TEST()
218 val.GetPtr<Person>()->age /= 2; in TEST()
219 EXPECT_EQ("Joe", val.Get<Person>().name); in TEST()
220 EXPECT_EQ(20, val.Get<Person>().age); in TEST()
226 Any val(12); in TEST() local
228 EXPECT_EQ(12, val.Get<int>()); in TEST()
231 val.Swap(val2); in TEST()
232 EXPECT_EQ(2.7, val.Get<double>()); in TEST()
235 std::swap(val, val2); in TEST()
236 EXPECT_EQ(12, val.Get<int>()); in TEST()
241 Any val(12); in TEST() local
242 EXPECT_DEATH(val.Get<double>(), in TEST()
246 val = std::string("123"); in TEST()
247 EXPECT_DEATH(val.GetAsInteger(), in TEST()
255 Any val(12); in TEST() local
257 EXPECT_EQ("dummy", val.TryGet<std::string>("dummy")); in TEST()
258 EXPECT_EQ(12, val.TryGet<int>(17)); in TEST()
309 Any val; in TEST() local
310 EXPECT_TRUE(val.GetUndecoratedTypeName().empty()); in TEST()
312 val = 1; in TEST()
314 val.GetUndecoratedTypeName()); in TEST()
316 val = 3.1415926; in TEST()
318 val.GetUndecoratedTypeName()); in TEST()
320 val = std::string("blah"); in TEST()
322 val.GetUndecoratedTypeName()); in TEST()