DateParameterTest.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-03-29
  6. * Changed: 2023-03-29
  7. *
  8. * */
  9. #include <gtest/gtest.h>
  10. #include <ls-std/ls-std-time.hpp>
  11. using ls::std::time::DateParameter;
  12. using testing::Test;
  13. namespace
  14. {
  15. class DateParameterTest : public Test
  16. {
  17. public:
  18. DateParameterTest() = default;
  19. ~DateParameterTest() override = default;
  20. };
  21. TEST_F(DateParameterTest, constructor)
  22. {
  23. DateParameter parameter{1989, 6, 1, 10, 52, 13, 102};
  24. ASSERT_EQ(1989, parameter.getYear());
  25. ASSERT_EQ(6, parameter.getMonth());
  26. ASSERT_EQ(1, parameter.getDay());
  27. ASSERT_EQ(10, parameter.getHour());
  28. ASSERT_EQ(52, parameter.getMinute());
  29. ASSERT_EQ(13, parameter.getSecond());
  30. ASSERT_EQ(102, parameter.getMillisecond());
  31. }
  32. TEST_F(DateParameterTest, getDay)
  33. {
  34. DateParameter parameter{};
  35. ASSERT_EQ(0, parameter.getDay());
  36. }
  37. TEST_F(DateParameterTest, getHour)
  38. {
  39. DateParameter parameter{};
  40. ASSERT_EQ(0, parameter.getHour());
  41. }
  42. TEST_F(DateParameterTest, getMillisecond)
  43. {
  44. DateParameter parameter{};
  45. ASSERT_EQ(0, parameter.getMillisecond());
  46. }
  47. TEST_F(DateParameterTest, getMinute)
  48. {
  49. DateParameter parameter{};
  50. ASSERT_EQ(0, parameter.getMinute());
  51. }
  52. TEST_F(DateParameterTest, getMonth)
  53. {
  54. DateParameter parameter{};
  55. ASSERT_EQ(0, parameter.getMonth());
  56. }
  57. TEST_F(DateParameterTest, getSecond)
  58. {
  59. DateParameter parameter{};
  60. ASSERT_EQ(0, parameter.getSecond());
  61. }
  62. TEST_F(DateParameterTest, getYear)
  63. {
  64. DateParameter parameter{};
  65. ASSERT_EQ(0, parameter.getYear());
  66. }
  67. TEST_F(DateParameterTest, setDay)
  68. {
  69. DateParameter parameter{};
  70. parameter.setDay(1);
  71. ASSERT_EQ(1, parameter.getDay());
  72. }
  73. TEST_F(DateParameterTest, setHour)
  74. {
  75. DateParameter parameter{};
  76. parameter.setHour(10);
  77. ASSERT_EQ(10, parameter.getHour());
  78. }
  79. TEST_F(DateParameterTest, setMillisecond)
  80. {
  81. DateParameter parameter{};
  82. parameter.setMillisecond(133);
  83. ASSERT_EQ(133, parameter.getMillisecond());
  84. }
  85. TEST_F(DateParameterTest, setMinute)
  86. {
  87. DateParameter parameter{};
  88. parameter.setMinute(52);
  89. ASSERT_EQ(52, parameter.getMinute());
  90. }
  91. TEST_F(DateParameterTest, setMonth)
  92. {
  93. DateParameter parameter{};
  94. parameter.setMonth(6);
  95. ASSERT_EQ(6, parameter.getMonth());
  96. }
  97. TEST_F(DateParameterTest, setSecond)
  98. {
  99. DateParameter parameter{};
  100. parameter.setSecond(13);
  101. ASSERT_EQ(13, parameter.getSecond());
  102. }
  103. TEST_F(DateParameterTest, setYear)
  104. {
  105. DateParameter parameter{};
  106. parameter.setYear(1989);
  107. ASSERT_EQ(1989, parameter.getYear());
  108. }
  109. }