Browse Source

Add temporary tests for POSIX APIs

Patrick-Christopher Mattulat 1 year ago
parent
commit
d5ac1aaabb

+ 3 - 1
CMakeLists.txt

@@ -221,7 +221,9 @@ if (${LS_STD_BUILD_WITH_TESTS})
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/LongTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/StringTest.cpp)
 
-    set(TEST_FILES_CORE
+set(TEST_FILES_CORE
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/api/io/PosixReaderTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/api/socket/PosixSocketTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/EventNotHandledExceptionTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/EventNotSubscribedExceptionTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/FileNotFoundExceptionTest.cpp

+ 40 - 0
test/cases/core/api/io/PosixReaderTest.cpp

@@ -0,0 +1,40 @@
+/*
+ * Author:          Patrick-Christopher Mattulat
+ * Company:         Lynar Studios
+ * E-Mail:          webmaster@lynarstudios.com
+ * Created:         2022-11-16
+ * Changed:         2022-12-16
+ *
+ * */
+
+#include <gtest/gtest.h>
+#include <ls_std/ls_std_core.hpp>
+#include <memory>
+
+using namespace ls::std::core;
+using namespace ls::std::core::api;
+using namespace ls::std::core::interface_type;
+using namespace ::std;
+
+namespace
+{
+  class PosixReaderTest : public ::testing::Test // TODO: remove, when vtable issue has been clarified
+  {
+    protected:
+
+      PosixReaderTest() = default;
+      ~PosixReaderTest() override = default;
+
+      void SetUp() override
+      {}
+
+      void TearDown() override
+      {}
+  };
+
+  TEST_F(PosixReaderTest, memory)
+  {
+    shared_ptr<IPosixReader> posixReader = make_shared<PosixReader>();
+    ASSERT_TRUE(posixReader != nullptr);
+  }
+}

+ 40 - 0
test/cases/core/api/socket/PosixSocketTest.cpp

@@ -0,0 +1,40 @@
+/*
+ * Author:          Patrick-Christopher Mattulat
+ * Company:         Lynar Studios
+ * E-Mail:          webmaster@lynarstudios.com
+ * Created:         2022-11-16
+ * Changed:         2022-12-16
+ *
+ * */
+
+#include <gtest/gtest.h>
+#include <ls_std/ls_std_core.hpp>
+#include <memory>
+
+using namespace ls::std::core;
+using namespace ls::std::core::api;
+using namespace ls::std::core::interface_type;
+using namespace ::std;
+
+namespace
+{
+  class PosixSocketTest : public ::testing::Test // TODO: remove, when vtable issue has been clarified
+  {
+    protected:
+
+      PosixSocketTest() = default;
+      ~PosixSocketTest() override = default;
+
+      void SetUp() override
+      {}
+
+      void TearDown() override
+      {}
+  };
+
+  TEST_F(PosixSocketTest, memory)
+  {
+    shared_ptr<IPosixSocket> posixSocket = make_shared<PosixSocket>();
+    ASSERT_TRUE(posixSocket != nullptr);
+  }
+}