Skip to content
Snippets Groups Projects
Commit 5f9f0231 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

start new Core/Std test

parent f863c6c8
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@ add_subdirectory(CoreStandardTest)
add_subdirectory(SelfConsistenceTest)
add_subdirectory(CoreSpecial)
add_subdirectory(Fitting)
add_subdirectory(Std)
# build MPI test executable
if(BORNAGAIN_MPI)
......
include(GoogleTest) # provides gtest_discover_tests
set(test TestCoreStd)
file(GLOB source_files "*.cpp")
add_executable(${test} ${source_files} ${CMAKE_SOURCE_DIR}/Tests/GTestWrapper/TestAll.cpp)
target_include_directories(${test}
PUBLIC ${CMAKE_SOURCE_DIR}/ThirdParty/common/gtest/gtest-1.8.0/include)
target_link_libraries(${test} BornAgainFit gtest)
gtest_discover_tests(${test} TEST_PREFIX Core.)
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file Tests/Functional/Core/CoreStandardTest/CoreStandardTest.cpp
//! @brief Implements class CoreStandardTest.
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************** //
#include "BABuild.h"
#include "BATesting.h"
#include "Core/InputOutput/IntensityDataIOFactory.h"
#include "Core/Instrument/IntensityDataFunctions.h"
#include "Core/Simulation/Simulation.h"
#include "Core/Tools/FileSystemUtils.h"
#include <cassert>
int run(const char* test_name, const char* sim_name, const char* sample_name, const double limit)
{
return 1;
}
/*
bool CoreStandardTest::runTest()
{
std::unique_ptr<OutputData<double>> reference;
// Load reference if available
assert(m_name != "");
try {
reference.reset(IntensityDataIOFactory::readOutputData(
FileSystemUtils::jointPath(BATesting::CoreReferenceDir(), m_name + ".int.gz")));
} catch (const std::exception&) {
std::cout << "No reference found, but we proceed with the simulation to create a new one\n";
}
// Run simulation.
assert(m_reference_simulation);
m_reference_simulation->runSimulation();
auto sim_result = m_reference_simulation->result();
const auto result_data = sim_result.data();
// Compare with reference if available.
bool success = false;
if (reference)
success =
IntensityDataFunctions::checkRelativeDifference(*result_data, *reference, m_threshold);
// Save simulation if different from reference.
if (!success) {
FileSystemUtils::createDirectories(BATesting::CoreOutputDir());
std::string out_fname =
FileSystemUtils::jointPath(BATesting::CoreOutputDir(), m_name + ".int.gz");
IntensityDataIOFactory::writeOutputData(*result_data, out_fname);
std::cout << "New simulation result stored in " << out_fname << "\n"
<< "To visualize an intensity map, use " << BABuild::buildBinDir()
<< "/plot_intensity_data.py;"
<< " to plot a difference image, use " << BABuild::buildBinDir()
<< "/plot_intensity_data_diff.py\n"
<< "If the new result is correct, then move it to "
<< BATesting::CoreReferenceDir() << "/\n";
}
return success;
}
*/
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file Tests/Functional/Core/CoreStandardTest/CoreStandardTest.cpp
//! @brief Declares function run.
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************** //
int run(const char* test_name, const char* sim_name, const char* sample_name, const double limit);
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file Tests/Functional/Core/CoreStandardTest/CoreStandardTest.cpp
//! @brief Implements class CoreStandardTest.
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************** //
#include "Tests/Functional/Core/Std/Run.h"
#include "Tests/Functional/NewStd/StandardTests.h" // contains macros that are executed by gtest
......@@ -12,6 +12,12 @@
//
// ************************************************************************** //
#include "Tests/GTestWrapper/google_test.h"
class Minimize : public ::testing::Test
{
};
TEST_F(Std, FormFactors)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment