*/
/*! \internal \file
* \brief
- * Tests for gmx::ProgramInfo.
+ * Tests for gmx::CommandLineProgramContext.
*
* \author Teemu Murtola <teemu.murtola@gmail.com>
- * \ingroup module_utility
+ * \ingroup module_commandline
*/
+#include "gmxpre.h"
+
+#include "gromacs/commandline/cmdlineprogramcontext.h"
+
+#include "config.h"
+
#include <string>
#include <vector>
+#include <boost/shared_ptr.hpp>
#include <gtest/gtest.h>
-#include "gromacs/commandline/cmdlineprogramcontext.h"
#include "gromacs/utility/common.h"
#include "gromacs/utility/path.h"
-#include "gromacs/utility/uniqueptr.h"
#include "testutils/cmdlinetest.h"
-#include "config.h"
-
using gmx::test::CommandLine;
using gmx::Path;
};
//! Shorthand for a smart pointer to TestExecutableEnvironment.
-typedef gmx::gmx_unique_ptr<TestExecutableEnvironment>::type
+typedef boost::shared_ptr<TestExecutableEnvironment>
TestExecutableEnvironmentPointer;
-class ProgramInfoTest : public ::testing::Test
+class CommandLineProgramContextTest : public ::testing::Test
{
public:
- ProgramInfoTest()
+ CommandLineProgramContextTest()
: env_(new TestExecutableEnvironment())
{
expectedExecutable_ =
void testBinaryPathSearch(const char *argv0)
{
ASSERT_TRUE(env_.get() != NULL);
- gmx::ProgramInfo info(1, &argv0, move(env_));
+ gmx::CommandLineProgramContext info(1, &argv0, env_);
EXPECT_EQ(expectedExecutable_, info.fullBinaryPath());
}
void testBinaryPathSearch(const std::string &argv0)
TestExecutableEnvironmentPointer env_;
};
-TEST_F(ProgramInfoTest, FindsBinaryWithAbsolutePath)
+TEST_F(CommandLineProgramContextTest, FindsBinaryWithAbsolutePath)
{
testBinaryPathSearch(Path::join(env_->getWorkingDirectory(), "bin/test-exe"));
}
-TEST_F(ProgramInfoTest, FindsBinaryWithRelativePath)
+TEST_F(CommandLineProgramContextTest, FindsBinaryWithRelativePath)
{
testBinaryPathSearch("bin/test-exe");
}
-TEST_F(ProgramInfoTest, FindsBinaryFromPath)
+TEST_F(CommandLineProgramContextTest, FindsBinaryFromPath)
{
env_->path_.push_back(Path::join(env_->getWorkingDirectory(), "bin"));
testBinaryPathSearch("test-exe");
}
-TEST_F(ProgramInfoTest, FindsBinaryFromCurrentDirectory)
+TEST_F(CommandLineProgramContextTest, FindsBinaryFromCurrentDirectory)
{
env_->workingDirectory_ = Path::join(env_->getWorkingDirectory(), "bin");
env_->path_.push_back("");
}
#ifdef TEST_SYMLINKS
-TEST_F(ProgramInfoTest, FindsBinaryFromAbsoluteSymLink)
+TEST_F(CommandLineProgramContextTest, FindsBinaryFromAbsoluteSymLink)
{
testBinaryPathSearch("bin/test-abs-link");
}
-TEST_F(ProgramInfoTest, FindsBinaryFromRelativeSymLink)
+TEST_F(CommandLineProgramContextTest, FindsBinaryFromRelativeSymLink)
{
testBinaryPathSearch("bin/test-rel-link");
}