3 * This source code is part of
7 * GROningen MAchine for Chemical Simulations
9 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
10 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
11 * Copyright (c) 2001-2009, The GROMACS development team,
12 * check out http://www.gromacs.org for more information.
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * If you want to redistribute modifications, please consider that
20 * scientific software is very special. Version control is crucial -
21 * bugs must be traceable. We will be happy to consider code for
22 * inclusion in the official distribution, but derived work must not
23 * be called official GROMACS. Details are found in the README & COPYING
24 * files - if they are missing, get the official version at www.gromacs.org.
26 * To help us fund GROMACS development, we humbly ask that you cite
27 * the papers on the package - you can find them in the top README file.
29 * For more info, check our website at http://www.gromacs.org
33 * Tests for functionality of the "select" trajectory analysis module.
35 * These tests test most of the functionality of the module, but currently
37 * - Tests related to -oc output. This would require a more complex input
38 * structure for reasonable testing (the same structure could also be used
39 * in selection unit tests for 'insolidangle' keyword).
40 * - Tests for XVG labels. This is a limitation of the current testing
43 * \author Teemu Murtola <teemu.murtola@cbr.su.se>
44 * \ingroup module_trajectoryanalysis
46 #include <gtest/gtest.h>
48 #include "gromacs/trajectoryanalysis/modules/select.h"
50 #include "testutils/cmdlinetest.h"
52 #include "moduletest.h"
57 using gmx::test::CommandLine;
59 /********************************************************************
60 * Tests for gmx::analysismodules::Select.
63 typedef gmx::test::TrajectoryAnalysisModuleTestFixture<gmx::analysismodules::Select>
66 TEST_F(SelectModuleTest, BasicTest)
68 const char *const cmdline[] = {
70 "-select", "y < 2.5", "resname RA"
72 setTopology("simple.gro");
73 setOutputFile("-oi", "index.dat");
74 setOutputFile("-on", "index.ndx");
75 excludeDataset("cfrac");
76 runTest(CommandLine::create(cmdline));
79 TEST_F(SelectModuleTest, HandlesDumpOption)
81 const char *const cmdline[] = {
86 setTopology("simple.gro");
87 setOutputFile("-oi", "index.dat");
88 includeDataset("index");
89 runTest(CommandLine::create(cmdline));
92 TEST_F(SelectModuleTest, NormalizesSizes)
94 const char *const cmdline[] = {
96 "-select", "y < 2.5", "resname RA and y < 2.5", "resname RA",
99 setTopology("simple.gro");
100 includeDataset("size");
101 runTest(CommandLine::create(cmdline));
104 TEST_F(SelectModuleTest, WritesResidueNumbers)
106 const char *const cmdline[] = {
108 "-select", "res_com of resname RA RD"
110 setTopology("simple.gro");
111 includeDataset("index");
112 runTest(CommandLine::create(cmdline));
115 TEST_F(SelectModuleTest, WritesResidueIndices)
117 const char *const cmdline[] = {
119 "-select", "res_com of resname RA RD",
122 setTopology("simple.gro");
123 includeDataset("index");
124 runTest(CommandLine::create(cmdline));