• Home
  • Raw
  • Download

Lines Matching refs:val

17   Any val;  in TEST()  local
18 EXPECT_TRUE(val.IsEmpty()); in TEST()
20 Any val2 = val; in TEST()
21 EXPECT_TRUE(val.IsEmpty()); in TEST()
24 Any val3 = std::move(val); in TEST()
25 EXPECT_TRUE(val.IsEmpty()); in TEST()
30 Any val(20); in TEST() local
31 EXPECT_FALSE(val.IsEmpty()); in TEST()
32 EXPECT_TRUE(val.IsTypeCompatible<int>()); in TEST()
33 EXPECT_EQ(20, val.Get<int>()); in TEST()
47 Any val('x'); in TEST() local
48 EXPECT_FALSE(val.IsEmpty()); in TEST()
49 EXPECT_EQ('x', val.Get<char>()); in TEST()
51 val.Clear(); in TEST()
52 EXPECT_TRUE(val.IsEmpty()); in TEST()
56 Any val(20); in TEST() local
57 EXPECT_EQ(20, val.Get<int>()); in TEST()
59 val = 3.1415926; in TEST()
60 EXPECT_FALSE(val.IsEmpty()); in TEST()
61 EXPECT_TRUE(val.IsTypeCompatible<double>()); in TEST()
62 EXPECT_DOUBLE_EQ(3.1415926, val.Get<double>()); in TEST()
64 val = std::string("blah"); in TEST()
65 EXPECT_EQ("blah", val.Get<std::string>()); in TEST()
69 val2 = val; in TEST()
70 EXPECT_FALSE(val.IsEmpty()); in TEST()
72 EXPECT_EQ("blah", val.Get<std::string>()); in TEST()
74 val.Clear(); in TEST()
75 EXPECT_TRUE(val.IsEmpty()); in TEST()
80 val = std::vector<int>{100, 20, 3}; in TEST()
81 auto v = val.Get<std::vector<int>>(); in TEST()
86 val2 = std::move(val); in TEST()
87 EXPECT_TRUE(val.IsEmpty()); in TEST()
91 val = val2; in TEST()
92 EXPECT_TRUE(val.IsTypeCompatible<std::vector<int>>()); in TEST()
94 EXPECT_EQ(3, val.Get<std::vector<int>>().size()); in TEST()
100 Any val(Dummy::bar); in TEST() local
101 EXPECT_FALSE(val.IsEmpty()); in TEST()
102 EXPECT_TRUE(val.IsConvertibleToInteger()); in TEST()
103 EXPECT_EQ(Dummy::bar, val.Get<Dummy>()); in TEST()
104 EXPECT_EQ(1, val.GetAsInteger()); in TEST()
106 val = Dummy::baz; in TEST()
107 EXPECT_EQ(2, val.GetAsInteger()); in TEST()
109 val = Dummy::foo; in TEST()
110 EXPECT_EQ(0, val.GetAsInteger()); in TEST()
114 Any val(14); in TEST() local
115 EXPECT_TRUE(val.IsConvertibleToInteger()); in TEST()
116 EXPECT_EQ(14, val.Get<int>()); in TEST()
117 EXPECT_EQ(14, val.GetAsInteger()); in TEST()
119 val = '\x40'; in TEST()
120 EXPECT_TRUE(val.IsConvertibleToInteger()); in TEST()
121 EXPECT_EQ(64, val.Get<char>()); in TEST()
122 EXPECT_EQ(64, val.GetAsInteger()); in TEST()
124 val = static_cast<uint16_t>(65535); in TEST()
125 EXPECT_TRUE(val.IsConvertibleToInteger()); in TEST()
126 EXPECT_EQ(65535, val.Get<uint16_t>()); in TEST()
127 EXPECT_EQ(65535, val.GetAsInteger()); in TEST()
129 val = static_cast<uint64_t>(0xFFFFFFFFFFFFFFFFULL); in TEST()
130 EXPECT_TRUE(val.IsConvertibleToInteger()); in TEST()
131 EXPECT_EQ(0xFFFFFFFFFFFFFFFFULL, val.Get<uint64_t>()); in TEST()
132 EXPECT_EQ(-1, val.GetAsInteger()); in TEST()
134 val = "abc"; in TEST()
135 EXPECT_FALSE(val.IsConvertibleToInteger()); in TEST()
138 val = &a; in TEST()
139 EXPECT_FALSE(val.IsConvertibleToInteger()); in TEST()
143 Any val("abc"); // const char* in TEST() local
144 EXPECT_FALSE(val.IsTypeCompatible<char*>()); in TEST()
145 EXPECT_TRUE(val.IsTypeCompatible<const char*>()); in TEST()
146 EXPECT_FALSE(val.IsTypeCompatible<volatile char*>()); in TEST()
147 EXPECT_TRUE(val.IsTypeCompatible<volatile const char*>()); in TEST()
148 EXPECT_STREQ("abc", val.Get<const char*>()); in TEST()
151 val = &a; in TEST()
152 EXPECT_TRUE(val.IsTypeCompatible<int*>()); in TEST()
153 EXPECT_TRUE(val.IsTypeCompatible<const int*>()); in TEST()
154 EXPECT_TRUE(val.IsTypeCompatible<volatile int*>()); in TEST()
155 EXPECT_TRUE(val.IsTypeCompatible<volatile const int*>()); in TEST()
156 EXPECT_EQ(10, *val.Get<const int*>()); in TEST()
157 *val.Get<int*>() = 3; in TEST()
171 Any val = int_array; in TEST() local
172 EXPECT_TRUE(val.IsTypeCompatible<int*>()); in TEST()
173 EXPECT_TRUE(val.IsTypeCompatible<const int*>()); in TEST()
174 EXPECT_TRUE(val.IsTypeCompatible<int[]>()); in TEST()
175 EXPECT_TRUE(val.IsTypeCompatible<const int[]>()); in TEST()
176 EXPECT_EQ(3, val.Get<int*>()[2]); in TEST()
179 val = const_int_array; in TEST()
180 EXPECT_FALSE(val.IsTypeCompatible<int*>()); in TEST()
181 EXPECT_TRUE(val.IsTypeCompatible<const int*>()); in TEST()
182 EXPECT_FALSE(val.IsTypeCompatible<int[]>()); in TEST()
183 EXPECT_TRUE(val.IsTypeCompatible<const int[]>()); in TEST()
184 EXPECT_EQ(30, val.Get<const int*>()[2]); in TEST()
196 Any val(std::ref(a)); // int& in TEST() local
197 EXPECT_EQ(5, val.Get<std::reference_wrapper<int>>().get()); in TEST()
198 val.Get<std::reference_wrapper<int>>().get() = 7; in TEST()
199 EXPECT_EQ(7, val.Get<std::reference_wrapper<int>>().get()); in TEST()
206 EXPECT_EQ(10, val.Get<std::reference_wrapper<int>>().get()); in TEST()
215 Any val(Person{"Jack", 40}); in TEST() local
216 Any val2 = val; in TEST()
217 EXPECT_EQ("Jack", val.Get<Person>().name); in TEST()
218 val.GetPtr<Person>()->name = "Joe"; in TEST()
219 val.GetPtr<Person>()->age /= 2; in TEST()
220 EXPECT_EQ("Joe", val.Get<Person>().name); in TEST()
221 EXPECT_EQ(20, val.Get<Person>().age); in TEST()
227 Any val(12); in TEST() local
229 EXPECT_EQ(12, val.Get<int>()); in TEST()
232 val.Swap(val2); in TEST()
233 EXPECT_EQ(2.7, val.Get<double>()); in TEST()
236 std::swap(val, val2); in TEST()
237 EXPECT_EQ(12, val.Get<int>()); in TEST()
242 Any val(12); in TEST() local
243 EXPECT_DEATH(val.Get<double>(), in TEST()
247 val = std::string("123"); in TEST()
248 EXPECT_DEATH(val.GetAsInteger(), in TEST()
256 Any val(12); in TEST() local
258 EXPECT_EQ("dummy", val.TryGet<std::string>("dummy")); in TEST()
259 EXPECT_EQ(12, val.TryGet<int>(17)); in TEST()
310 Any val; in TEST() local
311 EXPECT_TRUE(val.GetUndecoratedTypeName().empty()); in TEST()
313 val = 1; in TEST()
315 val.GetUndecoratedTypeName()); in TEST()
317 val = 3.1415926; in TEST()
319 val.GetUndecoratedTypeName()); in TEST()
321 val = std::string("blah"); in TEST()
323 val.GetUndecoratedTypeName()); in TEST()