Skip to content

Commit 6a4a40b

Browse files
committed
Clean up
1 parent 76a393f commit 6a4a40b

File tree

2 files changed

+2
-102
lines changed

2 files changed

+2
-102
lines changed

tests/include/sparrow_ipc_tests_helpers.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace sparrow_ipc
88
namespace sp = sparrow;
99

1010
template <typename T1, typename T2>
11-
void compare_metadata(T1& arr1, T2& arr2)
11+
void compare_metadata(const T1& arr1, const T2& arr2)
1212
{
1313
if (!arr1.metadata().has_value())
1414
{

tests/test_primitive_array_serialization.cpp

Lines changed: 1 addition & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -18,91 +18,6 @@ namespace sparrow_ipc
1818
float,
1919
double>;
2020

21-
// TODO We should use comparison functions from sparrow, after making them available if not already
22-
// after next release?
23-
// Or even better, allow checking directly primitive_array equality in sparrow
24-
void compare_arrow_schemas(const ArrowSchema& s1, const ArrowSchema& s2)
25-
{
26-
std::string_view s1_format = (s1.format != nullptr) ? std::string_view(s1.format) : "";
27-
std::string_view s2_format = (s2.format != nullptr) ? std::string_view(s2.format) : "";
28-
CHECK_EQ(s1_format, s2_format);
29-
30-
std::string_view s1_name = (s1.name != nullptr) ? std::string_view(s1.name) : "";
31-
std::string_view s2_name = (s2.name != nullptr) ? std::string_view(s2.name) : "";
32-
CHECK_EQ(s1_name, s2_name);
33-
34-
if (s1.metadata == nullptr)
35-
{
36-
CHECK_EQ(s2.metadata, nullptr);
37-
}
38-
else
39-
{
40-
REQUIRE_NE(s2.metadata, nullptr);
41-
}
42-
43-
CHECK_EQ(s1.flags, s2.flags);
44-
CHECK_EQ(s1.n_children, s2.n_children);
45-
46-
if (s1.n_children > 0)
47-
{
48-
REQUIRE_NE(s1.children, nullptr);
49-
REQUIRE_NE(s2.children, nullptr);
50-
for (int64_t i = 0; i < s1.n_children; ++i)
51-
{
52-
REQUIRE_NE(s1.children[i], nullptr);
53-
REQUIRE_NE(s2.children[i], nullptr);
54-
compare_arrow_schemas(*s1.children[i], *s2.children[i]);
55-
}
56-
}
57-
else
58-
{
59-
CHECK_EQ(s1.children, nullptr);
60-
CHECK_EQ(s2.children, nullptr);
61-
}
62-
63-
if (s1.dictionary != nullptr)
64-
{
65-
REQUIRE_NE(s2.dictionary, nullptr);
66-
compare_arrow_schemas(*s1.dictionary, *s2.dictionary);
67-
}
68-
else
69-
{
70-
CHECK_EQ(s2.dictionary, nullptr);
71-
}
72-
}
73-
74-
void compare_arrow_arrays(const ArrowArray& lhs, const ArrowArray& rhs)
75-
{
76-
CHECK_EQ(lhs.length, rhs.length);
77-
CHECK_EQ(lhs.null_count, rhs.null_count);
78-
CHECK_EQ(lhs.offset, rhs.offset);
79-
CHECK_EQ(lhs.n_buffers, rhs.n_buffers);
80-
CHECK_EQ(lhs.n_children, rhs.n_children);
81-
CHECK_NE(lhs.buffers, rhs.buffers);
82-
CHECK_NE(lhs.private_data, rhs.private_data);
83-
for (size_t i = 0; i < static_cast<size_t>(lhs.n_buffers); ++i)
84-
{
85-
CHECK_NE(lhs.buffers[i], rhs.buffers[i]);
86-
}
87-
const auto lhs_buffers = reinterpret_cast<const int8_t**>(lhs.buffers);
88-
const auto rhs_buffers = reinterpret_cast<const int8_t**>(rhs.buffers);
89-
90-
for (size_t i = 0; i < static_cast<size_t>(lhs.length); ++i)
91-
{
92-
CHECK_EQ(lhs_buffers[1][i], rhs_buffers[1][i]);
93-
}
94-
}
95-
96-
template <typename T>
97-
void compare_values(const sp::primitive_array<T>& pa1, const sp::primitive_array<T>& pa2)
98-
{
99-
CHECK_EQ(pa1.size(), pa1.size());
100-
for (size_t i = 0; i < pa1.size(); ++i)
101-
{
102-
CHECK_EQ(pa1[i], pa2[i]);
103-
}
104-
}
105-
10621
template <typename T>
10722
void compare_bitmap(const sp::primitive_array<T>& pa1, const sp::primitive_array<T>& pa2)
10823
{
@@ -121,23 +36,8 @@ namespace sparrow_ipc
12136
}
12237

12338
template <typename T>
124-
void compare_primitive_arrays(sp::primitive_array<T>& ar, sp::primitive_array<T>& deserialized_ar)
39+
void compare_primitive_arrays(const sp::primitive_array<T>& ar, const sp::primitive_array<T>& deserialized_ar)
12540
{
126-
// const auto [arrow_array_ar, arrow_schema_ar] = sp::get_arrow_structures(ar);
127-
// const auto [arrow_array_deserialized_ar, arrow_schema_deserialized_ar] = sp::get_arrow_structures(deserialized_ar);
128-
//
129-
// // Check ArrowSchema equality
130-
// REQUIRE_NE(arrow_schema_ar, nullptr);
131-
// REQUIRE_NE(arrow_schema_deserialized_ar, nullptr);
132-
// compare_arrow_schemas(*arrow_schema_ar, *arrow_schema_deserialized_ar);
133-
//
134-
// // Check ArrowArray equality
135-
// REQUIRE_NE(arrow_array_ar, nullptr);
136-
// REQUIRE_NE(arrow_array_deserialized_ar, nullptr);
137-
// compare_arrow_arrays(*arrow_array_ar, *arrow_array_deserialized_ar);
138-
139-
// compare_values<T>(ar, deserialized_ar);
140-
14141
CHECK_EQ(ar, deserialized_ar);
14242
compare_bitmap<T>(ar, deserialized_ar);
14343
compare_metadata(ar, deserialized_ar);

0 commit comments

Comments
 (0)