Переглянути джерело

Remove namespaces from core module's tests

Patrick-Christopher Mattulat 2 роки тому
батько
коміт
b5066bc2e5

+ 10 - 6
test/cases/core/ClassTest.cpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-08-16
- * Changed:         2022-05-20
+ * Changed:         2022-11-09
  *
  * */
 
@@ -11,6 +11,10 @@
 #include <ls_std/ls_std_core.hpp>
 #include <ls_std_core_test.hpp>
 
+using namespace ls::std::core;
+using namespace ::std;
+using namespace ls_std_core_test;
+
 namespace
 {
   class ClassTest : public ::testing::Test
@@ -32,24 +36,24 @@ namespace
     EXPECT_THROW({
                    try
                    {
-                     ls::std::core::Class object{""};
+                     Class object{""};
                    }
-                   catch (const ls::std::core::IllegalArgumentException &_exception)
+                   catch (const IllegalArgumentException &_exception)
                    {
                      throw;
                    }
-                 }, ls::std::core::IllegalArgumentException);
+                 }, IllegalArgumentException);
   }
 
   TEST_F(ClassTest, destructor)
   {
-    ::std::shared_ptr<ls_std_core_test::ClassWrapper> object = ::std::make_shared<ls_std_core_test::ClassWrapper>();
+    shared_ptr<ClassWrapper> object = make_shared<ClassWrapper>();
     EXPECT_CALL(*object, Die());
   }
 
   TEST_F(ClassTest, getClassName)
   {
-    ls::std::core::Class object{"Class"};
+    Class object{"Class"};
     ASSERT_STREQ("Class", object.getClassName().c_str());
   }
 

+ 4 - 2
test/cases/core/LibraryVersionTest.cpp

@@ -3,13 +3,15 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2021-05-02
- * Changed:         2022-08-09
+ * Changed:         2022-11-09
  *
  * */
 
 #include <gtest/gtest.h>
 #include <ls_std/ls_std_core.hpp>
 
+using namespace ls::std::core;
+
 namespace
 {
   class LibraryVersionTest : public ::testing::Test
@@ -28,6 +30,6 @@ namespace
 
   TEST_F(LibraryVersionTest, getVersion)
   {
-    ASSERT_STREQ("2022.3.0", ls::std::core::getVersion().c_str());
+    ASSERT_STREQ("2022.3.0", getVersion().c_str());
   }
 }

+ 18 - 16
test/cases/core/VersionTest.cpp

@@ -3,13 +3,15 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-09-28
- * Changed:         2022-05-13
+ * Changed:         2022-11-09
  *
  * */
 
 #include <gtest/gtest.h>
 #include <ls_std/ls_std_core.hpp>
 
+using namespace ls::std::core;
+
 namespace
 {
   class VersionTest : public ::testing::Test
@@ -30,13 +32,13 @@ namespace
 
   TEST_F(VersionTest, marshal)
   {
-    ls::std::core::Version version{2020, 2, 0};
+    Version version{2020, 2, 0};
     ASSERT_STREQ("2020.2.0", version.marshal().c_str());
   }
 
   TEST_F(VersionTest, unmarshal)
   {
-    ls::std::core::Version version{0, 0, 0};
+    Version version{0, 0, 0};
     version.unmarshal("2020.2.13");
 
     ASSERT_EQ(2020, version.getMajorVersion());
@@ -48,44 +50,44 @@ namespace
 
   TEST_F(VersionTest, getMajorVersion)
   {
-    ls::std::core::Version version{13, 2, 4};
+    Version version{13, 2, 4};
     ASSERT_EQ(13, version.getMajorVersion());
   }
 
   TEST_F(VersionTest, getMinorVersion)
   {
-    ls::std::core::Version version{13, 2, 4};
+    Version version{13, 2, 4};
     ASSERT_EQ(2, version.getMinorVersion());
   }
 
   TEST_F(VersionTest, getPatchVersion)
   {
-    ls::std::core::Version version{13, 2, 4};
+    Version version{13, 2, 4};
     ASSERT_EQ(4, version.getPatchVersion());
   }
 
   TEST_F(VersionTest, isValid)
   {
-    ASSERT_TRUE(ls::std::core::Version::isValid("2020.1.2"));
-    ASSERT_TRUE(ls::std::core::Version::isValid("2.5.1"));
+    ASSERT_TRUE(Version::isValid("2020.1.2"));
+    ASSERT_TRUE(Version::isValid("2.5.1"));
   }
 
   TEST_F(VersionTest, isValid_emptyString)
   {
-    ASSERT_FALSE(ls::std::core::Version::isValid(""));
+    ASSERT_FALSE(Version::isValid(""));
   }
 
   TEST_F(VersionTest, isValid_noValidVersionString)
   {
-    ASSERT_FALSE(ls::std::core::Version::isValid("v2020.1.2"));
-    ASSERT_FALSE(ls::std::core::Version::isValid("2.5"));
-    ASSERT_FALSE(ls::std::core::Version::isValid("2020"));
-    ASSERT_FALSE(ls::std::core::Version::isValid("blaaaa"));
+    ASSERT_FALSE(Version::isValid("v2020.1.2"));
+    ASSERT_FALSE(Version::isValid("2.5"));
+    ASSERT_FALSE(Version::isValid("2020"));
+    ASSERT_FALSE(Version::isValid("blaaaa"));
   }
 
   TEST_F(VersionTest, setMajorVersion)
   {
-    ls::std::core::Version version{13, 2, 4};
+    Version version{13, 2, 4};
     ASSERT_EQ(13, version.getMajorVersion());
 
     version.setMajorVersion(14);
@@ -94,7 +96,7 @@ namespace
 
   TEST_F(VersionTest, setMinorVersion)
   {
-    ls::std::core::Version version{13, 2, 4};
+    Version version{13, 2, 4};
     ASSERT_EQ(2, version.getMinorVersion());
 
     version.setMinorVersion(3);
@@ -103,7 +105,7 @@ namespace
 
   TEST_F(VersionTest, setPatchVersion)
   {
-    ls::std::core::Version version{13, 2, 4};
+    Version version{13, 2, 4};
     ASSERT_EQ(4, version.getPatchVersion());
 
     version.setPatchVersion(5);

+ 6 - 4
test/cases/core/exception/EventNotHandledExceptionTest.cpp

@@ -3,13 +3,15 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2021-05-27
- * Changed:         2022-05-13
+ * Changed:         2022-11-09
  *
  * */
 
 #include <gtest/gtest.h>
 #include <ls_std/ls_std_core.hpp>
 
+using namespace ls::std::core;
+
 namespace
 {
   class EventNotHandledExceptionTest : public ::testing::Test
@@ -31,13 +33,13 @@ namespace
     EXPECT_THROW({
                    try
                    {
-                     throw ls::std::core::EventNotHandledException{};
+                     throw EventNotHandledException{};
                    }
-                   catch (const ls::std::core::EventNotHandledException &_exception)
+                   catch (const EventNotHandledException &_exception)
                    {
                      EXPECT_STREQ("EventNotHandledException thrown - event was not handled - nothing happened!", _exception.what());
                      throw;
                    }
-                 }, ls::std::core::EventNotHandledException);
+                 }, EventNotHandledException);
   }
 }

+ 6 - 4
test/cases/core/exception/EventNotSubscribedExceptionTest.cpp

@@ -3,13 +3,15 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2021-05-27
- * Changed:         2022-05-13
+ * Changed:         2022-11-09
  *
  * */
 
 #include <gtest/gtest.h>
 #include <ls_std/ls_std_core.hpp>
 
+using namespace ls::std::core;
+
 namespace
 {
   class EventNotSubscribedExceptionTest : public ::testing::Test
@@ -31,13 +33,13 @@ namespace
     EXPECT_THROW({
                    try
                    {
-                     throw ls::std::core::EventNotSubscribedException{};
+                     throw EventNotSubscribedException{};
                    }
-                   catch (const ls::std::core::EventNotSubscribedException &_exception)
+                   catch (const EventNotSubscribedException &_exception)
                    {
                      EXPECT_STREQ("EventNotSubscribedException thrown - event was not subscribed!", _exception.what());
                      throw;
                    }
-                 }, ls::std::core::EventNotSubscribedException);
+                 }, EventNotSubscribedException);
   }
 }

+ 6 - 4
test/cases/core/exception/FileNotFoundExceptionTest.cpp

@@ -3,13 +3,15 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2021-05-01
- * Changed:         2022-05-13
+ * Changed:         2022-11-09
  *
  * */
 
 #include <gtest/gtest.h>
 #include <ls_std/ls_std_core.hpp>
 
+using namespace ls::std::core;
+
 namespace
 {
   class FileNotFoundExceptionTest : public ::testing::Test
@@ -31,13 +33,13 @@ namespace
     EXPECT_THROW({
                    try
                    {
-                     throw ls::std::core::FileNotFoundException{};
+                     throw FileNotFoundException{};
                    }
-                   catch (const ls::std::core::FileNotFoundException &_exception)
+                   catch (const FileNotFoundException &_exception)
                    {
                      EXPECT_STREQ("FileNotFoundException thrown - file not found!", _exception.what());
                      throw;
                    }
-                 }, ls::std::core::FileNotFoundException);
+                 }, FileNotFoundException);
   }
 }

+ 6 - 4
test/cases/core/exception/FileOperationExceptionTest.cpp

@@ -3,13 +3,15 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2021-05-01
- * Changed:         2022-05-13
+ * Changed:         2022-11-09
  *
  * */
 
 #include <gtest/gtest.h>
 #include <ls_std/ls_std_core.hpp>
 
+using namespace ls::std::core;
+
 namespace
 {
   class FileOperationExceptionTest : public ::testing::Test
@@ -31,13 +33,13 @@ namespace
     EXPECT_THROW({
                    try
                    {
-                     throw ls::std::core::FileOperationException{};
+                     throw FileOperationException{};
                    }
-                   catch (const ls::std::core::FileOperationException &_exception)
+                   catch (const FileOperationException &_exception)
                    {
                      EXPECT_STREQ("FileOperationException thrown - file operation failed!", _exception.what());
                      throw;
                    }
-                 }, ls::std::core::FileOperationException);
+                 }, FileOperationException);
   }
 }

+ 6 - 4
test/cases/core/exception/IllegalArgumentExceptionTest.cpp

@@ -3,13 +3,15 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2021-05-01
- * Changed:         2022-05-13
+ * Changed:         2022-11-09
  *
  * */
 
 #include <gtest/gtest.h>
 #include <ls_std/ls_std_core.hpp>
 
+using namespace ls::std::core;
+
 namespace
 {
   class IllegalArgumentExceptionTest : public ::testing::Test
@@ -31,13 +33,13 @@ namespace
     EXPECT_THROW({
                    try
                    {
-                     throw ls::std::core::IllegalArgumentException{};
+                     throw IllegalArgumentException{};
                    }
-                   catch (const ls::std::core::IllegalArgumentException &_exception)
+                   catch (const IllegalArgumentException &_exception)
                    {
                      EXPECT_STREQ("IllegalArgumentException thrown - passed argument is not valid!", _exception.what());
                      throw;
                    }
-                 }, ls::std::core::IllegalArgumentException);
+                 }, IllegalArgumentException);
   }
 }

+ 6 - 4
test/cases/core/exception/IllegalArithmeticOperationExceptionTest.cpp

@@ -3,13 +3,15 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2021-05-01
- * Changed:         2022-05-13
+ * Changed:         2022-11-09
  *
  * */
 
 #include <gtest/gtest.h>
 #include <ls_std/ls_std_core.hpp>
 
+using namespace ls::std::core;
+
 namespace
 {
   class IllegalArithmeticOperationExceptionTest : public ::testing::Test
@@ -31,13 +33,13 @@ namespace
     EXPECT_THROW({
                    try
                    {
-                     throw ls::std::core::IllegalArithmeticOperationException{};
+                     throw IllegalArithmeticOperationException{};
                    }
-                   catch (const ls::std::core::IllegalArithmeticOperationException &_exception)
+                   catch (const IllegalArithmeticOperationException &_exception)
                    {
                      EXPECT_STREQ("IllegalArithmeticOperationException thrown - arithmetic operation is not allowed!", _exception.what());
                      throw;
                    }
-                 }, ls::std::core::IllegalArithmeticOperationException);
+                 }, IllegalArithmeticOperationException);
   }
 }

+ 6 - 4
test/cases/core/exception/IncompleteJsonExceptionTest.cpp

@@ -3,13 +3,15 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2021-05-01
- * Changed:         2022-05-13
+ * Changed:         2022-11-09
  *
  * */
 
 #include <gtest/gtest.h>
 #include <ls_std/ls_std_core.hpp>
 
+using namespace ls::std::core;
+
 namespace
 {
   class IncompleteJsonExceptionTest : public ::testing::Test
@@ -31,13 +33,13 @@ namespace
     EXPECT_THROW({
                    try
                    {
-                     throw ls::std::core::IncompleteJsonException{};
+                     throw IncompleteJsonException{};
                    }
-                   catch (const ls::std::core::IncompleteJsonException &_exception)
+                   catch (const IncompleteJsonException &_exception)
                    {
                      EXPECT_STREQ("IncompleteJsonException thrown - this JSON string is incomplete.", _exception.what());
                      throw;
                    }
-                 }, ls::std::core::IncompleteJsonException);
+                 }, IncompleteJsonException);
   }
 }

+ 6 - 4
test/cases/core/exception/NullPointerExceptionTest.cpp

@@ -3,13 +3,15 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2021-05-01
- * Changed:         2022-05-13
+ * Changed:         2022-11-09
  *
  * */
 
 #include <gtest/gtest.h>
 #include <ls_std/ls_std_core.hpp>
 
+using namespace ls::std::core;
+
 namespace
 {
   class NullPointerExceptionTest : public ::testing::Test
@@ -31,13 +33,13 @@ namespace
     EXPECT_THROW({
                    try
                    {
-                     throw ls::std::core::NullPointerException{};
+                     throw NullPointerException{};
                    }
-                   catch (const ls::std::core::NullPointerException &_exception)
+                   catch (const NullPointerException &_exception)
                    {
                      EXPECT_STREQ("NullPointerException thrown - reference is null!", _exception.what());
                      throw;
                    }
-                 }, ls::std::core::NullPointerException);
+                 }, NullPointerException);
   }
 }

+ 6 - 3
test/cases/core/utils/RegexUtilsTest.cpp

@@ -3,13 +3,16 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-08-18
- * Changed:         2022-05-20
+ * Changed:         2022-11-09
  *
  * */
 
 #include <gtest/gtest.h>
 #include <ls_std/ls_std_core.hpp>
 
+using namespace ls::std::core;
+using namespace ::std;
+
 namespace
 {
   class RegexUtilsTest : public ::testing::Test
@@ -28,10 +31,10 @@ namespace
 
   TEST_F(RegexUtilsTest, escapeString)
   {
-    ::std::string escapedString = ls::std::core::RegexUtils::escapeString("Hello?!");
+    string escapedString = RegexUtils::escapeString("Hello?!");
     ASSERT_STREQ(R"(Hello\?!)", escapedString.c_str());
 
-    escapedString = ls::std::core::RegexUtils::escapeString(R"(\)");
+    escapedString = RegexUtils::escapeString(R"(\)");
     ASSERT_STREQ(R"(\\)", escapedString.c_str());
   }
 }

+ 32 - 29
test/cases/core/utils/STLUtilsTest.cpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-08-17
- * Changed:         2022-05-20
+ * Changed:         2022-11-09
  *
  * */
 
@@ -13,6 +13,9 @@
 #include <list>
 #include <string>
 
+using namespace ls::std::core;
+using namespace ::std;
+
 namespace
 {
   class STLUtilsTest : public ::testing::Test
@@ -31,52 +34,52 @@ namespace
 
   TEST_F(STLUtilsTest, contains)
   {
-    ::std::vector<int> values{1, 13, 7, 8};
-    ::std::list<::std::string> names{"Tim", "Alex", "Nadine"};
+    vector<int> values{1, 13, 7, 8};
+    list<string> names{"Tim", "Alex", "Nadine"};
 
-    ASSERT_TRUE((ls::std::core::STLUtils::contains(values, 1)));
-    ASSERT_TRUE((ls::std::core::STLUtils::contains(values, 13)));
-    ASSERT_TRUE((ls::std::core::STLUtils::contains(values, 7)));
-    ASSERT_TRUE((ls::std::core::STLUtils::contains(values, 8)));
+    ASSERT_TRUE((STLUtils::contains(values, 1)));
+    ASSERT_TRUE((STLUtils::contains(values, 13)));
+    ASSERT_TRUE((STLUtils::contains(values, 7)));
+    ASSERT_TRUE((STLUtils::contains(values, 8)));
 
-    ASSERT_TRUE((ls::std::core::STLUtils::contains(names, "Tim")));
-    ASSERT_TRUE((ls::std::core::STLUtils::contains(names, "Alex")));
-    ASSERT_TRUE((ls::std::core::STLUtils::contains(names, "Nadine")));
+    ASSERT_TRUE((STLUtils::contains(names, "Tim")));
+    ASSERT_TRUE((STLUtils::contains(names, "Alex")));
+    ASSERT_TRUE((STLUtils::contains(names, "Nadine")));
   }
 
   TEST_F(STLUtilsTest, containsNegative)
   {
-    ::std::vector<int> values{1, 13, 7, 8};
-    ::std::list<::std::string> names{"Tim", "Alex", "Nadine"};
+    vector<int> values{1, 13, 7, 8};
+    list<string> names{"Tim", "Alex", "Nadine"};
 
-    ASSERT_FALSE((ls::std::core::STLUtils::contains(values, 55)));
-    ASSERT_FALSE((ls::std::core::STLUtils::contains(values, 9)));
+    ASSERT_FALSE((STLUtils::contains(values, 55)));
+    ASSERT_FALSE((STLUtils::contains(values, 9)));
 
-    ASSERT_FALSE((ls::std::core::STLUtils::contains(names, "Lena")));
-    ASSERT_FALSE((ls::std::core::STLUtils::contains(names, "Mirco")));
+    ASSERT_FALSE((STLUtils::contains(names, "Lena")));
+    ASSERT_FALSE((STLUtils::contains(names, "Mirco")));
   }
 
   TEST_F(STLUtilsTest, getListElementAt)
   {
-    ::std::list<int> values{1, 13, 7, 8};
-    ::std::list<::std::string> names{"Tim", "Alex", "Nadine"};
+    list<int> values{1, 13, 7, 8};
+    list<string> names{"Tim", "Alex", "Nadine"};
 
-    ASSERT_EQ(1, (ls::std::core::STLUtils::getListElementAt(values, 0)));
-    ASSERT_EQ(13, (ls::std::core::STLUtils::getListElementAt(values, 1)));
-    ASSERT_EQ(7, (ls::std::core::STLUtils::getListElementAt(values, 2)));
-    ASSERT_EQ(8, (ls::std::core::STLUtils::getListElementAt(values, 3)));
+    ASSERT_EQ(1, (STLUtils::getListElementAt(values, 0)));
+    ASSERT_EQ(13, (STLUtils::getListElementAt(values, 1)));
+    ASSERT_EQ(7, (STLUtils::getListElementAt(values, 2)));
+    ASSERT_EQ(8, (STLUtils::getListElementAt(values, 3)));
 
-    ASSERT_STREQ("Tim", ls::std::core::STLUtils::getListElementAt(names, 0).c_str());
-    ASSERT_STREQ("Alex", ls::std::core::STLUtils::getListElementAt(names, 1).c_str());
-    ASSERT_STREQ("Nadine", ls::std::core::STLUtils::getListElementAt(names, 2).c_str());
+    ASSERT_STREQ("Tim", STLUtils::getListElementAt(names, 0).c_str());
+    ASSERT_STREQ("Alex", STLUtils::getListElementAt(names, 1).c_str());
+    ASSERT_STREQ("Nadine", STLUtils::getListElementAt(names, 2).c_str());
   }
 
   TEST_F(STLUtilsTest, getListElementAtNegative)
   {
-    ::std::list<int> values{1, 13, 7, 8};
-    ::std::list<::std::string> names{"Tim", "Alex", "Nadine"};
+    list<int> values{1, 13, 7, 8};
+    list<string> names{"Tim", "Alex", "Nadine"};
 
-    ASSERT_EQ(0, (ls::std::core::STLUtils::getListElementAt(values, 15)));
-    ASSERT_STREQ("", ls::std::core::STLUtils::getListElementAt(names, 15).c_str());
+    ASSERT_EQ(0, (STLUtils::getListElementAt(values, 15)));
+    ASSERT_STREQ("", STLUtils::getListElementAt(names, 15).c_str());
   }
 }