Bitcoin Core 31.99.0
P2P Digital Currency
system_ram_tests.cpp
Go to the documentation of this file.
1// Copyright (c) 2025-present The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or https://opensource.org/license/mit/.
4
5#include <common/system.h>
6#include <util/byte_units.h>
7
8#include <boost/test/unit_test.hpp>
9
10BOOST_AUTO_TEST_SUITE(system_ram_tests)
11
13{
14 const auto total{TryGetTotalRam()};
15 BOOST_REQUIRE(total);
16 BOOST_CHECK_GE(*total, 1_GiB);
17 BOOST_CHECK_LT(*total, 10'000_GiB); // ~10 TiB memory is unlikely
18}
19
std::optional< uint64_t > TryGetTotalRam()
Return the total RAM available on the current system, if detectable.
Definition: system.cpp:114
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(total_ram)