StateConnectionTest.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-09-10
  6. * Changed: 2020-09-10
  7. *
  8. * */
  9. #include <gtest/gtest.h>
  10. #include "../../../source/logic/StateConnection.hpp"
  11. namespace {
  12. class StateConnectionTest : public ::testing::Test {
  13. protected:
  14. StateConnectionTest() = default;
  15. ~StateConnectionTest() override = default;
  16. void SetUp() override {}
  17. void TearDown() override {}
  18. };
  19. TEST_F(StateConnectionTest, getConnectionId)
  20. {
  21. ls_std::StateConnection connection {"AB", std::make_shared<ls_std::State>("B")};
  22. ASSERT_STREQ("AB", connection.getConnectionId().c_str());
  23. }
  24. TEST_F(StateConnectionTest, getState)
  25. {
  26. ls_std::StateConnection connection {"AB", std::make_shared<ls_std::State>("B")};
  27. ASSERT_TRUE(connection.getState() != nullptr);
  28. ASSERT_STREQ("B", connection.getState()->getId().c_str());
  29. }
  30. TEST_F(StateConnectionTest, isPassable)
  31. {
  32. ls_std::StateConnection connection {"AB", std::make_shared<ls_std::State>("B")};
  33. ASSERT_FALSE(connection.isPassable());
  34. }
  35. TEST_F(StateConnectionTest, updatePassCondition)
  36. {
  37. ls_std::StateConnection connection {"AB", std::make_shared<ls_std::State>("B")};
  38. ASSERT_FALSE(connection.isPassable());
  39. connection.updatePassCondition(true);
  40. ASSERT_TRUE(connection.isPassable());
  41. }
  42. }