You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2018/08/16 14:13:20 UTC

[arrow] branch master updated: ARROW-3059: [C++] Remove namespace arrow::test

This is an automated email from the ASF dual-hosted git repository.

wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 719c954  ARROW-3059: [C++] Remove namespace arrow::test
719c954 is described below

commit 719c954039a903738671fe36d66e01c74b62fa2c
Author: Antoine Pitrou <an...@python.org>
AuthorDate: Thu Aug 16 10:13:13 2018 -0400

    ARROW-3059: [C++] Remove namespace arrow::test
    
    Depends on PR https://github.com/apache/parquet-cpp/pull/487
    
    Author: Antoine Pitrou <an...@python.org>
    
    Closes #2436 from pitrou/ARROW-3059-remove-test-namespace and squashes the following commits:
    
    47bf2e3c <Antoine Pitrou> ARROW-3059:  Remove namespace arrow::test
---
 cpp/src/arrow/array-test.cc                   | 68 +++++++++++++--------------
 cpp/src/arrow/compute/compute-benchmark.cc    | 10 ++--
 cpp/src/arrow/compute/compute-test.cc         |  4 +-
 cpp/src/arrow/gpu/cuda-benchmark.cc           |  2 +-
 cpp/src/arrow/gpu/cuda-test.cc                | 12 ++---
 cpp/src/arrow/io/io-file-test.cc              | 28 +++++------
 cpp/src/arrow/io/io-hdfs-test.cc              |  2 +-
 cpp/src/arrow/io/io-memory-benchmark.cc       |  4 +-
 cpp/src/arrow/io/io-memory-test.cc            |  2 +-
 cpp/src/arrow/ipc/ipc-json-test.cc            | 14 +++---
 cpp/src/arrow/ipc/ipc-read-write-benchmark.cc |  4 +-
 cpp/src/arrow/ipc/ipc-read-write-test.cc      | 13 +++--
 cpp/src/arrow/ipc/test-common.h               | 28 +++++------
 cpp/src/arrow/memory_pool-test.cc             |  2 +-
 cpp/src/arrow/memory_pool-test.h              |  3 --
 cpp/src/arrow/table-test.cc                   |  6 +--
 cpp/src/arrow/test-common.h                   |  6 +--
 cpp/src/arrow/test-util.h                     | 12 ++---
 cpp/src/arrow/util/bit-util-benchmark.cc      |  2 +-
 cpp/src/arrow/util/bit-util-test.cc           |  6 +--
 cpp/src/arrow/util/compression-test.cc        |  2 +-
 cpp/src/arrow/util/lazy-benchmark.cc          |  2 +-
 cpp/src/arrow/util/lazy-test.cc               |  2 +-
 cpp/src/plasma/test/client_tests.cc           |  6 +--
 24 files changed, 115 insertions(+), 125 deletions(-)

diff --git a/cpp/src/arrow/array-test.cc b/cpp/src/arrow/array-test.cc
index 702b819..5f002a5 100644
--- a/cpp/src/arrow/array-test.cc
+++ b/cpp/src/arrow/array-test.cc
@@ -308,7 +308,7 @@ class TestPrimitiveBuilder : public TestBuilder {
     Attrs::draw(N, &draws_);
 
     valid_bytes_.resize(static_cast<size_t>(N));
-    test::random_null_bytes(N, pct_null, valid_bytes_.data());
+    random_null_bytes(N, pct_null, valid_bytes_.data());
   }
 
   void Check(const std::unique_ptr<BuilderType>& builder, bool nullable) {
@@ -323,7 +323,7 @@ class TestPrimitiveBuilder : public TestBuilder {
     if (nullable) {
       ASSERT_OK(
           BitUtil::BytesToBits(valid_bytes_, default_memory_pool(), &ex_null_bitmap));
-      ex_null_count = test::null_count(valid_bytes_);
+      ex_null_count = CountNulls(valid_bytes_);
     } else {
       ex_null_bitmap = nullptr;
     }
@@ -381,23 +381,23 @@ struct UniformIntSampleType<int8_t> {
                                         \
   static std::shared_ptr<DataType> type() { return std::make_shared<Type>(); }
 
-#define PINT_DECL(CapType, c_type)                                                       \
-  struct P##CapType {                                                                    \
-    PTYPE_DECL(CapType, c_type)                                                          \
-    static void draw(int64_t N, vector<T>* draws) {                                      \
-      using sample_type = typename UniformIntSampleType<c_type>::type;                   \
-      const T lower = std::numeric_limits<T>::min();                                     \
-      const T upper = std::numeric_limits<T>::max();                                     \
-      test::randint(N, static_cast<sample_type>(lower), static_cast<sample_type>(upper), \
-                    draws);                                                              \
-    }                                                                                    \
+#define PINT_DECL(CapType, c_type)                                                 \
+  struct P##CapType {                                                              \
+    PTYPE_DECL(CapType, c_type)                                                    \
+    static void draw(int64_t N, vector<T>* draws) {                                \
+      using sample_type = typename UniformIntSampleType<c_type>::type;             \
+      const T lower = std::numeric_limits<T>::min();                               \
+      const T upper = std::numeric_limits<T>::max();                               \
+      randint(N, static_cast<sample_type>(lower), static_cast<sample_type>(upper), \
+              draws);                                                              \
+    }                                                                              \
   }
 
 #define PFLOAT_DECL(CapType, c_type, LOWER, UPPER)  \
   struct P##CapType {                               \
     PTYPE_DECL(CapType, c_type)                     \
     static void draw(int64_t N, vector<T>* draws) { \
-      test::random_real(N, 0, LOWER, UPPER, draws); \
+      random_real(N, 0, LOWER, UPPER, draws);       \
     }                                               \
   }
 
@@ -423,8 +423,8 @@ void TestPrimitiveBuilder<PBoolean>::RandomData(int64_t N, double pct_null) {
   draws_.resize(static_cast<size_t>(N));
   valid_bytes_.resize(static_cast<size_t>(N));
 
-  test::random_null_bytes(N, 0.5, draws_.data());
-  test::random_null_bytes(N, pct_null, valid_bytes_.data());
+  random_null_bytes(N, 0.5, draws_.data());
+  random_null_bytes(N, pct_null, valid_bytes_.data());
 }
 
 template <>
@@ -445,7 +445,7 @@ void TestPrimitiveBuilder<PBoolean>::Check(const std::unique_ptr<BooleanBuilder>
   ASSERT_OK(BitUtil::BytesToBits(draws_, default_memory_pool(), &ex_data));
   if (nullable) {
     ASSERT_OK(BitUtil::BytesToBits(valid_bytes_, default_memory_pool(), &ex_null_bitmap));
-    ex_null_count = test::null_count(valid_bytes_);
+    ex_null_count = CountNulls(valid_bytes_);
   } else {
     ex_null_bitmap = nullptr;
   }
@@ -923,8 +923,8 @@ TEST(TestBooleanBuilder, TestStdBoolVectorAppend) {
   std::vector<bool> values, is_valid;
 
   const int length = 10000;
-  test::random_is_valid(length, 0.5, &values);
-  test::random_is_valid(length, 0.1, &is_valid);
+  random_is_valid(length, 0.5, &values);
+  random_is_valid(length, 0.1, &is_valid);
 
   const int chunksize = 1000;
   for (int chunk = 0; chunk < length / chunksize; ++chunk) {
@@ -963,8 +963,8 @@ void CheckSliceApproxEquals() {
   vector<T> draws2;
 
   const uint32_t kSeed = 0;
-  test::random_real(kSize, kSeed, 0.0, 100.0, &draws1);
-  test::random_real(kSize, kSeed + 1, 0.0, 100.0, &draws2);
+  random_real(kSize, kSeed, 0.0, 100.0, &draws1);
+  random_real(kSize, kSeed + 1, 0.0, 100.0, &draws2);
 
   // Make the draws equal in the sliced segment, but unequal elsewhere (to
   // catch not using the slice offset)
@@ -973,7 +973,7 @@ void CheckSliceApproxEquals() {
   }
 
   vector<bool> is_valid;
-  test::random_is_valid(kSize, 0.1, &is_valid);
+  random_is_valid(kSize, 0.1, &is_valid);
 
   std::shared_ptr<Array> array1, array2;
   ArrayFromVector<TYPE, T>(is_valid, draws1, &array1);
@@ -1006,10 +1006,10 @@ class TestStringArray : public ::testing::Test {
 
   void MakeArray() {
     length_ = static_cast<int64_t>(offsets_.size()) - 1;
-    value_buf_ = test::GetBufferFromVector(chars_);
-    offsets_buf_ = test::GetBufferFromVector(offsets_);
+    value_buf_ = GetBufferFromVector(chars_);
+    offsets_buf_ = GetBufferFromVector(offsets_);
     ASSERT_OK(BitUtil::BytesToBits(valid_bytes_, default_memory_pool(), &null_bitmap_));
-    null_count_ = test::null_count(valid_bytes_);
+    null_count_ = CountNulls(valid_bytes_);
 
     strings_ = std::make_shared<StringArray>(length_, offsets_buf_, value_buf_,
                                              null_bitmap_, null_count_);
@@ -1071,7 +1071,7 @@ TEST_F(TestStringArray, TestGetString) {
 
 TEST_F(TestStringArray, TestEmptyStringComparison) {
   offsets_ = {0, 0, 0, 0, 0, 0};
-  offsets_buf_ = test::GetBufferFromVector(offsets_);
+  offsets_buf_ = GetBufferFromVector(offsets_);
   length_ = static_cast<int64_t>(offsets_.size() - 1);
 
   auto strings_a = std::make_shared<StringArray>(length_, offsets_buf_, nullptr,
@@ -1318,11 +1318,11 @@ class TestBinaryArray : public ::testing::Test {
 
   void MakeArray() {
     length_ = static_cast<int64_t>(offsets_.size() - 1);
-    value_buf_ = test::GetBufferFromVector(chars_);
-    offsets_buf_ = test::GetBufferFromVector(offsets_);
+    value_buf_ = GetBufferFromVector(chars_);
+    offsets_buf_ = GetBufferFromVector(offsets_);
 
     ASSERT_OK(BitUtil::BytesToBits(valid_bytes_, default_memory_pool(), &null_bitmap_));
-    null_count_ = test::null_count(valid_bytes_);
+    null_count_ = CountNulls(valid_bytes_);
 
     strings_ = std::make_shared<BinaryArray>(length_, offsets_buf_, value_buf_,
                                              null_bitmap_, null_count_);
@@ -1610,10 +1610,10 @@ TEST_F(TestFWBinaryArray, Builder) {
   int64_t nbytes = length * byte_width;
 
   vector<uint8_t> data(nbytes);
-  test::random_bytes(nbytes, 0, data.data());
+  random_bytes(nbytes, 0, data.data());
 
   vector<uint8_t> is_valid(length);
-  test::random_null_bytes(length, 0.1, is_valid.data());
+  random_null_bytes(length, 0.1, is_valid.data());
 
   const uint8_t* raw_data = data.data();
 
@@ -2885,19 +2885,19 @@ TEST_F(TestListArray, TestFromArrays) {
 
   ListArray expected1(list_type, length, offsets1->data()->buffers[1], values,
                       offsets1->data()->buffers[0], 0);
-  test::AssertArraysEqual(expected1, *list1);
+  AssertArraysEqual(expected1, *list1);
 
   // Use null bitmap from offsets3, but clean offsets from non-null version
   ListArray expected3(list_type, length, offsets1->data()->buffers[1], values,
                       offsets3->data()->buffers[0], 1);
-  test::AssertArraysEqual(expected3, *list3);
+  AssertArraysEqual(expected3, *list3);
 
   // Check that the last offset bit is zero
   ASSERT_FALSE(BitUtil::GetBit(list3->null_bitmap()->data(), length + 1));
 
   ListArray expected4(list_type, length, offsets2->data()->buffers[1], values,
                       offsets4->data()->buffers[0], 1);
-  test::AssertArraysEqual(expected4, *list4);
+  AssertArraysEqual(expected4, *list4);
 
   // Test failure modes
 
@@ -3682,7 +3682,7 @@ class DecimalTest : public ::testing::TestWithParam<int> {
     ASSERT_OK(
         BitUtil::BytesToBits(valid_bytes, default_memory_pool(), &expected_null_bitmap));
 
-    int64_t expected_null_count = test::null_count(valid_bytes);
+    int64_t expected_null_count = CountNulls(valid_bytes);
     auto expected = std::make_shared<Decimal128Array>(
         type, size, expected_data, expected_null_bitmap, expected_null_count);
 
diff --git a/cpp/src/arrow/compute/compute-benchmark.cc b/cpp/src/arrow/compute/compute-benchmark.cc
index 6460105..405aa40 100644
--- a/cpp/src/arrow/compute/compute-benchmark.cc
+++ b/cpp/src/arrow/compute/compute-benchmark.cc
@@ -92,13 +92,13 @@ struct HashParams {
     std::vector<int64_t> draws;
     std::vector<T> values;
     std::vector<bool> is_valid;
-    test::randint<int64_t>(length, 0, num_unique, &draws);
+    randint<int64_t>(length, 0, num_unique, &draws);
     for (int64_t draw : draws) {
       values.push_back(static_cast<T>(draw));
     }
 
     if (this->null_percent > 0) {
-      test::random_is_valid(length, this->null_percent, &is_valid);
+      random_is_valid(length, this->null_percent, &is_valid);
       ArrayFromVector<Type, T>(is_valid, values, arr);
     } else {
       ArrayFromVector<Type, T>(values, arr);
@@ -115,16 +115,16 @@ struct HashParams<StringType> {
   void GenerateTestData(const int64_t length, const int64_t num_unique,
                         std::shared_ptr<Array>* arr) const {
     std::vector<int64_t> draws;
-    test::randint<int64_t>(length, 0, num_unique, &draws);
+    randint<int64_t>(length, 0, num_unique, &draws);
 
     const int64_t total_bytes = this->byte_width * num_unique;
     std::vector<uint8_t> uniques(total_bytes);
     const uint32_t seed = 0;
-    test::random_bytes(total_bytes, seed, uniques.data());
+    random_bytes(total_bytes, seed, uniques.data());
 
     std::vector<bool> is_valid;
     if (this->null_percent > 0) {
-      test::random_is_valid(length, this->null_percent, &is_valid);
+      random_is_valid(length, this->null_percent, &is_valid);
     }
 
     StringBuilder builder;
diff --git a/cpp/src/arrow/compute/compute-test.cc b/cpp/src/arrow/compute/compute-test.cc
index cd4b2bb..269b9dd 100644
--- a/cpp/src/arrow/compute/compute-test.cc
+++ b/cpp/src/arrow/compute/compute-test.cc
@@ -917,9 +917,9 @@ TEST_F(TestCast, DictToNonDictNoNulls) {
   std::vector<int32_t> i1 = {1, 0, 1};
   std::vector<int32_t> i2 = {2, 1, 0, 1};
   auto c1 = std::make_shared<NumericArray<Int32Type>>(
-      3, arrow::test::GetBufferFromVector<int32_t>(i1));
+      3, arrow::GetBufferFromVector<int32_t>(i1));
   auto c2 = std::make_shared<NumericArray<Int32Type>>(
-      4, arrow::test::GetBufferFromVector<int32_t>(i2));
+      4, arrow::GetBufferFromVector<int32_t>(i2));
 
   ArrayVector dict_arrays = {std::make_shared<DictionaryArray>(dict_type, c1),
                              std::make_shared<DictionaryArray>(dict_type, c2)};
diff --git a/cpp/src/arrow/gpu/cuda-benchmark.cc b/cpp/src/arrow/gpu/cuda-benchmark.cc
index f791d12..8b3723d 100644
--- a/cpp/src/arrow/gpu/cuda-benchmark.cc
+++ b/cpp/src/arrow/gpu/cuda-benchmark.cc
@@ -49,7 +49,7 @@ static void CudaBufferWriterBenchmark(benchmark::State& state, const int64_t tot
   }
 
   std::shared_ptr<ResizableBuffer> buffer;
-  ASSERT_OK(test::MakeRandomByteBuffer(total_bytes, default_memory_pool(), &buffer));
+  ASSERT_OK(MakeRandomByteBuffer(total_bytes, default_memory_pool(), &buffer));
 
   const uint8_t* host_data = buffer->data();
   while (state.KeepRunning()) {
diff --git a/cpp/src/arrow/gpu/cuda-test.cc b/cpp/src/arrow/gpu/cuda-test.cc
index ba37be9..5eb5cd7 100644
--- a/cpp/src/arrow/gpu/cuda-test.cc
+++ b/cpp/src/arrow/gpu/cuda-test.cc
@@ -72,7 +72,7 @@ TEST_F(TestCudaBuffer, CopyFromHost) {
   ASSERT_OK(context_->Allocate(kSize, &device_buffer));
 
   std::shared_ptr<ResizableBuffer> host_buffer;
-  ASSERT_OK(test::MakeRandomByteBuffer(kSize, default_memory_pool(), &host_buffer));
+  ASSERT_OK(MakeRandomByteBuffer(kSize, default_memory_pool(), &host_buffer));
 
   ASSERT_OK(device_buffer->CopyFromHost(0, host_buffer->data(), 500));
   ASSERT_OK(device_buffer->CopyFromHost(500, host_buffer->data() + 500, kSize - 500));
@@ -86,7 +86,7 @@ TEST_F(TestCudaBuffer, FromBuffer) {
   std::shared_ptr<ResizableBuffer> host_buffer;
   std::shared_ptr<CudaBuffer> device_buffer;
   ASSERT_OK(context_->Allocate(kSize, &device_buffer));
-  ASSERT_OK(test::MakeRandomByteBuffer(kSize, default_memory_pool(), &host_buffer));
+  ASSERT_OK(MakeRandomByteBuffer(kSize, default_memory_pool(), &host_buffer));
   ASSERT_OK(device_buffer->CopyFromHost(0, host_buffer->data(), 1000));
   // Sanity check
   AssertCudaBufferEquals(*device_buffer, host_buffer->data(), kSize);
@@ -133,7 +133,7 @@ TEST_F(TestCudaBuffer, DISABLED_ExportForIpc) {
   ASSERT_OK(context_->Allocate(kSize, &device_buffer));
 
   std::shared_ptr<ResizableBuffer> host_buffer;
-  ASSERT_OK(test::MakeRandomByteBuffer(kSize, default_memory_pool(), &host_buffer));
+  ASSERT_OK(MakeRandomByteBuffer(kSize, default_memory_pool(), &host_buffer));
   ASSERT_OK(device_buffer->CopyFromHost(0, host_buffer->data(), kSize));
 
   // Export for IPC and serialize
@@ -172,7 +172,7 @@ class TestCudaBufferWriter : public TestCudaBufferBase {
   void TestWrites(const int64_t total_bytes, const int64_t chunksize,
                   const int64_t buffer_size = 0) {
     std::shared_ptr<ResizableBuffer> buffer;
-    ASSERT_OK(test::MakeRandomByteBuffer(total_bytes, default_memory_pool(), &buffer));
+    ASSERT_OK(MakeRandomByteBuffer(total_bytes, default_memory_pool(), &buffer));
 
     if (buffer_size > 0) {
       ASSERT_OK(writer_->SetBufferSize(buffer_size));
@@ -223,7 +223,7 @@ TEST_F(TestCudaBufferWriter, EdgeCases) {
   Allocate(1000);
 
   std::shared_ptr<ResizableBuffer> buffer;
-  ASSERT_OK(test::MakeRandomByteBuffer(1000, default_memory_pool(), &buffer));
+  ASSERT_OK(MakeRandomByteBuffer(1000, default_memory_pool(), &buffer));
   const uint8_t* host_data = buffer->data();
 
   ASSERT_EQ(0, writer_->buffer_size());
@@ -274,7 +274,7 @@ TEST_F(TestCudaBufferReader, Basics) {
   ASSERT_OK(context_->Allocate(size, &device_buffer));
 
   std::shared_ptr<ResizableBuffer> buffer;
-  ASSERT_OK(test::MakeRandomByteBuffer(1000, default_memory_pool(), &buffer));
+  ASSERT_OK(MakeRandomByteBuffer(1000, default_memory_pool(), &buffer));
   const uint8_t* host_data = buffer->data();
 
   ASSERT_OK(device_buffer->CopyFromHost(0, host_data, 1000));
diff --git a/cpp/src/arrow/io/io-file-test.cc b/cpp/src/arrow/io/io-file-test.cc
index 29f3b09..75504f7 100644
--- a/cpp/src/arrow/io/io-file-test.cc
+++ b/cpp/src/arrow/io/io-file-test.cc
@@ -594,7 +594,7 @@ TEST_F(TestMemoryMappedFile, WriteRead) {
   const int64_t buffer_size = 1024;
   std::vector<uint8_t> buffer(buffer_size);
 
-  test::random_bytes(1024, 0, buffer.data());
+  random_bytes(1024, 0, buffer.data());
 
   const int reps = 5;
 
@@ -620,7 +620,7 @@ TEST_F(TestMemoryMappedFile, WriteResizeRead) {
   std::vector<std::vector<uint8_t>> buffers(reps);
   for (auto& b : buffers) {
     b.resize(buffer_size);
-    test::random_bytes(buffer_size, 0, b.data());
+    random_bytes(buffer_size, 0, b.data());
   }
 
   std::string path = "io-memory-map-write-read-test";
@@ -647,7 +647,7 @@ TEST_F(TestMemoryMappedFile, WriteResizeRead) {
 TEST_F(TestMemoryMappedFile, ResizeRaisesOnExported) {
   const int64_t buffer_size = 1024;
   std::vector<uint8_t> buffer(buffer_size);
-  test::random_bytes(buffer_size, 0, buffer.data());
+  random_bytes(buffer_size, 0, buffer.data());
 
   std::string path = "io-memory-map-write-read-test";
   std::shared_ptr<MemoryMappedFile> result;
@@ -683,7 +683,7 @@ TEST_F(TestMemoryMappedFile, ResizeRaisesOnExported) {
 TEST_F(TestMemoryMappedFile, WriteReadZeroInitSize) {
   const int64_t buffer_size = 1024;
   std::vector<uint8_t> buffer(buffer_size);
-  test::random_bytes(buffer_size, 0, buffer.data());
+  random_bytes(buffer_size, 0, buffer.data());
 
   std::string path = "io-memory-map-write-read-test";
   std::shared_ptr<MemoryMappedFile> result;
@@ -703,7 +703,7 @@ TEST_F(TestMemoryMappedFile, WriteReadZeroInitSize) {
 TEST_F(TestMemoryMappedFile, WriteThenShrink) {
   const int64_t buffer_size = 1024;
   std::vector<uint8_t> buffer(buffer_size);
-  test::random_bytes(buffer_size, 0, buffer.data());
+  random_bytes(buffer_size, 0, buffer.data());
 
   std::string path = "io-memory-map-write-read-test";
   std::shared_ptr<MemoryMappedFile> result;
@@ -729,7 +729,7 @@ TEST_F(TestMemoryMappedFile, WriteThenShrink) {
 TEST_F(TestMemoryMappedFile, WriteThenShrinkToHalfThenWrite) {
   const int64_t buffer_size = 1024;
   std::vector<uint8_t> buffer(buffer_size);
-  test::random_bytes(buffer_size, 0, buffer.data());
+  random_bytes(buffer_size, 0, buffer.data());
 
   std::string path = "io-memory-map-write-read-test";
   std::shared_ptr<MemoryMappedFile> result;
@@ -766,7 +766,7 @@ TEST_F(TestMemoryMappedFile, WriteThenShrinkToHalfThenWrite) {
 TEST_F(TestMemoryMappedFile, ResizeToZeroThanWrite) {
   const int64_t buffer_size = 1024;
   std::vector<uint8_t> buffer(buffer_size);
-  test::random_bytes(buffer_size, 0, buffer.data());
+  random_bytes(buffer_size, 0, buffer.data());
 
   std::string path = "io-memory-map-write-read-test";
   std::shared_ptr<MemoryMappedFile> result;
@@ -810,7 +810,7 @@ TEST_F(TestMemoryMappedFile, ResizeToZeroThanWrite) {
 TEST_F(TestMemoryMappedFile, WriteAt) {
   const int64_t buffer_size = 1024;
   std::vector<uint8_t> buffer(buffer_size);
-  test::random_bytes(buffer_size, 0, buffer.data());
+  random_bytes(buffer_size, 0, buffer.data());
 
   std::string path = "io-memory-map-write-read-test";
   std::shared_ptr<MemoryMappedFile> result;
@@ -830,7 +830,7 @@ TEST_F(TestMemoryMappedFile, WriteAt) {
 TEST_F(TestMemoryMappedFile, WriteBeyondEnd) {
   const int64_t buffer_size = 1024;
   std::vector<uint8_t> buffer(buffer_size);
-  test::random_bytes(buffer_size, 0, buffer.data());
+  random_bytes(buffer_size, 0, buffer.data());
 
   std::string path = "io-memory-map-write-read-test";
   std::shared_ptr<MemoryMappedFile> result;
@@ -848,7 +848,7 @@ TEST_F(TestMemoryMappedFile, WriteBeyondEnd) {
 TEST_F(TestMemoryMappedFile, WriteAtBeyondEnd) {
   const int64_t buffer_size = 1024;
   std::vector<uint8_t> buffer(buffer_size);
-  test::random_bytes(buffer_size, 0, buffer.data());
+  random_bytes(buffer_size, 0, buffer.data());
 
   std::string path = "io-memory-map-write-read-test";
   std::shared_ptr<MemoryMappedFile> result;
@@ -880,7 +880,7 @@ TEST_F(TestMemoryMappedFile, ReadOnly) {
   const int64_t buffer_size = 1024;
   std::vector<uint8_t> buffer(buffer_size);
 
-  test::random_bytes(1024, 0, buffer.data());
+  random_bytes(1024, 0, buffer.data());
 
   const int reps = 5;
 
@@ -914,7 +914,7 @@ TEST_F(TestMemoryMappedFile, DISABLED_ReadWriteOver4GbFile) {
   const int64_t buffer_size = 1000 * 1000;
   std::vector<uint8_t> buffer(buffer_size);
 
-  test::random_bytes(buffer_size, 0, buffer.data());
+  random_bytes(buffer_size, 0, buffer.data());
 
   const int64_t reps = 5000;
 
@@ -950,7 +950,7 @@ TEST_F(TestMemoryMappedFile, RetainMemoryMapReference) {
   const int64_t buffer_size = 1024;
   std::vector<uint8_t> buffer(buffer_size);
 
-  test::random_bytes(1024, 0, buffer.data());
+  random_bytes(1024, 0, buffer.data());
 
   std::string path = "ipc-read-only-test";
   CreateFile(path, buffer_size);
@@ -979,7 +979,7 @@ TEST_F(TestMemoryMappedFile, InvalidMode) {
   const int64_t buffer_size = 1024;
   std::vector<uint8_t> buffer(buffer_size);
 
-  test::random_bytes(1024, 0, buffer.data());
+  random_bytes(1024, 0, buffer.data());
 
   std::string path = "ipc-invalid-mode-test";
   CreateFile(path, buffer_size);
diff --git a/cpp/src/arrow/io/io-hdfs-test.cc b/cpp/src/arrow/io/io-hdfs-test.cc
index e02215b..e8f451c 100644
--- a/cpp/src/arrow/io/io-hdfs-test.cc
+++ b/cpp/src/arrow/io/io-hdfs-test.cc
@@ -42,7 +42,7 @@ namespace io {
 
 std::vector<uint8_t> RandomData(int64_t size) {
   std::vector<uint8_t> buffer(size);
-  test::random_bytes(size, 0, buffer.data());
+  random_bytes(size, 0, buffer.data());
   return buffer;
 }
 
diff --git a/cpp/src/arrow/io/io-memory-benchmark.cc b/cpp/src/arrow/io/io-memory-benchmark.cc
index b6ffa0e..72a5dc8 100644
--- a/cpp/src/arrow/io/io-memory-benchmark.cc
+++ b/cpp/src/arrow/io/io-memory-benchmark.cc
@@ -31,7 +31,7 @@ static void BM_SerialMemcopy(benchmark::State& state) {  // NOLINT non-const ref
   std::shared_ptr<Buffer> buffer1, buffer2;
   ABORT_NOT_OK(AllocateBuffer(kTotalSize, &buffer1));
   ABORT_NOT_OK(AllocateBuffer(kTotalSize, &buffer2));
-  test::random_bytes(kTotalSize, 0, buffer2->mutable_data());
+  random_bytes(kTotalSize, 0, buffer2->mutable_data());
 
   while (state.KeepRunning()) {
     io::FixedSizeBufferWriter writer(buffer1);
@@ -47,7 +47,7 @@ static void BM_ParallelMemcopy(benchmark::State& state) {  // NOLINT non-const r
   ABORT_NOT_OK(AllocateBuffer(kTotalSize, &buffer1));
   ABORT_NOT_OK(AllocateBuffer(kTotalSize, &buffer2));
 
-  test::random_bytes(kTotalSize, 0, buffer2->mutable_data());
+  random_bytes(kTotalSize, 0, buffer2->mutable_data());
 
   while (state.KeepRunning()) {
     io::FixedSizeBufferWriter writer(buffer1);
diff --git a/cpp/src/arrow/io/io-memory-test.cc b/cpp/src/arrow/io/io-memory-test.cc
index 62305a6..b2f3f18 100644
--- a/cpp/src/arrow/io/io-memory-test.cc
+++ b/cpp/src/arrow/io/io-memory-test.cc
@@ -147,7 +147,7 @@ TEST(TestMemcopy, ParallelMemcopy) {
     ASSERT_OK(AllocateBuffer(total_size, &buffer1));
     ASSERT_OK(AllocateBuffer(total_size, &buffer2));
 
-    test::random_bytes(total_size, 0, buffer2->mutable_data());
+    random_bytes(total_size, 0, buffer2->mutable_data());
 
     io::FixedSizeBufferWriter writer(buffer1);
     writer.set_memcopy_threads(4);
diff --git a/cpp/src/arrow/ipc/ipc-json-test.cc b/cpp/src/arrow/ipc/ipc-json-test.cc
index adf83c3..549a93c 100644
--- a/cpp/src/arrow/ipc/ipc-json-test.cc
+++ b/cpp/src/arrow/ipc/ipc-json-test.cc
@@ -183,8 +183,8 @@ TEST(TestJsonArrayWriter, NestedTypes) {
   std::vector<int32_t> offsets = {0, 0, 0, 1, 4, 7};
 
   std::shared_ptr<Buffer> list_bitmap;
-  ASSERT_OK(test::GetBitmapFromVector(list_is_valid, &list_bitmap));
-  std::shared_ptr<Buffer> offsets_buffer = test::GetBufferFromVector(offsets);
+  ASSERT_OK(GetBitmapFromVector(list_is_valid, &list_bitmap));
+  std::shared_ptr<Buffer> offsets_buffer = GetBufferFromVector(offsets);
 
   ListArray list_array(list(value_type), 5, offsets_buffer, values_array, list_bitmap, 1);
 
@@ -193,7 +193,7 @@ TEST(TestJsonArrayWriter, NestedTypes) {
   // Struct
   std::vector<bool> struct_is_valid = {true, false, true, true, true, false, true};
   std::shared_ptr<Buffer> struct_bitmap;
-  ASSERT_OK(test::GetBitmapFromVector(struct_is_valid, &struct_bitmap));
+  ASSERT_OK(GetBitmapFromVector(struct_is_valid, &struct_bitmap));
 
   auto struct_type =
       struct_({field("f1", int32()), field("f2", int32()), field("f3", int32())});
@@ -218,13 +218,13 @@ TEST(TestJsonArrayWriter, Unions) {
 void MakeBatchArrays(const std::shared_ptr<Schema>& schema, const int num_rows,
                      std::vector<std::shared_ptr<Array>>* arrays) {
   std::vector<bool> is_valid;
-  test::random_is_valid(num_rows, 0.25, &is_valid);
+  random_is_valid(num_rows, 0.25, &is_valid);
 
   std::vector<int8_t> v1_values;
   std::vector<int32_t> v2_values;
 
-  test::randint(num_rows, 0, 100, &v1_values);
-  test::randint(num_rows, 0, 100, &v2_values);
+  randint(num_rows, 0, 100, &v1_values);
+  randint(num_rows, 0, 100, &v2_values);
 
   std::shared_ptr<Array> v1;
   ArrayFromVector<Int8Type, int8_t>(is_valid, v1_values, &v1);
@@ -240,7 +240,7 @@ void MakeBatchArrays(const std::shared_ptr<Schema>& schema, const int num_rows,
     if (!is_valid[i]) {
       ASSERT_OK(string_builder.AppendNull());
     } else {
-      test::random_ascii(kBufferSize, seed++, buffer);
+      random_ascii(kBufferSize, seed++, buffer);
       ASSERT_OK(string_builder.Append(buffer, kBufferSize));
     }
   }
diff --git a/cpp/src/arrow/ipc/ipc-read-write-benchmark.cc b/cpp/src/arrow/ipc/ipc-read-write-benchmark.cc
index 2523394..ace2965 100644
--- a/cpp/src/arrow/ipc/ipc-read-write-benchmark.cc
+++ b/cpp/src/arrow/ipc/ipc-read-write-benchmark.cc
@@ -37,10 +37,10 @@ std::shared_ptr<RecordBatch> MakeRecordBatch(int64_t total_size, int64_t num_fie
   auto type = TypeTraits<TYPE>::type_singleton();
 
   std::vector<bool> is_valid;
-  test::random_is_valid(length, 0.1, &is_valid);
+  random_is_valid(length, 0.1, &is_valid);
 
   std::vector<T> values;
-  test::randint<T>(length, 0, 100, &values);
+  randint<T>(length, 0, 100, &values);
 
   typename TypeTraits<TYPE>::BuilderType builder(type, default_memory_pool());
   for (size_t i = 0; i < values.size(); ++i) {
diff --git a/cpp/src/arrow/ipc/ipc-read-write-test.cc b/cpp/src/arrow/ipc/ipc-read-write-test.cc
index f6e49ea..37127cb 100644
--- a/cpp/src/arrow/ipc/ipc-read-write-test.cc
+++ b/cpp/src/arrow/ipc/ipc-read-write-test.cc
@@ -351,7 +351,7 @@ TEST_F(TestWriteRecordBatch, SliceTruncatesBuffers) {
   auto union_type = union_({field("f0", a0->type())}, {0});
   std::vector<int32_t> type_ids(a0->length());
   std::shared_ptr<Buffer> ids_buffer;
-  ASSERT_OK(test::CopyBufferFromVector(type_ids, default_memory_pool(), &ids_buffer));
+  ASSERT_OK(CopyBufferFromVector(type_ids, default_memory_pool(), &ids_buffer));
   a1 =
       std::make_shared<UnionArray>(union_type, a0->length(), struct_children, ids_buffer);
   CheckArray(a1);
@@ -363,8 +363,7 @@ TEST_F(TestWriteRecordBatch, SliceTruncatesBuffers) {
     type_offsets.push_back(i);
   }
   std::shared_ptr<Buffer> offsets_buffer;
-  ASSERT_OK(
-      test::CopyBufferFromVector(type_offsets, default_memory_pool(), &offsets_buffer));
+  ASSERT_OK(CopyBufferFromVector(type_offsets, default_memory_pool(), &offsets_buffer));
   a1 = std::make_shared<UnionArray>(dense_union_type, a0->length(), struct_children,
                                     ids_buffer, offsets_buffer);
   CheckArray(a1);
@@ -748,9 +747,9 @@ TEST_F(TestTensorRoundTrip, BasicRoundtrip) {
   int64_t size = 24;
 
   std::vector<int64_t> values;
-  test::randint(size, 0, 100, &values);
+  randint(size, 0, 100, &values);
 
-  auto data = test::GetBufferFromVector(values);
+  auto data = GetBufferFromVector(values);
 
   Tensor t0(int64(), data, shape, strides, dim_names);
   Tensor tzero(int64(), data, {}, {}, {});
@@ -769,9 +768,9 @@ TEST_F(TestTensorRoundTrip, NonContiguous) {
   ASSERT_OK(io::MemoryMapFixture::InitMemoryMap(kBufferSize, path, &mmap_));
 
   std::vector<int64_t> values;
-  test::randint(24, 0, 100, &values);
+  randint(24, 0, 100, &values);
 
-  auto data = test::GetBufferFromVector(values);
+  auto data = GetBufferFromVector(values);
   Tensor tensor(int64(), data, {4, 3}, {48, 16});
 
   CheckTensorRoundTrip(tensor);
diff --git a/cpp/src/arrow/ipc/test-common.h b/cpp/src/arrow/ipc/test-common.h
index 4579615..299f050 100644
--- a/cpp/src/arrow/ipc/test-common.h
+++ b/cpp/src/arrow/ipc/test-common.h
@@ -98,12 +98,12 @@ const auto kListListInt32 = list(kListInt32);
 Status MakeRandomInt32Array(int64_t length, bool include_nulls, MemoryPool* pool,
                             std::shared_ptr<Array>* out) {
   std::shared_ptr<ResizableBuffer> data;
-  RETURN_NOT_OK(test::MakeRandomInt32Buffer(length, pool, &data));
+  RETURN_NOT_OK(MakeRandomInt32Buffer(length, pool, &data));
   Int32Builder builder(int32(), pool);
   RETURN_NOT_OK(builder.Resize(length));
   if (include_nulls) {
     std::shared_ptr<ResizableBuffer> valid_bytes;
-    RETURN_NOT_OK(test::MakeRandomByteBuffer(length, pool, &valid_bytes));
+    RETURN_NOT_OK(MakeRandomByteBuffer(length, pool, &valid_bytes));
     RETURN_NOT_OK(builder.AppendValues(reinterpret_cast<const int32_t*>(data->data()),
                                        length, valid_bytes->data()));
     return builder.Finish(out);
@@ -119,7 +119,7 @@ Status MakeRandomListArray(const std::shared_ptr<Array>& child_array, int num_li
   // Create the null list values
   std::vector<uint8_t> valid_lists(num_lists);
   const double null_percent = include_nulls ? 0.1 : 0;
-  test::random_null_bytes(num_lists, null_percent, valid_lists.data());
+  random_null_bytes(num_lists, null_percent, valid_lists.data());
 
   // Create list offsets
   const int max_list_size = 10;
@@ -130,7 +130,7 @@ Status MakeRandomListArray(const std::shared_ptr<Array>& child_array, int num_li
   const uint32_t seed = static_cast<uint32_t>(child_array->length());
 
   if (num_lists > 0) {
-    test::rand_uniform_int(num_lists, seed, 0, max_list_size, list_sizes.data());
+    rand_uniform_int(num_lists, seed, 0, max_list_size, list_sizes.data());
     // make sure sizes are consistent with null
     std::transform(list_sizes.begin(), list_sizes.end(), valid_lists.begin(),
                    list_sizes.begin(),
@@ -149,8 +149,8 @@ Status MakeRandomListArray(const std::shared_ptr<Array>& child_array, int num_li
 
   /// TODO(wesm): Implement support for nulls in ListArray::FromArrays
   std::shared_ptr<Buffer> null_bitmap, offsets_buffer;
-  RETURN_NOT_OK(test::GetBitmapFromVector(valid_lists, &null_bitmap));
-  RETURN_NOT_OK(test::CopyBufferFromVector(offsets, pool, &offsets_buffer));
+  RETURN_NOT_OK(GetBitmapFromVector(valid_lists, &null_bitmap));
+  RETURN_NOT_OK(CopyBufferFromVector(offsets, pool, &offsets_buffer));
 
   *out = std::make_shared<ListArray>(list(child_array->type()), num_lists, offsets_buffer,
                                      child_array, null_bitmap, kUnknownNullCount);
@@ -162,7 +162,7 @@ typedef Status MakeRecordBatch(std::shared_ptr<RecordBatch>* out);
 Status MakeRandomBooleanArray(const int length, bool include_nulls,
                               std::shared_ptr<Array>* out) {
   std::vector<uint8_t> values(length);
-  test::random_null_bytes(length, 0.5, values.data());
+  random_null_bytes(length, 0.5, values.data());
   std::shared_ptr<Buffer> data;
   RETURN_NOT_OK(BitUtil::BytesToBits(values, default_memory_pool(), &data));
 
@@ -170,7 +170,7 @@ Status MakeRandomBooleanArray(const int length, bool include_nulls,
     std::vector<uint8_t> valid_bytes(length);
     std::shared_ptr<Buffer> null_bitmap;
     RETURN_NOT_OK(BitUtil::BytesToBits(valid_bytes, default_memory_pool(), &null_bitmap));
-    test::random_null_bytes(length, 0.1, valid_bytes.data());
+    random_null_bytes(length, 0.1, valid_bytes.data());
     *out = std::make_shared<BooleanArray>(length, data, null_bitmap, -1);
   } else {
     *out = std::make_shared<BooleanArray>(length, data, NULLPTR, 0);
@@ -433,8 +433,7 @@ Status MakeUnion(std::shared_ptr<RecordBatch>* out) {
 
   std::shared_ptr<Buffer> type_ids_buffer;
   std::vector<uint8_t> type_ids = {5, 10, 5, 5, 10, 10, 5};
-  RETURN_NOT_OK(
-      test::CopyBufferFromVector(type_ids, default_memory_pool(), &type_ids_buffer));
+  RETURN_NOT_OK(CopyBufferFromVector(type_ids, default_memory_pool(), &type_ids_buffer));
 
   std::vector<int32_t> u0_values = {0, 1, 2, 3, 4, 5, 6};
   ArrayFromVector<Int32Type, int32_t>(u0_values, &sparse_children[0]);
@@ -451,8 +450,7 @@ Status MakeUnion(std::shared_ptr<RecordBatch>* out) {
 
   std::shared_ptr<Buffer> offsets_buffer;
   std::vector<int32_t> offsets = {0, 0, 1, 2, 1, 2, 3};
-  RETURN_NOT_OK(
-      test::CopyBufferFromVector(offsets, default_memory_pool(), &offsets_buffer));
+  RETURN_NOT_OK(CopyBufferFromVector(offsets, default_memory_pool(), &offsets_buffer));
 
   std::vector<uint8_t> null_bytes(length, 1);
   null_bytes[2] = 0;
@@ -517,7 +515,7 @@ Status MakeDictionary(std::shared_ptr<RecordBatch>* out) {
   ArrayFromVector<Int8Type, int8_t>(is_valid3, indices3_values, &indices3);
 
   std::shared_ptr<Buffer> null_bitmap;
-  RETURN_NOT_OK(test::GetBitmapFromVector(is_valid, &null_bitmap));
+  RETURN_NOT_OK(GetBitmapFromVector(is_valid, &null_bitmap));
 
   std::shared_ptr<Array> a3 = std::make_shared<ListArray>(
       f3_type, length, std::static_pointer_cast<PrimitiveArray>(offsets)->values(),
@@ -707,8 +705,8 @@ Status MakeDecimal(std::shared_ptr<RecordBatch>* out) {
 
   RETURN_NOT_OK(AllocateBuffer(kDecimalSize * length, &data));
 
-  test::random_decimals(length, 1, kDecimalPrecision, data->mutable_data());
-  test::random_null_bytes(length, 0.1, is_valid_bytes.data());
+  random_decimals(length, 1, kDecimalPrecision, data->mutable_data());
+  random_null_bytes(length, 0.1, is_valid_bytes.data());
 
   RETURN_NOT_OK(BitUtil::BytesToBits(is_valid_bytes, default_memory_pool(), &is_valid));
 
diff --git a/cpp/src/arrow/memory_pool-test.cc b/cpp/src/arrow/memory_pool-test.cc
index 4cd01d3..c2c8146 100644
--- a/cpp/src/arrow/memory_pool-test.cc
+++ b/cpp/src/arrow/memory_pool-test.cc
@@ -25,7 +25,7 @@
 
 namespace arrow {
 
-class TestDefaultMemoryPool : public ::arrow::test::TestMemoryPoolBase {
+class TestDefaultMemoryPool : public ::arrow::TestMemoryPoolBase {
  public:
   ::arrow::MemoryPool* memory_pool() override { return ::arrow::default_memory_pool(); }
 };
diff --git a/cpp/src/arrow/memory_pool-test.h b/cpp/src/arrow/memory_pool-test.h
index f583da5..27ec718 100644
--- a/cpp/src/arrow/memory_pool-test.h
+++ b/cpp/src/arrow/memory_pool-test.h
@@ -26,8 +26,6 @@
 
 namespace arrow {
 
-namespace test {
-
 class TestMemoryPoolBase : public ::testing::Test {
  public:
   virtual ::arrow::MemoryPool* memory_pool() = 0;
@@ -84,5 +82,4 @@ class TestMemoryPoolBase : public ::testing::Test {
   }
 };
 
-}  // namespace test
 }  // namespace arrow
diff --git a/cpp/src/arrow/table-test.cc b/cpp/src/arrow/table-test.cc
index f178e61..dfd8b63 100644
--- a/cpp/src/arrow/table-test.cc
+++ b/cpp/src/arrow/table-test.cc
@@ -118,11 +118,11 @@ TEST_F(TestChunkedArray, SliceEquals) {
 
   std::shared_ptr<ChunkedArray> slice = one_->Slice(125, 50);
   ASSERT_EQ(slice->length(), 50);
-  test::AssertChunkedEqual(*one_->Slice(125, 50), *slice);
+  AssertChunkedEqual(*one_->Slice(125, 50), *slice);
 
   std::shared_ptr<ChunkedArray> slice2 = one_->Slice(75)->Slice(25)->Slice(25, 50);
   ASSERT_EQ(slice2->length(), 50);
-  test::AssertChunkedEqual(*slice, *slice2);
+  AssertChunkedEqual(*slice, *slice2);
 
   // Making empty slices of a ChunkedArray
   std::shared_ptr<ChunkedArray> slice3 = one_->Slice(one_->length(), 99);
@@ -420,7 +420,7 @@ TEST_F(TestTable, ConcatenateTables) {
 
   ASSERT_OK(ConcatenateTables({t1, t2}, &result));
   ASSERT_OK(Table::FromRecordBatches({batch1, batch2}, &expected));
-  test::AssertTablesEqual(*expected, *result);
+  AssertTablesEqual(*expected, *result);
 
   // Error states
   std::vector<std::shared_ptr<Table>> empty_tables;
diff --git a/cpp/src/arrow/test-common.h b/cpp/src/arrow/test-common.h
index fd43d53..9cd8ffd 100644
--- a/cpp/src/arrow/test-common.h
+++ b/cpp/src/arrow/test-common.h
@@ -68,7 +68,7 @@ std::shared_ptr<Array> TestBase::MakeRandomArray(int64_t length, int64_t null_co
   EXPECT_OK(AllocateBuffer(pool_, data_nbytes, &data));
 
   // Fill with random data
-  test::random_bytes(data_nbytes, random_seed_++, data->mutable_data());
+  random_bytes(data_nbytes, random_seed_++, data->mutable_data());
   std::shared_ptr<Buffer> null_bitmap = MakeRandomNullBitmap(length, null_count);
 
   return std::make_shared<ArrayType>(length, data, null_bitmap, null_count);
@@ -88,7 +88,7 @@ std::shared_ptr<Array> TestBase::MakeRandomArray<FixedSizeBinaryArray>(
   std::shared_ptr<Buffer> data;
   EXPECT_OK(AllocateBuffer(pool_, byte_width * length, &data));
 
-  ::arrow::test::random_bytes(data->size(), 0, data->mutable_data());
+  ::arrow::random_bytes(data->size(), 0, data->mutable_data());
   return std::make_shared<FixedSizeBinaryArray>(fixed_size_binary(byte_width), length,
                                                 data, null_bitmap, null_count);
 }
@@ -108,7 +108,7 @@ std::shared_ptr<Array> TestBase::MakeRandomArray<BinaryArray>(int64_t length,
     if (!valid_bytes[i]) {
       EXPECT_OK(builder.AppendNull());
     } else {
-      ::arrow::test::random_bytes(kBufferSize, static_cast<uint32_t>(i), buffer);
+      ::arrow::random_bytes(kBufferSize, static_cast<uint32_t>(i), buffer);
       EXPECT_OK(builder.Append(buffer, kBufferSize));
     }
   }
diff --git a/cpp/src/arrow/test-util.h b/cpp/src/arrow/test-util.h
index fff0ee1..69f413e 100644
--- a/cpp/src/arrow/test-util.h
+++ b/cpp/src/arrow/test-util.h
@@ -93,8 +93,6 @@ using ArrayVector = std::vector<std::shared_ptr<Array>>;
     }                                                                                  \
   } while (false)
 
-namespace test {
-
 template <typename T, typename U>
 void randint(int64_t N, T lower, T upper, std::vector<U>* out) {
   const int random_seed = 0;
@@ -280,7 +278,7 @@ static inline void random_ascii(int64_t n, uint32_t seed, uint8_t* out) {
   rand_uniform_int(n, seed, static_cast<int32_t>('A'), static_cast<int32_t>('z'), out);
 }
 
-static inline int64_t null_count(const std::vector<uint8_t>& valid_bytes) {
+static inline int64_t CountNulls(const std::vector<uint8_t>& valid_bytes) {
   return static_cast<int64_t>(std::count(valid_bytes.cbegin(), valid_bytes.cend(), '\0'));
 }
 
@@ -289,8 +287,8 @@ Status MakeRandomInt32Buffer(int64_t length, MemoryPool* pool,
   DCHECK(pool);
   std::shared_ptr<ResizableBuffer> result;
   RETURN_NOT_OK(AllocateResizableBuffer(pool, sizeof(int32_t) * length, &result));
-  test::rand_uniform_int(length, seed, 0, std::numeric_limits<int32_t>::max(),
-                         reinterpret_cast<int32_t*>(result->mutable_data()));
+  rand_uniform_int(length, seed, 0, std::numeric_limits<int32_t>::max(),
+                   reinterpret_cast<int32_t*>(result->mutable_data()));
   *out = result;
   return Status::OK();
 }
@@ -299,7 +297,7 @@ Status MakeRandomByteBuffer(int64_t length, MemoryPool* pool,
                             std::shared_ptr<ResizableBuffer>* out, uint32_t seed = 0) {
   std::shared_ptr<ResizableBuffer> result;
   RETURN_NOT_OK(AllocateResizableBuffer(pool, length, &result));
-  test::random_bytes(length, seed, result->mutable_data());
+  random_bytes(length, seed, result->mutable_data());
   *out = result;
   return Status::OK();
 }
@@ -368,8 +366,6 @@ void AssertTablesEqual(const Table& expected, const Table& actual,
   }
 }
 
-}  // namespace test
-
 template <typename TYPE, typename C_TYPE>
 void ArrayFromVector(const std::shared_ptr<DataType>& type,
                      const std::vector<bool>& is_valid, const std::vector<C_TYPE>& values,
diff --git a/cpp/src/arrow/util/bit-util-benchmark.cc b/cpp/src/arrow/util/bit-util-benchmark.cc
index 305a9d2..541f863 100644
--- a/cpp/src/arrow/util/bit-util-benchmark.cc
+++ b/cpp/src/arrow/util/bit-util-benchmark.cc
@@ -86,7 +86,7 @@ static std::shared_ptr<Buffer> CreateRandomBuffer(int64_t nbytes) {
   std::shared_ptr<Buffer> buffer;
   ABORT_NOT_OK(AllocateBuffer(nbytes, &buffer));
   memset(buffer->mutable_data(), 0, nbytes);
-  test::random_bytes(nbytes, 0, buffer->mutable_data());
+  random_bytes(nbytes, 0, buffer->mutable_data());
   return buffer;
 }
 
diff --git a/cpp/src/arrow/util/bit-util-test.cc b/cpp/src/arrow/util/bit-util-test.cc
index 87202fc..adb09e1 100644
--- a/cpp/src/arrow/util/bit-util-test.cc
+++ b/cpp/src/arrow/util/bit-util-test.cc
@@ -302,7 +302,7 @@ TYPED_TEST_CASE(TestGenerateBits, GenerateBitsTypes);
 TYPED_TEST(TestGenerateBits, NormalOperation) {
   const int kSourceSize = 256;
   uint8_t source[kSourceSize];
-  test::random_bytes(kSourceSize, 0, source);
+  random_bytes(kSourceSize, 0, source);
 
   const int64_t start_offsets[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 21, 31, 32};
   const int64_t lengths[] = {0,  1,  2,  3,  4,   5,   6,   7,   8,   9,   12,  16,
@@ -410,7 +410,7 @@ TEST(BitUtilTests, TestCountSetBits) {
   const int kBufferSize = 1000;
   uint8_t buffer[kBufferSize] = {0};
 
-  test::random_bytes(kBufferSize, 0, buffer);
+  random_bytes(kBufferSize, 0, buffer);
 
   const int num_bits = kBufferSize * 8;
 
@@ -430,7 +430,7 @@ TEST(BitUtilTests, TestCopyBitmap) {
   std::shared_ptr<Buffer> buffer;
   ASSERT_OK(AllocateBuffer(kBufferSize, &buffer));
   memset(buffer->mutable_data(), 0, kBufferSize);
-  test::random_bytes(kBufferSize, 0, buffer->mutable_data());
+  random_bytes(kBufferSize, 0, buffer->mutable_data());
 
   const uint8_t* src = buffer->data();
 
diff --git a/cpp/src/arrow/util/compression-test.cc b/cpp/src/arrow/util/compression-test.cc
index 84a8d7c..6d8192b 100644
--- a/cpp/src/arrow/util/compression-test.cc
+++ b/cpp/src/arrow/util/compression-test.cc
@@ -73,7 +73,7 @@ void CheckCodec() {
   int sizes[] = {0, 10000, 100000};
   for (int data_size : sizes) {
     vector<uint8_t> data(data_size);
-    test::random_bytes(data_size, 1234, data.data());
+    random_bytes(data_size, 1234, data.data());
     CheckCodecRoundtrip<CODEC>(data);
   }
 }
diff --git a/cpp/src/arrow/util/lazy-benchmark.cc b/cpp/src/arrow/util/lazy-benchmark.cc
index 4ec1b07..0b10ce1 100644
--- a/cpp/src/arrow/util/lazy-benchmark.cc
+++ b/cpp/src/arrow/util/lazy-benchmark.cc
@@ -31,7 +31,7 @@ static constexpr int64_t kSize = 100000000;
 template <typename T = int32_t>
 std::vector<T> generate_junk(int64_t size) {
   std::vector<T> v(size);
-  test::randint(size, 0, 100000, &v);
+  randint(size, 0, 100000, &v);
   return v;
 }
 
diff --git a/cpp/src/arrow/util/lazy-test.cc b/cpp/src/arrow/util/lazy-test.cc
index 83cc6a0..af8a9ec 100644
--- a/cpp/src/arrow/util/lazy-test.cc
+++ b/cpp/src/arrow/util/lazy-test.cc
@@ -28,7 +28,7 @@ class TestLazyIter : public ::testing::Test {
  public:
   int64_t kSize = 1000;
   void SetUp() {
-    test::randint(kSize, 0, 1000000, &source_);
+    randint(kSize, 0, 1000000, &source_);
     target_.resize(kSize);
   }
 
diff --git a/cpp/src/plasma/test/client_tests.cc b/cpp/src/plasma/test/client_tests.cc
index a945ce6..a2418ac 100644
--- a/cpp/src/plasma/test/client_tests.cc
+++ b/cpp/src/plasma/test/client_tests.cc
@@ -42,8 +42,8 @@ std::string test_executable;  // NOLINT
 void AssertObjectBufferEqual(const ObjectBuffer& object_buffer,
                              const std::vector<uint8_t>& metadata,
                              const std::vector<uint8_t>& data) {
-  arrow::test::AssertBufferEqual(*object_buffer.metadata, metadata);
-  arrow::test::AssertBufferEqual(*object_buffer.data, data);
+  arrow::AssertBufferEqual(*object_buffer.metadata, metadata);
+  arrow::AssertBufferEqual(*object_buffer.data, data);
 }
 
 class TestPlasmaStore : public ::testing::Test {
@@ -288,7 +288,7 @@ TEST_F(TestPlasmaStore, GetTest) {
   {
     auto metadata = object_buffers[0].metadata;
     object_buffers.clear();
-    ::arrow::test::AssertBufferEqual(*metadata, {42});
+    ::arrow::AssertBufferEqual(*metadata, {42});
     ARROW_CHECK_OK(client_.FlushReleaseHistory());
     EXPECT_TRUE(client_.IsInUse(object_id));
   }