From 4edacd7363272e7c267e87492f32c3a778c6e4e2 Mon Sep 17 00:00:00 2001 From: Lars Ivar Hatledal Date: Tue, 3 Dec 2024 12:03:34 +0100 Subject: [PATCH] cleanup --- export/include/fmu4cpp/variable_access.hpp | 6 +-- export/tests/basic_test.cpp | 44 +--------------------- export/tests/identity_test.cpp | 2 +- export/tests/test_resource.cpp | 1 - 4 files changed, 5 insertions(+), 48 deletions(-) diff --git a/export/include/fmu4cpp/variable_access.hpp b/export/include/fmu4cpp/variable_access.hpp index 26d520e..401dc1d 100644 --- a/export/include/fmu4cpp/variable_access.hpp +++ b/export/include/fmu4cpp/variable_access.hpp @@ -1,6 +1,6 @@ -#ifndef VARIABLEACCESS_HPP -#define VARIABLEACCESS_HPP +#ifndef FMU4CPP_VARIABLEACCESS_HPP +#define FMU4CPP_VARIABLEACCESS_HPP #include #include @@ -59,4 +59,4 @@ namespace fmu4cpp { }// namespace fmu4cpp -#endif//VARIABLEACCESS_HPP +#endif//FMU4CPP_VARIABLEACCESS_HPP diff --git a/export/tests/basic_test.cpp b/export/tests/basic_test.cpp index 8537c42..f0e074c 100644 --- a/export/tests/basic_test.cpp +++ b/export/tests/basic_test.cpp @@ -59,7 +59,7 @@ TEST_CASE("basic_test") { const auto instance = fmu4cpp::createInstance("", ""); double t = 0; - double dt = 0.1; + const double dt = 0.1; auto real = instance->get_real_variable("myReal"); REQUIRE(real); @@ -99,45 +99,3 @@ TEST_CASE("basic_test") { instance->terminate(); } - -TEST_CASE("wrong call order") { - - const auto instance = fmu4cpp::createInstance("", ""); - - double t = 0; - double dt = 0.1; - - auto real = instance->get_real_variable("myReal"); - REQUIRE(real); - auto integer = instance->get_int_variable("myInteger"); - REQUIRE(integer); - auto boolean = instance->get_bool_variable("myBoolean"); - REQUIRE(boolean); - auto str = instance->get_string_variable("myString"); - REQUIRE(str); - - instance->setup_experiment(t, {}, {}); - instance->enter_initialisation_mode(); - instance->exit_initialisation_mode(); - - int i = 0; - while (t < 10) { - instance->do_step(t, dt); - - REQUIRE(real->get() == Catch::Approx(t)); - REQUIRE(boolean->get() == (i % 2 == 0)); - REQUIRE(integer->get() == ++i); - REQUIRE(str->get() == std::to_string(i)); - - t += dt; - } - - instance->reset(); - - REQUIRE(real->get() == 0); - REQUIRE(boolean->get() == false); - REQUIRE(integer->get() == 0); - REQUIRE(str->get() == "0"); - - instance->terminate(); -} diff --git a/export/tests/identity_test.cpp b/export/tests/identity_test.cpp index 8ea34f7..d31b71d 100644 --- a/export/tests/identity_test.cpp +++ b/export/tests/identity_test.cpp @@ -194,7 +194,7 @@ TEST_CASE("test_identity") { double t{0}; - double dt{0.1}; + const double dt{0.1}; bool b{false}; int counter{0}; diff --git a/export/tests/test_resource.cpp b/export/tests/test_resource.cpp index 632a42a..be0103b 100644 --- a/export/tests/test_resource.cpp +++ b/export/tests/test_resource.cpp @@ -1,6 +1,5 @@ #include -#include #include #include