From 8d6d5080937e92ba126ba9034794643c96c1fb35 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 25 Oct 2024 20:52:35 +0300 Subject: [PATCH] Incorporate test/hash_append_2.cpp into append_array.cpp --- test/Jamfile | 1 - test/append_array.cpp | 20 +++++------ test/hash_append_2.cpp | 79 ------------------------------------------ 3 files changed, 9 insertions(+), 91 deletions(-) delete mode 100644 test/hash_append_2.cpp diff --git a/test/Jamfile b/test/Jamfile index c806955..d2d029a 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -42,7 +42,6 @@ run detail_reverse.cpp ; # hash_append -run hash_append_2.cpp ; run hash_append_3.cpp ; run hash_append_4.cpp ; run hash_append_5.cpp ; diff --git a/test/append_array.cpp b/test/append_array.cpp index f33ee76..69851fc 100644 --- a/test/append_array.cpp +++ b/test/append_array.cpp @@ -1,8 +1,6 @@ -// Copyright 2017 Peter Dimov. +// Copyright 2017, 2024 Peter Dimov. // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -// -// Endian-independent test #include #include @@ -10,12 +8,12 @@ #include #include -template void test( R r ) +template void test( R r ) { Flavor f; { - unsigned char v[4] = { 1, 2, 3, 4 }; + T v[4] = { 1, 2, 3, 4 }; Hash h; @@ -28,7 +26,7 @@ template void test( R r ) } { - unsigned char v[4] = { 1, 2, 3, 4 }; + T v[4] = { 1, 2, 3, 4 }; Hash h; @@ -38,7 +36,7 @@ template void test( R r ) } { - unsigned char v[2][2] = { { 1, 2 }, { 3, 4 } }; + T v[2][2] = { { 1, 2 }, { 3, 4 } }; Hash h; @@ -48,7 +46,7 @@ template void test( R r ) } { - boost::array v = {{ 1, 2, 3, 4 }}; + boost::array v = {{ 1, 2, 3, 4 }}; Hash h; @@ -58,7 +56,7 @@ template void test( R r ) } { - std::array v = {{ 1, 2, 3, 4 }}; + std::array v = {{ 1, 2, 3, 4 }}; Hash h; @@ -72,8 +70,8 @@ int main() { using namespace boost::hash2; - test( 1463068797ul ); - test( 13725386680924731485ull ); + test( 1463068797 ); + test( 1041505217 ); return boost::report_errors(); } diff --git a/test/hash_append_2.cpp b/test/hash_append_2.cpp deleted file mode 100644 index 5006b06..0000000 --- a/test/hash_append_2.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2017 Peter Dimov. -// Distributed under the Boost Software License, Version 1.0. -// https://www.boost.org/LICENSE_1_0.txt -// -// Endian-dependent test - -#include -#include -#include -#include -#include - -template void test( R r ) -{ - Flavor f; - - { - int v[4] = { 1, 2, 3, 4 }; - - Hash h; - - hash_append( h, f, v[0] ); - hash_append( h, f, v[1] ); - hash_append( h, f, v[2] ); - hash_append( h, f, v[3] ); - - BOOST_TEST_EQ( h.result(), r ); - } - - { - int v[4] = { 1, 2, 3, 4 }; - - Hash h; - - hash_append( h, f, v ); - - BOOST_TEST_EQ( h.result(), r ); - } - - { - int v[2][2] = { { 1, 2 }, { 3, 4 } }; - - Hash h; - - hash_append( h, f, v ); - - BOOST_TEST_EQ( h.result(), r ); - } - - { - boost::array v = {{ 1, 2, 3, 4 }}; - - Hash h; - - hash_append( h, f, v ); - - BOOST_TEST_EQ( h.result(), r ); - } - - { - std::array v = {{ 1, 2, 3, 4 }}; - - Hash h; - - hash_append( h, f, v ); - - BOOST_TEST_EQ( h.result(), r ); - } -} - -int main() -{ - using namespace boost::hash2; - - test( 1041505217ul ); - test( 9566659391000707361ull ); - - return boost::report_errors(); -}