Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
property_config.hpp
Go to the documentation of this file.
1// Copyright 2026, Toyota Motor Corporation
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TESTING_PROPERTY_CONFIG_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TESTING_PROPERTY_CONFIG_HPP_
7
8#include "arene/base/stdlib_choice/cstddef.hpp"
9#include "arene/base/stdlib_choice/cstdint.hpp"
11
12namespace arene {
13namespace base {
14namespace testing {
15
16/// @brief environment variable name controlling @c property_config::required_successes
18 arene::base::null_terminated_string_view{"ARENE_PROP_PARAM_REQUIRED_SUCCESSES"};
19/// @brief environment variable name controlling @c property_config::max_discards
20constexpr auto max_discards_env_name = arene::base::null_terminated_string_view{"ARENE_PROP_PARAM_MAX_DISCARDS"};
21/// @brief environment variable name controlling @c property_config::seed
22constexpr auto seed_env_name = arene::base::null_terminated_string_view{"ARENE_PROP_PARAM_SEED"};
23
24/// @brief configuration for property run
25///
26/// Controls how many successful trials must be observed before a property
27/// is considered to hold, how many discarded trials are tolerated before
28/// giving up, and the seed used to initialize the property's PRNG.
34
35/// @brief obtain the runtime configuration for property-based tests
36/// @return a @c property_config used by @c run_property
37///
38/// Values are read from these environment variables (as unsigned decimal
39/// integers):
40/// * @c ARENE_PROP_PARAM_REQUIRED_SUCCESSES controls @c required_successes
41/// (default @c 100)
42/// * @c ARENE_PROP_PARAM_MAX_DISCARDS controls @c max_discards (default
43/// @c 10)
44/// * @c ARENE_PROP_PARAM_SEED controls @c seed (default @c 0)
45///
46/// When a variable is unset or fails to parse as a decimal unsigned 64-bit
47/// integer, the default is used.
48auto read_property_config() noexcept -> property_config;
49
50} // namespace testing
51} // namespace base
52} // namespace arene
53#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TESTING_PROPERTY_CONFIG_HPP_
A read-only string-view that provides a view onto a null-terminated string.
Definition null_terminated_string_view.hpp:62
Definition customization.hpp:31
constexpr auto max_discards_env_name
environment variable name controlling property_config::max_discards
Definition property_config.hpp:20
constexpr auto required_successes_env_name
environment variable name controlling property_config::required_successes
Definition property_config.hpp:17
constexpr auto seed_env_name
environment variable name controlling property_config::seed
Definition property_config.hpp:22
auto read_property_config() noexcept -> property_config
obtain the runtime configuration for property-based tests
Definition property_config.cpp:78
Definition accumulate.hpp:37
Definition accumulate.hpp:36
::size_t size_t
A type suitable for holding the size of an object.
Definition cstddef.hpp:29
::uint64_t uint64_t
A 64-bit unsigned integer type.
Definition cstdint.hpp:47
configuration for property run
Definition property_config.hpp:29
std::size_t max_discards
Definition property_config.hpp:31
std::size_t required_successes
Definition property_config.hpp:30
std::uint64_t seed
Definition property_config.hpp:32