Jelajahi Sumber

Add library version functionality

Patrick-Christopher Mattulat 3 tahun lalu
induk
melakukan
c429500e11

+ 2 - 1
CMakeLists.txt

@@ -179,7 +179,8 @@ if (${LS_STD_BUILD_WITH_TESTS})
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/exception/IllegalArithmeticOperationExceptionTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/exception/IncompleteJsonExceptionTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/exception/NullPointerExceptionTest.cpp
-            ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/io/xml/XmlParserTestWrapper.cpp)
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/io/xml/XmlParserTestWrapper.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/base/LibraryVersionTest.cpp)
 endif ()
 
 ##########################################################

+ 23 - 0
include/ls_std/base/LibraryVersion.hpp

@@ -0,0 +1,23 @@
+/*
+ * Author:          Patrick-Christopher Mattulat
+ * Company:         Lynar Studios
+ * E-Mail:          webmaster@lynarstudios.com
+ * Created:         2021-05-02
+ * Changed:         2021-05-02
+ *
+ * */
+
+#ifndef LS_STD_LIBRARY_VERSION_HPP
+#define LS_STD_LIBRARY_VERSION_HPP
+
+#include <string>
+
+namespace ls_std
+{
+  static std::string getVersion()
+  {
+    return "2021.1.0";
+  }
+}
+
+#endif

+ 1 - 0
include/ls_std/ls_std.hpp

@@ -17,6 +17,7 @@
 #include "base/Class.hpp"
 #include "base/Types.hpp"
 #include "base/Version.hpp"
+#include "base/LibraryVersion.hpp"
 
 #include "boxing/IBoxing.hpp"
 #include "boxing/Boolean.hpp"

+ 33 - 0
test/cases/base/LibraryVersionTest.cpp

@@ -0,0 +1,33 @@
+/*
+ * Author:          Patrick-Christopher Mattulat
+ * Company:         Lynar Studios
+ * E-Mail:          webmaster@lynarstudios.com
+ * Created:         2021-05-02
+ * Changed:         2021-05-02
+ *
+ * */
+
+#include <gtest/gtest.h>
+#include <ls_std/ls_std.hpp>
+
+namespace
+{
+  class LibraryVersionTest : public ::testing::Test
+  {
+    protected:
+
+      LibraryVersionTest() = default;
+      ~LibraryVersionTest() override = default;
+
+      void SetUp() override
+      {}
+
+      void TearDown() override
+      {}
+  };
+
+  TEST_F(LibraryVersionTest, getVersion)
+  {
+    ASSERT_STREQ("2021.1.0", ls_std::getVersion().c_str());
+  }
+}