Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cpp/src/arrow/flight/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,9 @@ if(ARROW_TESTING)
ArrowTesting::arrow_testing_static)
endif()
list(APPEND ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS ${ARROW_FLIGHT_TEST_INTERFACE_LIBS})
list(APPEND ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS ${ARROW_GTEST_GMOCK})
list(APPEND ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS ${ARROW_FLIGHT_TEST_INTERFACE_LIBS})
list(APPEND ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS ${ARROW_GTEST_GMOCK})
add_arrow_lib(arrow_flight_testing
CMAKE_PACKAGE_NAME
ArrowFlightTesting
Expand Down
15 changes: 15 additions & 0 deletions cpp/src/arrow/flight/test_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
// We need Windows fixes before including Boost
#include "arrow/util/windows_compatibility.h"

#include <gmock/gmock.h>
#include <gtest/gtest.h>

#include "arrow/array.h"
Expand Down Expand Up @@ -105,6 +106,20 @@ arrow::Result<FlightPayload> NumberingStream::Next() {
return payload;
}

void AssertEqual(const FlightInfo& expected, const FlightInfo& actual) {
ipc::DictionaryMemo expected_memo;
ipc::DictionaryMemo actual_memo;
ASSERT_OK_AND_ASSIGN(auto ex_schema, expected.GetSchema(&expected_memo));
ASSERT_OK_AND_ASSIGN(auto actual_schema, actual.GetSchema(&actual_memo));

AssertSchemaEqual(*ex_schema, *actual_schema);
ASSERT_EQ(expected.total_records(), actual.total_records());
ASSERT_EQ(expected.total_bytes(), actual.total_bytes());

ASSERT_EQ(expected.descriptor(), actual.descriptor());
ASSERT_THAT(actual.endpoints(), ::testing::ContainerEq(expected.endpoints()));
}

std::shared_ptr<Schema> ExampleIntSchema() {
auto f0 = field("f0", int8());
auto f1 = field("f1", uint8());
Expand Down
17 changes: 2 additions & 15 deletions cpp/src/arrow/flight/test_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#pragma once

#include <gmock/gmock.h>
#include <gtest/gtest.h>

#include <cstdint>
Expand All @@ -42,20 +41,8 @@ namespace flight {

// ----------------------------------------------------------------------
// Helpers to compare values for equality

inline void AssertEqual(const FlightInfo& expected, const FlightInfo& actual) {
ipc::DictionaryMemo expected_memo;
ipc::DictionaryMemo actual_memo;
ASSERT_OK_AND_ASSIGN(auto ex_schema, expected.GetSchema(&expected_memo));
ASSERT_OK_AND_ASSIGN(auto actual_schema, actual.GetSchema(&actual_memo));

AssertSchemaEqual(*ex_schema, *actual_schema);
ASSERT_EQ(expected.total_records(), actual.total_records());
ASSERT_EQ(expected.total_bytes(), actual.total_bytes());

ASSERT_EQ(expected.descriptor(), actual.descriptor());
ASSERT_THAT(actual.endpoints(), ::testing::ContainerEq(expected.endpoints()));
}
ARROW_FLIGHT_EXPORT
void AssertEqual(const FlightInfo& expected, const FlightInfo& actual);

// ----------------------------------------------------------------------
// Fixture to use for running test servers
Expand Down
Loading