Ver código fonte

Address SonarLint findings in SectionPairDocumentTest class

Patrick-Christopher Mattulat 1 ano atrás
pai
commit
b877ed8b75

+ 15 - 15
test/cases/io/section-pair/model/SectionPairDocumentTest.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-15
-* Changed:         2023-03-25
+* Changed:         2023-05-16
 *
 * */
 
@@ -39,7 +39,7 @@ namespace
 
   TEST_F(SectionPairDocumentTest, add)
   {
-    shared_ptr<SectionPairDocument> document = make_shared<SectionPairDocument>();
+    auto document = make_shared<SectionPairDocument>();
 
     ASSERT_TRUE(document->getSectionList().empty());
     document->add(make_shared<SectionPairSection>("general"));
@@ -48,7 +48,7 @@ namespace
 
   TEST_F(SectionPairDocumentTest, add_section_id_already_exists)
   {
-    shared_ptr<SectionPairDocument> document = make_shared<SectionPairDocument>();
+    auto document = make_shared<SectionPairDocument>();
     document->add(make_shared<SectionPairSection>("general"));
 
     EXPECT_THROW(
@@ -67,7 +67,7 @@ namespace
 
   TEST_F(SectionPairDocumentTest, clear)
   {
-    shared_ptr<SectionPairDocument> document = make_shared<SectionPairDocument>();
+    auto document = make_shared<SectionPairDocument>();
     document->add(make_shared<SectionPairSection>("general"));
 
     ASSERT_EQ(1, document->getAmountOfSections());
@@ -77,7 +77,7 @@ namespace
 
   TEST_F(SectionPairDocumentTest, get_by_index)
   {
-    shared_ptr<SectionPairDocument> document = make_shared<SectionPairDocument>();
+    auto document = make_shared<SectionPairDocument>();
     document->add(make_shared<SectionPairSection>("general"));
 
     ASSERT_TRUE(document->get(0) != nullptr);
@@ -85,7 +85,7 @@ namespace
 
   TEST_F(SectionPairDocumentTest, get_by_section_id)
   {
-    shared_ptr<SectionPairDocument> document = make_shared<SectionPairDocument>();
+    auto document = make_shared<SectionPairDocument>();
     document->add(make_shared<SectionPairSection>("general"));
 
     ASSERT_TRUE(document->get("general") != nullptr);
@@ -93,7 +93,7 @@ namespace
 
   TEST_F(SectionPairDocumentTest, get_by_section_id_not_found)
   {
-    shared_ptr<SectionPairDocument> document = make_shared<SectionPairDocument>();
+    auto document = make_shared<SectionPairDocument>();
     document->add(make_shared<SectionPairSection>("general"));
 
     ASSERT_TRUE(document->get("about") == nullptr);
@@ -101,7 +101,7 @@ namespace
 
   TEST_F(SectionPairDocumentTest, get_by_index_out_of_bounds)
   {
-    shared_ptr<SectionPairDocument> document = make_shared<SectionPairDocument>();
+    auto document = make_shared<SectionPairDocument>();
 
     EXPECT_THROW(
         {
@@ -119,7 +119,7 @@ namespace
 
   TEST_F(SectionPairDocumentTest, getAmountOfSections)
   {
-    shared_ptr<SectionPairDocument> document = make_shared<SectionPairDocument>();
+    auto document = make_shared<SectionPairDocument>();
     document->add(make_shared<SectionPairSection>("general"));
 
     ASSERT_EQ(1, document->getAmountOfSections());
@@ -127,25 +127,25 @@ namespace
 
   TEST_F(SectionPairDocumentTest, getClassName)
   {
-    shared_ptr<SectionPairDocument> document = make_shared<SectionPairDocument>();
+    auto document = make_shared<SectionPairDocument>();
     ASSERT_STREQ("SectionPairDocument", document->getClassName().c_str());
   }
 
   TEST_F(SectionPairDocumentTest, getHeader)
   {
-    shared_ptr<SectionPairDocument> document = make_shared<SectionPairDocument>();
+    auto document = make_shared<SectionPairDocument>();
     ASSERT_STREQ("# section-pair document", document->getHeader().c_str());
   }
 
   TEST_F(SectionPairDocumentTest, getSectionList)
   {
-    shared_ptr<SectionPairDocument> document = make_shared<SectionPairDocument>();
+    auto document = make_shared<SectionPairDocument>();
     ASSERT_TRUE(document->getSectionList().empty());
   }
 
   TEST_F(SectionPairDocumentTest, hasSection)
   {
-    shared_ptr<SectionPairDocument> document = make_shared<SectionPairDocument>();
+    auto document = make_shared<SectionPairDocument>();
     document->add(make_shared<SectionPairSection>("general"));
 
     ASSERT_TRUE(document->hasSection("general"));
@@ -153,7 +153,7 @@ namespace
 
   TEST_F(SectionPairDocumentTest, hasSection_not_found)
   {
-    shared_ptr<SectionPairDocument> document = make_shared<SectionPairDocument>();
+    auto document = make_shared<SectionPairDocument>();
     document->add(make_shared<SectionPairSection>("general"));
 
     ASSERT_FALSE(document->hasSection("about"));
@@ -169,7 +169,7 @@ namespace
 
   TEST_F(SectionPairDocumentTest, unmarshal)
   {
-    shared_ptr<SectionPairDocument> document = make_shared<SectionPairDocument>();
+    auto document = make_shared<SectionPairDocument>();
     document->unmarshal(SectionPairDocumentProvider::createSerializedDocument(NewLine::get()));
 
     ASSERT_EQ(2, document->getAmountOfSections());