1 /* 2 * This file is part of the GROMACS molecular simulation package. 3 * 4 * Copyright (c) 2011,2012,2013,2014,2015 by the GROMACS development team. 5 * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by 6 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, 7 * and including many others, as listed in the AUTHORS file in the 8 * top-level source directory and at http://www.gromacs.org. 9 * 10 * GROMACS is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU Lesser General Public License 12 * as published by the Free Software Foundation; either version 2.1 13 * of the License, or (at your option) any later version. 14 * 15 * GROMACS is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * Lesser General Public License for more details. 19 * 20 * You should have received a copy of the GNU Lesser General Public 21 * License along with GROMACS; if not, see 22 * http://www.gnu.org/licenses, or write to the Free Software Foundation, 23 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 24 * 25 * If you want to redistribute modifications to GROMACS, please 26 * consider that scientific software is very special. Version 27 * control is crucial - bugs must be traceable. We will be happy to 28 * consider code for inclusion in the official distribution, but 29 * derived work must not be called official GROMACS. Details are found 30 * in the README & COPYING files - if they are missing, get the 31 * official version at http://www.gromacs.org. 32 * 33 * To help us fund GROMACS development, we humbly ask that you cite 34 * the research papers on the package. Check out http://www.gromacs.org. 35 */ 36 /*! \libinternal \file 37 * \brief 38 * Declares mock implementation of gmx::IAnalysisDataModule. 39 * 40 * Requires Google Mock. 41 * 42 * \author Teemu Murtola <teemu.murtola@gmail.com> 43 * \inlibraryapi 44 * \ingroup module_analysisdata 45 */ 46 #ifndef GMX_ANALYSISDATA_TESTS_MOCK_DATAMODULE_H 47 #define GMX_ANALYSISDATA_TESTS_MOCK_DATAMODULE_H 48 49 #include <memory> 50 51 #include <gmock/gmock.h> 52 53 #include "gromacs/analysisdata/dataframe.h" 54 #include "gromacs/analysisdata/datamodule.h" 55 #include "gromacs/analysisdata/paralleloptions.h" 56 #include "gromacs/utility/classhelpers.h" 57 58 namespace gmx 59 { 60 namespace test 61 { 62 63 class AnalysisDataTestInput; 64 class TestReferenceChecker; 65 66 class MockAnalysisDataModule : public IAnalysisDataModule 67 { 68 public: 69 explicit MockAnalysisDataModule(int flags); 70 ~MockAnalysisDataModule() override; 71 72 int flags() const override; 73 74 MOCK_METHOD2(parallelDataStarted, 75 bool(AbstractAnalysisData* data, const AnalysisDataParallelOptions& options)); 76 MOCK_METHOD1(dataStarted, void(AbstractAnalysisData* data)); 77 MOCK_METHOD1(frameStarted, void(const AnalysisDataFrameHeader& header)); 78 MOCK_METHOD1(pointsAdded, void(const AnalysisDataPointSetRef& points)); 79 MOCK_METHOD1(frameFinished, void(const AnalysisDataFrameHeader& header)); 80 MOCK_METHOD1(frameFinishedSerial, void(int frameIndex)); 81 MOCK_METHOD0(dataFinished, void()); 82 83 void setupStaticCheck(const AnalysisDataTestInput& data, AbstractAnalysisData* source, bool bParallel); 84 void setupStaticColumnCheck(const AnalysisDataTestInput& data, int firstcol, int n, AbstractAnalysisData* source); 85 void setupStaticStorageCheck(const AnalysisDataTestInput& data, 86 int storageCount, 87 AbstractAnalysisData* source); 88 void setupReferenceCheck(const TestReferenceChecker& checker, AbstractAnalysisData* source); 89 90 private: 91 class Impl; 92 93 PrivateImplPointer<Impl> impl_; 94 }; 95 96 //! Smart pointer to manage an MockAnalysisDataModule object. 97 typedef std::shared_ptr<MockAnalysisDataModule> MockAnalysisDataModulePointer; 98 99 } // namespace test 100 } // namespace gmx 101 102 #endif 103