MCPcopy Create free account
hub / github.com/apache/fory / TEST

Function TEST

cpp/fory/encoder/row_encoder_test.cc:78–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76} // namespace nested_row
77
78TEST(RowEncoder, Simple) {
79 B v{233, {1.23, "hello"}};
80
81 encoder::RowEncoder<B> enc;
82
83 auto &schema = enc.get_schema();
84 ASSERT_EQ(schema.field_names(), (std::vector<std::string>{"x", "y"}));
85 ASSERT_EQ(schema.field(0)->type()->name(), "int32");
86 ASSERT_EQ(schema.field(1)->type()->name(), "struct");
87 ASSERT_EQ(schema.field(1)->type()->field(0)->name(), "a");
88 ASSERT_EQ(schema.field(1)->type()->field(1)->name(), "b");
89 ASSERT_EQ(schema.field(1)->type()->field(0)->type()->name(), "float");
90 ASSERT_EQ(schema.field(1)->type()->field(1)->type()->name(), "utf8");
91
92 enc.encode(v);
93
94 auto row = enc.get_writer().to_row();
95 ASSERT_EQ(row->get_int32(0), 233);
96 auto y_row = row->get_struct(1);
97 ASSERT_EQ(y_row->get_string(1), "hello");
98 ASSERT_FLOAT_EQ(y_row->get_float(0), 1.23);
99}
100
101TEST(RowEncoder, ExternalStruct) {
102 external_row::ExternalRow v{7, "external"};

Callers

nothing calls this directly

Calls 15

field_namesMethod · 0.80
get_writerMethod · 0.80
get_stringMethod · 0.80
copy_to_array_dataMethod · 0.80
get_booleanMethod · 0.80
typeMethod · 0.65
fieldMethod · 0.65
encodeMethod · 0.65
nameMethod · 0.45
to_rowMethod · 0.45
get_int32Method · 0.45
get_structMethod · 0.45

Tested by

no test coverage detected