forked from Expander/FlexibleSUSY
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: allow user to set settings in form of an Eigen array
similar to many other classes
- Loading branch information
Alexander Voigt
authored and
Alexander Voigt
committed
Nov 15, 2017
1 parent
fe69081
commit d55be33
Showing
4 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#define BOOST_TEST_DYN_LINK | ||
#define BOOST_TEST_MODULE test_spectrum_generator_settings | ||
|
||
#include <boost/test/unit_test.hpp> | ||
#include "spectrum_generator_settings.hpp" | ||
|
||
using namespace flexiblesusy; | ||
|
||
BOOST_AUTO_TEST_CASE( test_get ) | ||
{ | ||
Spectrum_generator_settings s; | ||
const auto es = s.get(); | ||
|
||
BOOST_REQUIRE_EQUAL(Spectrum_generator_settings::NUMBER_OF_OPTIONS, es.size()); | ||
|
||
for (int i = 0; i < Spectrum_generator_settings::NUMBER_OF_OPTIONS; i++) { | ||
BOOST_CHECK_EQUAL(s.get(static_cast<Spectrum_generator_settings::Settings>(i)), es(i)); | ||
} | ||
} | ||
|
||
BOOST_AUTO_TEST_CASE( test_set ) | ||
{ | ||
const int N = Spectrum_generator_settings::NUMBER_OF_OPTIONS; | ||
Spectrum_generator_settings::Settings_t es = Spectrum_generator_settings::Settings_t::Random(N); | ||
|
||
BOOST_REQUIRE_EQUAL(Spectrum_generator_settings::NUMBER_OF_OPTIONS, es.size()); | ||
|
||
Spectrum_generator_settings s; | ||
s.set(es); | ||
|
||
for (int i = 0; i < Spectrum_generator_settings::NUMBER_OF_OPTIONS; i++) { | ||
BOOST_CHECK_EQUAL(s.get(static_cast<Spectrum_generator_settings::Settings>(i)), es(i)); | ||
} | ||
} |