diff --git a/src/Makefile.test-hush.include b/src/Makefile.test-hush.include index e8d1f823c..022e0cf09 100644 --- a/src/Makefile.test-hush.include +++ b/src/Makefile.test-hush.include @@ -7,15 +7,13 @@ bin_PROGRAMS += hush-test # tool for generating our public parameters hush_test_SOURCES = test-hush/main.cpp \ - test-hush/test_netbase_tests.cpp + test-hush/test_netbase_tests.cpp \ + test-hush/randomx.cpp # test-hush/testutils.cpp \ # test-hush/test_cryptoconditions.cpp \ # test-hush/test_coinimport.cpp \ # test-hush/test_addrman.cpp hush_test_CPPFLAGS = $(hushd_CPPFLAGS) - -#hush_test_LDADD = -lgtest $(hushd_LDADD) -hush_test_LDADD = $(hushd_LDADD) - -hush_test_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -static +hush_test_LDADD = $(hushd_LDADD) +hush_test_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -static diff --git a/src/test-hush/randomx.cpp b/src/test-hush/randomx.cpp new file mode 100644 index 000000000..127565f74 --- /dev/null +++ b/src/test-hush/randomx.cpp @@ -0,0 +1,44 @@ +// Copyright (c) 2016-now The Hush developers +// Distributed under the GPLv3 software license, see the accompanying +// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html +#include +#include + +#include "addrman.h" +#include +#include "netbase.h" +#include +#include "RandomX/src/randomx.h" + +BOOST_AUTO_TEST_SUITE(randomx) + +BOOST_AUTO_TEST_CASE(test_basic) { + randomx_flags flags = randomx_get_flags(); + randomx_cache *randomxCache = randomx_alloc_cache(flags); + BOOST_CHECK_MESSAGE(randomxCache != NULL, "randomxCache is not null"); + + randomx_dataset *randomxDataset = randomx_alloc_dataset(flags); + BOOST_CHECK_MESSAGE(randomxDataset != NULL, "randomxDataset is not null"); + + auto datasetItemCount = randomx_dataset_item_count(); + BOOST_CHECK_MESSAGE( datasetItemCount > 0, "datasetItemCount is positive"); + + // unknown location(0): fatal error: in "randomx/test_basic": memory access violation at address: 0x7f6983ce2000: invalid permissions + + /* TODO + randomx_init_dataset(randomxDataset, randomxCache, 0, datasetItemCount); + + char randomxHash[RANDOMX_HASH_SIZE]; + randomx_vm *myVM = nullptr; + + myVM = randomx_create_vm(flags, nullptr, randomxDataset); + BOOST_CHECK_MESSAGE(myVM != NULL, "randomx_vm is not null"); + + CDataStream randomxInput(SER_NETWORK, PROTOCOL_VERSION); + randomxInput << "stuff and things"; + randomx_calculate_hash(myVM, &randomxInput, sizeof randomxInput, randomxHash); + */ +} + +BOOST_AUTO_TEST_SUITE_END() +