StateConnectionTest.cpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-09-10
  6. * Changed: 2021-04-23
  7. *
  8. * */
  9. #include <gtest/gtest.h>
  10. #include <ls_std/ls_std.hpp>
  11. namespace
  12. {
  13. class StateConnectionTest : public ::testing::Test
  14. {
  15. protected:
  16. StateConnectionTest() = default;
  17. ~StateConnectionTest() override = default;
  18. void SetUp() override
  19. {}
  20. void TearDown() override
  21. {}
  22. };
  23. TEST_F(StateConnectionTest, getConnectionId)
  24. {
  25. ls_std::StateConnection connection{"AB", "B"};
  26. ASSERT_STREQ("AB", connection.getConnectionId().c_str());
  27. }
  28. TEST_F(StateConnectionTest, getState)
  29. {
  30. ls_std::StateConnection connection{"AB", "B"};
  31. ASSERT_STREQ("B", connection.getStateId().c_str());
  32. }
  33. TEST_F(StateConnectionTest, isPassable)
  34. {
  35. ls_std::StateConnection connection{"AB", "B"};
  36. ASSERT_FALSE(connection.isPassable());
  37. }
  38. TEST_F(StateConnectionTest, setConnectionId)
  39. {
  40. ls_std::StateConnection connection{"AB", "B"};
  41. ASSERT_STREQ("AB", connection.getConnectionId().c_str());
  42. connection.setConnectionId("BC");
  43. ASSERT_STREQ("BC", connection.getConnectionId().c_str());
  44. }
  45. TEST_F(StateConnectionTest, setStateId)
  46. {
  47. ls_std::StateConnection connection{"AB", "B"};
  48. ASSERT_STREQ("B", connection.getStateId().c_str());
  49. connection.setStateId("C");
  50. ASSERT_STREQ("C", connection.getStateId().c_str());
  51. }
  52. TEST_F(StateConnectionTest, updatePassCondition)
  53. {
  54. ls_std::StateConnection connection{"AB", "B"};
  55. ASSERT_FALSE(connection.isPassable());
  56. connection.updatePassCondition(true);
  57. ASSERT_TRUE(connection.isPassable());
  58. }
  59. }