MCPcopy Create free account
hub / github.com/bytedance/bolt / TEST

Function TEST

bolt/type/tests/VariantTest.cpp:46–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44} // namespace
45
46TEST(VariantTest, arrayInferType) {
47 EXPECT_EQ(*ARRAY(UNKNOWN()), *variant(TypeKind::ARRAY).inferType());
48 EXPECT_EQ(*ARRAY(UNKNOWN()), *variant::array({}).inferType());
49 EXPECT_EQ(
50 *ARRAY(BIGINT()),
51 *variant::array({variant(TypeKind::BIGINT)}).inferType());
52 EXPECT_EQ(
53 *ARRAY(VARCHAR()),
54 *variant::array({variant(TypeKind::VARCHAR)}).inferType());
55 EXPECT_EQ(
56 *ARRAY(ARRAY(DOUBLE())),
57 *variant::array({variant::array({variant(TypeKind::DOUBLE)})})
58 .inferType());
59 BOLT_ASSERT_THROW(
60 variant::array({variant(123456789), variant("bolt")}),
61 "All array elements must be of the same kind");
62}
63
64TEST(VariantTest, mapInferType) {
65 EXPECT_EQ(*variant::map({{1LL, 1LL}}).inferType(), *MAP(BIGINT(), BIGINT()));

Callers

nothing calls this directly

Calls 15

ARRAYFunction · 0.85
UNKNOWNFunction · 0.85
MAPFunction · 0.85
accumulateFunction · 0.85
testSerDeFunction · 0.85
ROWFunction · 0.85
DECIMALFunction · 0.85
inferTypeMethod · 0.80
equalsWithEpsilonMethod · 0.80
variantClass · 0.50
TimestampClass · 0.50
hasValueMethod · 0.45

Tested by

no test coverage detected