Newer
Older
Russell Taylor
committed
#ifndef ENVIRONMENTHISTORYTEST_H_
#define ENVIRONMENTHISTORYTEST_H_
#include <cxxtest/TestSuite.h>
#include "MantidKernel/EnvironmentHistory.h"
#include "MantidKernel/ConfigService.h"
#include "MantidKernel/MantidVersion.h"
Russell Taylor
committed
#include <sstream>
Russell Taylor
committed
class EnvironmentHistoryTest : public CxxTest::TestSuite {
Russell Taylor
committed
public:
Russell Taylor
committed
EnvironmentHistory EH;
TS_ASSERT_EQUALS(EH.frameworkVersion(), MantidVersion::version());
Russell Taylor
committed
}
Russell Taylor
committed
EnvironmentHistory EH;
TS_ASSERT_EQUALS(EH.osName(), ConfigService::Instance().getOSName());
}
Russell Taylor
committed
Russell Taylor
committed
EnvironmentHistory EH;
TS_ASSERT_EQUALS(EH.osVersion(), ConfigService::Instance().getOSVersion());
Russell Taylor
committed
}
void testPopulate() {
std::string correctOutput =
"Framework Version: " + std::string(MantidVersion::version()) + "\n";
Russell Taylor
committed
correctOutput += "OS name: " + ConfigService::Instance().getOSName() + "\n";
correctOutput +=
"OS version: " + ConfigService::Instance().getOSVersion() + "\n";
Russell Taylor
committed
// Not really much to test
EnvironmentHistory EH;
Russell Taylor
committed
std::ostringstream output;
output.exceptions(std::ios::failbit | std::ios::badbit);
Russell Taylor
committed
TS_ASSERT_THROWS_NOTHING(output << EH);
TS_ASSERT_EQUALS(output.str(), correctOutput);
Russell Taylor
committed
}
};
#endif /* ALGORITHMPARAMETERTEST_H_*/