mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-13 07:23:21 +02:00
This follows the approach of the MiB and GiB operators. This allows to remove some `if constexpr (SIZE_MAX == UINT64_MAX)` in the tests.
28 lines
692 B
C++
28 lines
692 B
C++
// Copyright (c) 2025-present The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or https://opensource.org/license/mit/.
|
|
|
|
#include <common/system.h>
|
|
#include <test/util/setup_common.h>
|
|
|
|
#include <boost/test/unit_test.hpp>
|
|
|
|
#include <cstdint>
|
|
#include <optional>
|
|
|
|
BOOST_AUTO_TEST_SUITE(system_ram_tests)
|
|
|
|
BOOST_AUTO_TEST_CASE(total_ram)
|
|
{
|
|
const auto total{GetTotalRAM()};
|
|
if (!total) {
|
|
BOOST_WARN_MESSAGE(false, "skipping total_ram: total RAM unknown");
|
|
return;
|
|
}
|
|
|
|
BOOST_CHECK_GE(*total, 1000_MiB);
|
|
BOOST_CHECK_LT(*total, 10'000_GiB); // ~10 TiB memory is unlikely
|
|
}
|
|
|
|
BOOST_AUTO_TEST_SUITE_END()
|