StateConnectionTest.cpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-09-10
  6. * Changed: 2020-10-29
  7. *
  8. * */
  9. #include <gtest/gtest.h>
  10. #include <ls_std/ls_std.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", "B"};
  22. ASSERT_STREQ("AB", connection.getConnectionId().c_str());
  23. }
  24. TEST_F(StateConnectionTest, getState)
  25. {
  26. ls_std::StateConnection connection {"AB", "B"};
  27. ASSERT_STREQ("B", connection.getStateId().c_str());
  28. }
  29. TEST_F(StateConnectionTest, isPassable)
  30. {
  31. ls_std::StateConnection connection {"AB", "B"};
  32. ASSERT_FALSE(connection.isPassable());
  33. }
  34. TEST_F(StateConnectionTest, setConnectionId)
  35. {
  36. ls_std::StateConnection connection {"AB", "B"};
  37. ASSERT_STREQ("AB", connection.getConnectionId().c_str());
  38. connection.setConnectionId("BC");
  39. ASSERT_STREQ("BC", connection.getConnectionId().c_str());
  40. }
  41. TEST_F(StateConnectionTest, setStateId)
  42. {
  43. ls_std::StateConnection connection {"AB", "B"};
  44. ASSERT_STREQ("B", connection.getStateId().c_str());
  45. connection.setStateId("C");
  46. ASSERT_STREQ("C", connection.getStateId().c_str());
  47. }
  48. TEST_F(StateConnectionTest, updatePassCondition)
  49. {
  50. ls_std::StateConnection connection {"AB", "B"};
  51. ASSERT_FALSE(connection.isPassable());
  52. connection.updatePassCondition(true);
  53. ASSERT_TRUE(connection.isPassable());
  54. }
  55. }