MCPcopy Create free account
hub / github.com/apache/arrow / AssertConversion

Function AssertConversion

cpp/src/arrow/csv/converter_test.cc:55–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53
54template <typename DATA_TYPE, typename C_TYPE>
55void AssertConversion(const std::shared_ptr<DataType>& type,
56 const std::vector<std::string>& csv_string,
57 const std::vector<std::vector<C_TYPE>>& expected,
58 ConvertOptions options = ConvertOptions::Defaults(),
59 bool validate_full = true) {
60 std::shared_ptr<BlockParser> parser;
61 std::shared_ptr<Converter> converter;
62 std::shared_ptr<Array> array, expected_array;
63
64 ASSERT_OK_AND_ASSIGN(converter, Converter::Make(type, options));
65
66 MakeCSVParser(csv_string, &parser);
67 for (int32_t col_index = 0; col_index < static_cast<int32_t>(expected.size());
68 ++col_index) {
69 ASSERT_OK_AND_ASSIGN(array, converter->Convert(*parser, col_index));
70 if (validate_full) {
71 ASSERT_OK(array->ValidateFull());
72 } else {
73 ASSERT_OK(array->Validate());
74 }
75 ArrayFromVector<DATA_TYPE, C_TYPE>(type, expected[col_index], &expected_array);
76 AssertArraysEqual(*expected_array, *array);
77 }
78}
79
80template <typename DATA_TYPE, typename C_TYPE>
81void AssertConversion(const std::shared_ptr<DataType>& type,

Callers

nothing calls this directly

Calls 9

MakeCSVParserFunction · 0.85
AssertArraysEqualFunction · 0.85
ASSERT_OK_AND_ASSIGNFunction · 0.70
DefaultsFunction · 0.50
MakeFunction · 0.50
sizeMethod · 0.45
ConvertMethod · 0.45
ValidateFullMethod · 0.45
ValidateMethod · 0.45

Tested by

no test coverage detected