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

Function AssertJSONScalar

cpp/src/arrow/json/from_string_test.cc:149–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147
148template <typename T, typename C_TYPE = typename T::c_type>
149void AssertJSONScalar(const std::shared_ptr<DataType>& type, const std::string& json,
150 const bool is_valid, const C_TYPE value) {
151 SCOPED_TRACE(json);
152 std::shared_ptr<Scalar> expected;
153
154 ASSERT_OK_AND_ASSIGN(auto actual, ScalarFromJSONString(type, json));
155 if (is_valid) {
156 ASSERT_OK_AND_ASSIGN(expected, MakeScalar(type, value));
157 } else {
158 expected = MakeNullScalar(type);
159 }
160 AssertScalarsEqual(*expected, *actual, /*verbose=*/true);
161}
162
163TEST(TestHelper, JSONArray) {
164 // Test the JSONArray helper func

Callers

nothing calls this directly

Calls 4

MakeScalarFunction · 0.85
MakeNullScalarFunction · 0.85
ASSERT_OK_AND_ASSIGNFunction · 0.50
AssertScalarsEqualFunction · 0.50

Tested by

no test coverage detected