mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2026-04-30 19:09:26 +08:00
Fix warnings, upgrade catch
This commit is contained in:
parent
cd8dacccc6
commit
4309a88d51
@ -155,7 +155,7 @@ else()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(/W4 /w14545 /w34242 /w34254 /w34287 /w44263 /w44265 /w44296 /w44311 /w44826 /we4289 /w14546 /w14547 /w14549 /w14555 /w14619 /w14905 /w14906 /w14928)
|
||||
add_definitions(/Wx /W4 /w14545 /w34242 /w34254 /w34287 /w44263 /w44265 /w44296 /w44311 /w44826 /we4289 /w14546 /w14547 /w14549 /w14555 /w14619 /w14905 /w14906 /w14928)
|
||||
|
||||
if(MSVC_VERSION STREQUAL "1800")
|
||||
# VS2013 doesn't have magic statics
|
||||
@ -175,7 +175,7 @@ if(MSVC)
|
||||
# how to workaround or fix the error. So I'm disabling it globally.
|
||||
add_definitions(/wd4503)
|
||||
else()
|
||||
add_definitions(-Wall -Wextra -Wconversion -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wcast-qual -Wunused -Woverloaded-virtual -Wno-noexcept-type -Wpedantic -Werror=return-type)
|
||||
add_definitions(-Werror -Wall -Wextra -Wconversion -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wcast-qual -Wunused -Woverloaded-virtual -Wno-noexcept-type -Wpedantic -Werror=return-type)
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
|
||||
add_definitions(-Weverything -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-documentation -Wno-switch-enum -Wno-weak-vtables -Wno-missing-prototypes -Wno-padded -Wno-missing-noreturn -Wno-exit-time-destructors -Wno-documentation-unknown-command -Wno-unused-template -Wno-undef -Wno-double-promotion)
|
||||
@ -390,8 +390,10 @@ if(BUILD_TESTING)
|
||||
)
|
||||
|
||||
if(NOT UNIT_TEST_LIGHT)
|
||||
add_library(catch2 STATIC unittests/catch_amalgamated.cpp)
|
||||
|
||||
add_executable(compiled_tests unittests/compiled_tests.cpp)
|
||||
target_link_libraries(compiled_tests ${LIBS} ${CHAISCRIPT_LIBS})
|
||||
target_link_libraries(compiled_tests catch2 ${LIBS} ${CHAISCRIPT_LIBS})
|
||||
catch_discover_tests(compiled_tests TEST_PREFIX "compiled.")
|
||||
|
||||
add_executable(static_chaiscript_test unittests/static_chaiscript.cpp)
|
||||
@ -403,7 +405,7 @@ if(BUILD_TESTING)
|
||||
add_test(NAME Boxed_Cast_Test COMMAND boxed_cast_test)
|
||||
|
||||
add_executable(type_info_test unittests/type_info_test.cpp)
|
||||
target_link_libraries(type_info_test ${LIBS})
|
||||
target_link_libraries(type_info_test catch2 ${LIBS})
|
||||
add_test(NAME Type_Info_Test COMMAND type_info_test)
|
||||
|
||||
add_executable(c_linkage_test unittests/c_linkage_test.cpp)
|
||||
|
||||
@ -45,11 +45,10 @@ namespace chaiscript {
|
||||
|
||||
auto lib = std::make_shared<Module>();
|
||||
|
||||
const bool no_io = std::find(t_opts.begin(), t_opts.end(), Library_Options::No_IO) != t_opts.end();
|
||||
const bool no_prelude = std::find(t_opts.begin(), t_opts.end(), Library_Options::No_Prelude) != t_opts.end();
|
||||
const bool no_json = std::find(t_opts.begin(), t_opts.end(), Library_Options::No_JSON) != t_opts.end();
|
||||
|
||||
bootstrap::Bootstrap::bootstrap(*lib, no_io);
|
||||
bootstrap::Bootstrap::bootstrap(*lib);
|
||||
|
||||
bootstrap::standard_library::vector_type<std::vector<Boxed_Value>>("Vector", *lib);
|
||||
bootstrap::standard_library::string_type<std::string>("string", *lib);
|
||||
|
||||
@ -269,7 +269,7 @@ namespace chaiscript::bootstrap {
|
||||
/// \brief perform all common bootstrap functions for std::string, void and POD types
|
||||
/// \param[in,out] m Module to add bootstrapped functions to
|
||||
/// \param[in] t_no_io If true, skip registering print_string and println_string
|
||||
static void bootstrap(Module &m, const bool t_no_io = false) {
|
||||
static void bootstrap(Module &m) {
|
||||
m.add(user_type<void>(), "void");
|
||||
m.add(user_type<bool>(), "bool");
|
||||
m.add(user_type<Boxed_Value>(), "Object");
|
||||
@ -437,11 +437,6 @@ namespace chaiscript::bootstrap {
|
||||
m.add(fun(&Build_Info::compiler_id), "compiler_id");
|
||||
m.add(fun(&Build_Info::debug_build), "debug_build");
|
||||
|
||||
// print_string and println_string are registered in ChaiScript_Basic::build_eval_system()
|
||||
// to support per-instance IO redirection via set_print_handler.
|
||||
// When No_IO is set, the functions are still registered but the default handler
|
||||
// is a no-op, so users can provide their own print handlers without any stdout output.
|
||||
|
||||
m.add(dispatch::make_dynamic_proxy_function(&bind_function), "bind");
|
||||
|
||||
m.add(fun(&shared_ptr_unconst_clone<dispatch::Proxy_Function_Base>), "clone");
|
||||
|
||||
@ -122,7 +122,7 @@ namespace chaiscript {
|
||||
chaiscript::detail::Dispatch_Engine &get_eval_engine() noexcept { return m_engine; }
|
||||
|
||||
/// Builds all the requirements for ChaiScript, including its evaluator and a run of its prelude.
|
||||
void build_eval_system(const ModulePtr &t_lib, const std::vector<Options> &t_opts, const bool t_no_io = false) {
|
||||
void build_eval_system(const ModulePtr &t_lib, const std::vector<Options> &t_opts, const bool t_no_io) {
|
||||
if (t_lib) {
|
||||
add(t_lib);
|
||||
}
|
||||
@ -317,7 +317,7 @@ namespace chaiscript {
|
||||
std::vector<std::string> t_module_paths = {},
|
||||
std::vector<std::string> t_use_paths = {},
|
||||
const std::vector<chaiscript::Options> &t_opts = chaiscript::default_options(),
|
||||
const bool t_no_io = false)
|
||||
const bool t_no_io=false)
|
||||
: m_module_paths(ensure_minimum_path_vec(std::move(t_module_paths)))
|
||||
, m_use_paths(ensure_minimum_path_vec(std::move(t_use_paths)))
|
||||
, m_parser(std::move(parser))
|
||||
@ -777,7 +777,7 @@ namespace chaiscript {
|
||||
throw std::runtime_error("Namespace: " + t_namespace_name + " was already registered.");
|
||||
}
|
||||
|
||||
m_namespace_generators.emplace(std::make_pair(t_namespace_name, [=, space = Namespace()]() mutable -> Namespace & {
|
||||
m_namespace_generators.emplace(std::make_pair(t_namespace_name, [=, space = Namespace()]() mutable noexcept -> Namespace & {
|
||||
t_namespace_generator(space);
|
||||
return space;
|
||||
}));
|
||||
@ -786,7 +786,7 @@ namespace chaiscript {
|
||||
while (pos != std::string::npos) {
|
||||
const std::string parent = t_namespace_name.substr(0, pos);
|
||||
if (!m_namespace_generators.count(parent)) {
|
||||
m_namespace_generators.emplace(std::make_pair(parent, [space = Namespace()]() mutable -> Namespace & {
|
||||
m_namespace_generators.emplace(std::make_pair(parent, [space = Namespace()]() mutable noexcept -> Namespace & {
|
||||
return space;
|
||||
}));
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ namespace chaiscript {
|
||||
}
|
||||
|
||||
static string_type str_from_ll(long long val) {
|
||||
using target_char_type = typename string_type::value_type;
|
||||
using target_char_type = string_type::value_type;
|
||||
#if defined(CHAISCRIPT_UTF16_UTF32)
|
||||
// prepare converter
|
||||
std::wstring_convert<std::codecvt_utf8<target_char_type>, target_char_type> converter;
|
||||
@ -377,7 +377,7 @@ namespace chaiscript {
|
||||
}
|
||||
|
||||
constexpr Position &operator+=(size_t t_distance) noexcept {
|
||||
*this = (*this) + t_distance;
|
||||
*this = *this + t_distance;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -406,9 +406,9 @@ namespace chaiscript {
|
||||
|
||||
constexpr bool operator!=(const Position &t_rhs) const noexcept { return m_pos != t_rhs.m_pos; }
|
||||
|
||||
constexpr bool has_more() const noexcept { return m_pos != m_end; }
|
||||
[[nodiscard]] constexpr bool has_more() const noexcept { return m_pos != m_end; }
|
||||
|
||||
constexpr size_t remaining() const noexcept { return static_cast<size_t>(m_end - m_pos); }
|
||||
[[nodiscard]] constexpr size_t remaining() const noexcept { return static_cast<size_t>(m_end - m_pos); }
|
||||
|
||||
constexpr const char &operator*() const noexcept {
|
||||
if (m_pos == m_end) {
|
||||
@ -458,7 +458,7 @@ namespace chaiscript {
|
||||
constexpr static Operator_Matches m_operator_matches{};
|
||||
|
||||
/// test a char in an m_alphabet
|
||||
constexpr bool char_in_alphabet(char c, detail::Alphabet a) const noexcept { return m_alphabet[a][static_cast<uint8_t>(c)]; }
|
||||
[[nodiscard]] constexpr bool char_in_alphabet(char c, detail::Alphabet a) const noexcept { return m_alphabet[a][static_cast<uint8_t>(c)]; }
|
||||
|
||||
/// Prints the parsed ast_nodes as a tree
|
||||
void debug_print(const AST_Node &t, std::string prepend = "") const override {
|
||||
@ -530,20 +530,9 @@ namespace chaiscript {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if (Symbol_(m_singleline_comment)) {
|
||||
while (m_position.has_more()) {
|
||||
if (Symbol_(m_cr_lf)) {
|
||||
m_position -= 2;
|
||||
break;
|
||||
} else if (Char_('\n')) {
|
||||
--m_position;
|
||||
break;
|
||||
} else {
|
||||
++m_position;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if (Symbol_(m_annotation)) {
|
||||
}
|
||||
|
||||
if (Symbol_(m_singleline_comment) || Symbol_(m_annotation)) {
|
||||
while (m_position.has_more()) {
|
||||
if (Symbol_(m_cr_lf)) {
|
||||
m_position -= 2;
|
||||
@ -1060,7 +1049,7 @@ namespace chaiscript {
|
||||
template<typename string_type>
|
||||
struct Char_Parser {
|
||||
string_type &match;
|
||||
using char_type = typename string_type::value_type;
|
||||
using char_type = string_type::value_type;
|
||||
bool is_escaped = false;
|
||||
bool is_interpolated = false;
|
||||
bool saw_interpolation_marker = false;
|
||||
@ -1575,7 +1564,7 @@ namespace chaiscript {
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool is_operator(std::string_view t_s) const noexcept { return m_operator_matches.is_match(t_s); }
|
||||
[[nodiscard]] bool is_operator(std::string_view t_s) const noexcept { return m_operator_matches.is_match(t_s); }
|
||||
|
||||
/// Reads (and potentially captures) a symbol group from input if it matches the parameter
|
||||
bool Symbol(const utility::Static_String &t_s, const bool t_disallow_prevention = false) {
|
||||
@ -2749,7 +2738,7 @@ namespace chaiscript {
|
||||
bool retval = false;
|
||||
const auto prev_stack_top = m_match_stack.size();
|
||||
|
||||
if (m_operators[t_precedence] != Operator_Precedence::Prefix) {
|
||||
if (t_precedence < m_operators.size() && m_operators[t_precedence] < Operator_Precedence::Prefix) {
|
||||
if (Operator(t_precedence + 1)) {
|
||||
retval = true;
|
||||
std::string oper;
|
||||
@ -2763,7 +2752,7 @@ namespace chaiscript {
|
||||
}
|
||||
|
||||
switch (m_operators[t_precedence]) {
|
||||
case (Operator_Precedence::Ternary_Cond):
|
||||
case Operator_Precedence::Ternary_Cond:
|
||||
if (Symbol(":")) {
|
||||
if (!Operator(t_precedence + 1)) {
|
||||
throw exception::eval_error("Incomplete '" + oper + "' expression",
|
||||
@ -2778,24 +2767,24 @@ namespace chaiscript {
|
||||
}
|
||||
break;
|
||||
|
||||
case (Operator_Precedence::Addition):
|
||||
case (Operator_Precedence::Multiplication):
|
||||
case (Operator_Precedence::Shift):
|
||||
case (Operator_Precedence::Equality):
|
||||
case (Operator_Precedence::Bitwise_And):
|
||||
case (Operator_Precedence::Bitwise_Xor):
|
||||
case (Operator_Precedence::Bitwise_Or):
|
||||
case (Operator_Precedence::Comparison):
|
||||
case Operator_Precedence::Addition:
|
||||
case Operator_Precedence::Multiplication:
|
||||
case Operator_Precedence::Shift:
|
||||
case Operator_Precedence::Equality:
|
||||
case Operator_Precedence::Bitwise_And:
|
||||
case Operator_Precedence::Bitwise_Xor:
|
||||
case Operator_Precedence::Bitwise_Or:
|
||||
case Operator_Precedence::Comparison:
|
||||
build_match<eval::Binary_Operator_AST_Node<Tracer>>(prev_stack_top, oper);
|
||||
break;
|
||||
|
||||
case (Operator_Precedence::Logical_And):
|
||||
case Operator_Precedence::Logical_And:
|
||||
build_match<eval::Logical_And_AST_Node<Tracer>>(prev_stack_top, oper);
|
||||
break;
|
||||
case (Operator_Precedence::Logical_Or):
|
||||
case Operator_Precedence::Logical_Or:
|
||||
build_match<eval::Logical_Or_AST_Node<Tracer>>(prev_stack_top, oper);
|
||||
break;
|
||||
case (Operator_Precedence::Prefix):
|
||||
case Operator_Precedence::Prefix:
|
||||
assert(false); // cannot reach here because of if() statement at the top
|
||||
break;
|
||||
|
||||
|
||||
@ -44,21 +44,17 @@ namespace chaiscript::json {
|
||||
= std::variant<std::nullptr_t, chaiscript::utility::QuickFlatMap<std::string, JSON>, std::vector<JSON>, std::string, double, std::int64_t, bool>;
|
||||
|
||||
struct Internal {
|
||||
Internal(std::nullptr_t)
|
||||
: d(nullptr) {
|
||||
}
|
||||
Internal()
|
||||
: d(nullptr) {
|
||||
}
|
||||
Internal(Class c)
|
||||
explicit Internal(std::nullptr_t) {}
|
||||
Internal() = default;
|
||||
Internal(const Class c)
|
||||
: d(make_type(c)) {
|
||||
}
|
||||
template<typename T>
|
||||
Internal(T t)
|
||||
explicit Internal(T t)
|
||||
: d(std::move(t)) {
|
||||
}
|
||||
|
||||
static Data make_type(Class c) {
|
||||
static Data make_type(const Class c) {
|
||||
switch (c) {
|
||||
case Class::Null:
|
||||
return nullptr;
|
||||
@ -84,7 +80,7 @@ namespace chaiscript::json {
|
||||
}
|
||||
}
|
||||
|
||||
Class type() const noexcept { return Class(d.index()); }
|
||||
[[nodiscard]] Class type() const noexcept { return Class(d.index()); }
|
||||
|
||||
template<auto ClassValue, typename Visitor, typename Or>
|
||||
decltype(auto) visit_or(Visitor &&visitor, Or &&other) const {
|
||||
@ -108,14 +104,14 @@ namespace chaiscript::json {
|
||||
auto &Float() { return get_set_type<Class::Floating>(); }
|
||||
auto &Bool() { return get_set_type<Class::Boolean>(); }
|
||||
|
||||
auto Map() const noexcept { return std::get_if<static_cast<std::size_t>(Class::Object)>(&d); }
|
||||
auto Vector() const noexcept { return std::get_if<static_cast<std::size_t>(Class::Array)>(&d); }
|
||||
auto String() const noexcept { return std::get_if<static_cast<std::size_t>(Class::String)>(&d); }
|
||||
auto Int() const noexcept { return std::get_if<static_cast<std::size_t>(Class::Integral)>(&d); }
|
||||
auto Float() const noexcept { return std::get_if<static_cast<std::size_t>(Class::Floating)>(&d); }
|
||||
auto Bool() const noexcept { return std::get_if<static_cast<std::size_t>(Class::Boolean)>(&d); }
|
||||
[[nodiscard]] auto Map() const noexcept { return std::get_if<static_cast<std::size_t>(Class::Object)>(&d); }
|
||||
[[nodiscard]] auto Vector() const noexcept { return std::get_if<static_cast<std::size_t>(Class::Array)>(&d); }
|
||||
[[nodiscard]] auto String() const noexcept { return std::get_if<static_cast<std::size_t>(Class::String)>(&d); }
|
||||
[[nodiscard]] auto Int() const noexcept { return std::get_if<static_cast<std::size_t>(Class::Integral)>(&d); }
|
||||
[[nodiscard]] auto Float() const noexcept { return std::get_if<static_cast<std::size_t>(Class::Floating)>(&d); }
|
||||
[[nodiscard]] auto Bool() const noexcept { return std::get_if<static_cast<std::size_t>(Class::Boolean)>(&d); }
|
||||
|
||||
Data d;
|
||||
Data d{nullptr};
|
||||
};
|
||||
|
||||
Internal internal;
|
||||
@ -129,12 +125,12 @@ namespace chaiscript::json {
|
||||
JSONWrapper(Container *val)
|
||||
: object(val) {
|
||||
}
|
||||
JSONWrapper(std::nullptr_t) {}
|
||||
JSONWrapper(std::nullptr_t) { }
|
||||
|
||||
typename Container::iterator begin() { return object ? object->begin() : typename Container::iterator(); }
|
||||
typename Container::iterator end() { return object ? object->end() : typename Container::iterator(); }
|
||||
typename Container::const_iterator begin() const { return object ? object->begin() : typename Container::iterator(); }
|
||||
typename Container::const_iterator end() const { return object ? object->end() : typename Container::iterator(); }
|
||||
Container::iterator begin() { return object ? object->begin() : typename Container::iterator(); }
|
||||
Container::iterator end() { return object ? object->end() : typename Container::iterator(); }
|
||||
[[nodiscard]] Container::const_iterator begin() const { return object ? object->begin() : typename Container::iterator(); }
|
||||
[[nodiscard]] Container::const_iterator end() const { return object ? object->end() : typename Container::iterator(); }
|
||||
};
|
||||
|
||||
template<typename Container>
|
||||
@ -147,10 +143,10 @@ namespace chaiscript::json {
|
||||
}
|
||||
JSONConstWrapper(std::nullptr_t) {}
|
||||
|
||||
typename Container::const_iterator begin() const noexcept {
|
||||
[[nodiscard]] Container::const_iterator begin() const noexcept {
|
||||
return object ? object->begin() : typename Container::const_iterator();
|
||||
}
|
||||
typename Container::const_iterator end() const noexcept { return object ? object->end() : typename Container::const_iterator(); }
|
||||
[[nodiscard]] Container::const_iterator end() const noexcept { return object ? object->end() : typename Container::const_iterator(); }
|
||||
};
|
||||
|
||||
JSON() = default;
|
||||
|
||||
17969
unittests/catch.hpp
17969
unittests/catch.hpp
File diff suppressed because it is too large
Load Diff
12394
unittests/catch_amalgamated.cpp
Normal file
12394
unittests/catch_amalgamated.cpp
Normal file
File diff suppressed because it is too large
Load Diff
14570
unittests/catch_amalgamated.hpp
Normal file
14570
unittests/catch_amalgamated.hpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -22,11 +22,10 @@
|
||||
#include "../static_libs/chaiscript_parser.hpp"
|
||||
#include "../static_libs/chaiscript_stdlib.hpp"
|
||||
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include "catch_amalgamated.hpp"
|
||||
|
||||
#include <clocale>
|
||||
|
||||
#include "catch.hpp"
|
||||
|
||||
// lambda_tests
|
||||
TEST_CASE("C++11 Lambdas Can Be Registered") {
|
||||
@ -190,7 +189,7 @@ TEST_CASE("Throw int or double") {
|
||||
chai.eval("throw(1.0)", chaiscript::exception_specification<int, double>());
|
||||
REQUIRE(false);
|
||||
} catch (const double e) {
|
||||
CHECK(e == Approx(1.0));
|
||||
CHECK(e == Catch::Approx(1.0));
|
||||
}
|
||||
}
|
||||
|
||||
@ -964,7 +963,7 @@ TEST_CASE("Pair conversions") {
|
||||
Pair(5, 3.14);
|
||||
)cs");
|
||||
CHECK(p.first == 5);
|
||||
CHECK(p.second == Approx(3.14));
|
||||
CHECK(p.second == Catch::Approx(3.14));
|
||||
}
|
||||
}
|
||||
|
||||
@ -976,7 +975,7 @@ TEST_CASE("Parse floats with non-posix locale") {
|
||||
#endif
|
||||
chaiscript::ChaiScript_Basic chai(create_chaiscript_stdlib(), create_chaiscript_parser());
|
||||
const double parsed = chai.eval<double>("print(1.3); 1.3");
|
||||
CHECK(parsed == Approx(1.3));
|
||||
CHECK(parsed == Catch::Approx(1.3));
|
||||
const std::string str = chai.eval<std::string>("to_string(1.3)");
|
||||
CHECK(str == "1.3");
|
||||
}
|
||||
@ -1270,7 +1269,7 @@ TEST_CASE("Test reference member being registered") {
|
||||
double d;
|
||||
chai.add(chaiscript::var(Reference_MyClass(d)), "ref");
|
||||
chai.eval("ref.x = 2.3");
|
||||
CHECK(d == Approx(2.3));
|
||||
CHECK(d == Catch::Approx(2.3));
|
||||
}
|
||||
|
||||
// starting with C++20 u8"" strings cannot be compared with std::string
|
||||
@ -1827,7 +1826,7 @@ TEST_CASE("vector of vectors conversion (issue #374)") {
|
||||
}),
|
||||
"sum_nested");
|
||||
|
||||
CHECK(chai.eval<double>("sum_nested([[1.0, 2.0], [3.0, 4.0]])") == Approx(10.0));
|
||||
CHECK(chai.eval<double>("sum_nested([[1.0, 2.0], [3.0, 4.0]])") == Catch::Approx(10.0));
|
||||
|
||||
CHECK(chai.eval<bool>(
|
||||
"auto v = VectorVectorDouble();"
|
||||
@ -1910,12 +1909,12 @@ TEST_CASE("Nested namespaces via register_namespace with :: separator") {
|
||||
|
||||
chai.import("constants");
|
||||
|
||||
CHECK(chai.eval<double>("constants.si.mu_B") == Approx(9.274));
|
||||
CHECK(chai.eval<double>("constants.mm.mu_B") == Approx(0.05788));
|
||||
CHECK(chai.eval<double>("constants.si.mu_B") == Catch::Approx(9.274));
|
||||
CHECK(chai.eval<double>("constants.mm.mu_B") == Catch::Approx(0.05788));
|
||||
|
||||
// Scope resolution via :: works the same as . for access
|
||||
CHECK(chai.eval<double>("constants::si::mu_B") == Approx(9.274));
|
||||
CHECK(chai.eval<double>("constants::mm::mu_B") == Approx(0.05788));
|
||||
CHECK(chai.eval<double>("constants::si::mu_B") == Catch::Approx(9.274));
|
||||
CHECK(chai.eval<double>("constants::mm::mu_B") == Catch::Approx(0.05788));
|
||||
}
|
||||
|
||||
TEST_CASE("Deeply nested namespaces via register_namespace") {
|
||||
@ -1984,7 +1983,7 @@ TEST_CASE("Namespace block with var declarations") {
|
||||
}
|
||||
)");
|
||||
|
||||
CHECK(chai.eval<double>("config::pi") == Approx(3.14));
|
||||
CHECK(chai.eval<double>("config::pi") == Catch::Approx(3.14));
|
||||
CHECK(chai.eval<std::string>("config::name") == "hello");
|
||||
}
|
||||
|
||||
|
||||
@ -16,9 +16,7 @@
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
#define CATCH_CONFIG_MAIN
|
||||
|
||||
#include "catch.hpp"
|
||||
#include "catch_amalgamated.hpp"
|
||||
|
||||
TEST_CASE("Type_Info objects generate expected results") {
|
||||
const auto test_type
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user