-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathSettings_test.cpp
57 lines (51 loc) · 1.62 KB
/
Settings_test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*******************************************************************************
Causal Dynamical Triangulations in C++ using CGAL
Copyright © 2020 Adam Getchell
******************************************************************************/
/// @file Settings_test.cpp
/// @brief Global settings on integer types and MPFR precision
/// @author Adam Getchell
/// @details Tests number types and precision settings for the project
#include "Settings.hpp"
#include <doctest/doctest.h>
#include <fmt/core.h>
using namespace std;
SCENARIO("Check settings" * doctest::test_suite("settings"))
{
GIVEN("Settings are retrieved.")
{
WHEN("The integer type is queried.")
{
auto const& int_precision = typeid(Int_precision).name();
THEN("The value is std::int_fast32_t.")
{
fmt::print("TypeID of Int_precision is {}.\n", int_precision);
CHECK_EQ(int_precision, typeid(std::int_fast32_t).name());
}
}
WHEN("MPFR precision is queried.")
{
auto precision = PRECISION;
THEN("The value is 256 bits.")
{
fmt::print("MPFR precision set to {}.\n", precision);
REQUIRE_EQ(precision, 256);
}
}
WHEN("Memory alignment is queried.")
{
auto constexpr align_64 = ALIGNMENT_64_BIT;
THEN("The value is 64 bits.")
{
fmt::print("Memory alignment is set to {}.\n", align_64);
REQUIRE_EQ(align_64, 64);
}
auto constexpr align_32 = ALIGNMENT_32_BIT;
THEN("The value is 32 bits.")
{
fmt::print("Memory alignment is set to {}.\n", align_32);
REQUIRE_EQ(align_32, 32);
}
}
}
}