Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
markaren committed Dec 3, 2024
1 parent 5cfa566 commit 4edacd7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 48 deletions.
6 changes: 3 additions & 3 deletions export/include/fmu4cpp/variable_access.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

#ifndef VARIABLEACCESS_HPP
#define VARIABLEACCESS_HPP
#ifndef FMU4CPP_VARIABLEACCESS_HPP
#define FMU4CPP_VARIABLEACCESS_HPP

#include <functional>
#include <optional>
Expand Down Expand Up @@ -59,4 +59,4 @@ namespace fmu4cpp {

}// namespace fmu4cpp

#endif//VARIABLEACCESS_HPP
#endif//FMU4CPP_VARIABLEACCESS_HPP
44 changes: 1 addition & 43 deletions export/tests/basic_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
}
2 changes: 1 addition & 1 deletion export/tests/identity_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
1 change: 0 additions & 1 deletion export/tests/test_resource.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>

#include <fmu4cpp/fmu_base.hpp>
#include <fstream>
Expand Down

0 comments on commit 4edacd7

Please # to comment.