Skip to content

Commit 3890925

Browse files
authored
Change way of testing after fix on sparrow (#12)
Test offending line after fix on sparrow
1 parent ba7e68a commit 3890925

File tree

4 files changed

+6
-107
lines changed

4 files changed

+6
-107
lines changed

cmake/external_dependencies.cmake

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ endif()
1111

1212
function(find_package_or_fetch)
1313
set(options)
14-
set(oneValueArgs CONAN_PKG_NAME PACKAGE_NAME VERSION GIT_REPOSITORY TAG)
14+
set(oneValueArgs CONAN_PKG_NAME PACKAGE_NAME GIT_REPOSITORY TAG)
1515
set(multiValueArgs)
1616
cmake_parse_arguments(PARSE_ARGV 0 arg
1717
"${options}" "${oneValueArgs}" "${multiValueArgs}"
@@ -48,9 +48,8 @@ endfunction()
4848
set(SPARROW_BUILD_SHARED ${SPARROW_IPC_BUILD_SHARED})
4949
find_package_or_fetch(
5050
PACKAGE_NAME sparrow
51-
VERSION 1.0.0
5251
GIT_REPOSITORY https://github.com/man-group/sparrow.git
53-
TAG 1.0.0
52+
TAG 1.1.0
5453
)
5554

5655
if(NOT TARGET sparrow::sparrow)
@@ -62,7 +61,6 @@ set(FLATBUFFERS_BUILD_SHAREDLIB ${SPARROW_IPC_BUILD_SHARED})
6261
find_package_or_fetch(
6362
CONAN_PKG_NAME flatbuffers
6463
PACKAGE_NAME FlatBuffers
65-
VERSION v25.2.10
6664
GIT_REPOSITORY https://github.com/google/flatbuffers.git
6765
TAG v25.2.10
6866
)
@@ -75,7 +73,6 @@ unset(FLATBUFFERS_BUILD_TESTS CACHE)
7573
if(SPARROW_IPC_BUILD_TESTS)
7674
find_package_or_fetch(
7775
PACKAGE_NAME doctest
78-
VERSION v2.4.12
7976
GIT_REPOSITORY https://github.com/doctest/doctest.git
8077
TAG v2.4.12
8178
)

environment-dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ dependencies:
88
- cxx-compiler
99
# Libraries dependencies
1010
- flatbuffers
11-
- sparrow
11+
- sparrow >=1.1.0
1212
- doctest

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: 2 additions & 100 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,22 +36,9 @@ 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);
41+
CHECK_EQ(ar, deserialized_ar);
14042
compare_bitmap<T>(ar, deserialized_ar);
14143
compare_metadata(ar, deserialized_ar);
14244
}

0 commit comments

Comments
 (0)