Apply clang-format to source tree
[alexxy/gromacs.git] / src / gromacs / coordinateio / tests / setatoms.cpp
index 8dc116fa6965452918555159217533a2c4fb2bf9..79ac2ad7b27fb501cf3d562f9274f7854ca8cbaa 100644 (file)
@@ -64,45 +64,42 @@ namespace test
  */
 class SetAtomsTest : public gmx::test::CommandLineTestBase
 {
-    public:
-        //! Prepare test fixture topology to have atoms available.
-        SetAtomsTest()
+public:
+    //! Prepare test fixture topology to have atoms available.
+    SetAtomsTest()
+    {
+        topology_.fillFromInputFile(TestFileManager::getInputFilePath("lysozyme.pdb"));
+    }
+
+    /*! \brief
+     * Get access to the method for changing atom information.
+     *
+     * \param[in] type Type to use for setting up method.
+     * \param[in] haveAtomsAvailable Decide if method shouöd have atoms stored or not.
+     */
+    SetAtoms* setAtoms(ChangeAtomsType type, bool haveAtomsAvailable)
+    {
+        if (!setAtoms_)
         {
-            topology_.fillFromInputFile(TestFileManager::getInputFilePath("lysozyme.pdb"));
-        }
-
-        /*! \brief
-         * Get access to the method for changing atom information.
-         *
-         * \param[in] type Type to use for setting up method.
-         * \param[in] haveAtomsAvailable Decide if method shouöd have atoms stored or not.
-         */
-        SetAtoms *setAtoms(ChangeAtomsType type, bool haveAtomsAvailable)
-        {
-            if (!setAtoms_)
+            if (haveAtomsAvailable)
             {
-                if (haveAtomsAvailable)
-                {
-                    setAtoms_ = std::make_unique<SetAtoms>(type, topology_.copyAtoms());
-                }
-                else
-                {
-                    setAtoms_ = std::make_unique<SetAtoms>(type,  nullptr);
-                }
+                setAtoms_ = std::make_unique<SetAtoms>(type, topology_.copyAtoms());
+            }
+            else
+            {
+                setAtoms_ = std::make_unique<SetAtoms>(type, nullptr);
             }
-            return setAtoms_.get();
-        }
-        //! Get access to a t_atoms struct to use in the dummy t_trxframe.
-        t_atoms *getAtomsCopy()
-        {
-            return const_cast<t_atoms *>(topology_.atoms());
         }
-
-    private:
-        //! Object to use for tests
-        SetAtomsPointer     setAtoms_;
-        //! Local topology to get atoms from
-        TopologyInformation topology_;
+        return setAtoms_.get();
+    }
+    //! Get access to a t_atoms struct to use in the dummy t_trxframe.
+    t_atoms* getAtomsCopy() { return const_cast<t_atoms*>(topology_.atoms()); }
+
+private:
+    //! Object to use for tests
+    SetAtomsPointer setAtoms_;
+    //! Local topology to get atoms from
+    TopologyInformation topology_;
 };
 
 TEST_F(SetAtomsTest, RemovesExistingAtoms)
@@ -115,7 +112,7 @@ TEST_F(SetAtomsTest, RemovesExistingAtoms)
 
     EXPECT_NE(frame.atoms, nullptr);
 
-    SetAtoms *method = setAtoms(ChangeAtomsType::Never, true);
+    SetAtomsmethod = setAtoms(ChangeAtomsType::Never, true);
     EXPECT_NO_THROW(method->processFrame(0, &frame));
 
     EXPECT_FALSE(frame.bAtoms);
@@ -130,7 +127,7 @@ TEST_F(SetAtomsTest, AddsNewAtoms)
     frame.bAtoms = false;
     frame.atoms  = nullptr;
 
-    SetAtoms *method = setAtoms(ChangeAtomsType::AlwaysFromStructure, true);
+    SetAtomsmethod = setAtoms(ChangeAtomsType::AlwaysFromStructure, true);
     EXPECT_NO_THROW(method->processFrame(0, &frame));
 
     EXPECT_TRUE(frame.bAtoms);
@@ -145,7 +142,7 @@ TEST_F(SetAtomsTest, ThrowsOnRequiredAtomsNotAvailable)
     frame.bAtoms = false;
     frame.atoms  = nullptr;
 
-    SetAtoms *method = setAtoms(ChangeAtomsType::Always, false);
+    SetAtomsmethod = setAtoms(ChangeAtomsType::Always, false);
     EXPECT_THROW(method->processFrame(0, &frame), InconsistentInputError);
 }
 
@@ -159,7 +156,7 @@ TEST_F(SetAtomsTest, WillUseOldAtomsWhenNoNewAvailable)
 
     EXPECT_NE(frame.atoms, nullptr);
 
-    SetAtoms *method = setAtoms(ChangeAtomsType::Always, false);
+    SetAtomsmethod = setAtoms(ChangeAtomsType::Always, false);
     EXPECT_NO_THROW(method->processFrame(0, &frame));
 }
 
@@ -173,7 +170,7 @@ TEST_F(SetAtomsTest, ThrowsWhenUserAtomReplacementNotPossible)
 
     EXPECT_NE(frame.atoms, nullptr);
 
-    SetAtoms *method = setAtoms(ChangeAtomsType::AlwaysFromStructure, false);
+    SetAtomsmethod = setAtoms(ChangeAtomsType::AlwaysFromStructure, false);
     EXPECT_THROW(method->processFrame(0, &frame), InconsistentInputError);
 }