11 #ifndef TEST_INTERFACE_OBSVECTOR_H_ 12 #define TEST_INTERFACE_OBSVECTOR_H_ 17 #define BOOST_TEST_NO_MAIN 18 #define BOOST_TEST_ALTERNATIVE_INIT_API 19 #define BOOST_TEST_DYN_LINK 20 #include <boost/test/unit_test.hpp> 22 #include <boost/scoped_ptr.hpp> 26 #include "oops/util/dot_product.h" 35 typedef ObsTestsFixture<MODEL> Test_;
38 for (std::size_t jj = 0; jj < Test_::obspace().size(); ++jj) {
39 boost::scoped_ptr<ObsVector_> ov(
new ObsVector_(Test_::obspace()[jj]));
40 BOOST_CHECK(ov.get());
43 BOOST_CHECK(!ov.get());
50 typedef ObsTestsFixture<MODEL> Test_;
53 for (std::size_t jj = 0; jj < Test_::obspace().size(); ++jj) {
54 boost::scoped_ptr<ObsVector_> ov(
new ObsVector_(Test_::obspace()[jj]));
56 boost::scoped_ptr<ObsVector_> other(
new ObsVector_(*ov));
57 BOOST_CHECK(other.get());
60 BOOST_CHECK(!other.get());
62 BOOST_CHECK(ov.get());
71 const double zero = 0.0;
73 for (std::size_t jj = 0; jj < Test_::obspace().size(); ++jj) {
74 ObsVector_ ov(Test_::obspace()[jj]);
78 const double ovov2 = dot_product(ov, ov);
79 BOOST_CHECK(ovov2 >
zero);
83 const double zz = dot_product(ov, ov);
84 BOOST_CHECK(zz ==
zero);
98 boost::unit_test::test_suite * ts = BOOST_TEST_SUITE(
"interface/ObsVector");
100 ts->add(BOOST_TEST_CASE(&testConstructor<MODEL>));
101 ts->add(BOOST_TEST_CASE(&testCopyConstructor<MODEL>));
102 ts->add(BOOST_TEST_CASE(&testNotZero<MODEL>));
104 boost::unit_test::framework::master_test_suite().add(ts);
112 #endif // TEST_INTERFACE_OBSVECTOR_H_
real(double), parameter zero
void testCopyConstructor()
void register_tests() const
std::string testid() const