8 #ifndef TEST_INTERFACE_OBSITERATOR_H_
9 #define TEST_INTERFACE_OBSITERATOR_H_
14 #define ECKIT_TESTING_SELF_REGISTER_CASES 0
16 #include "eckit/config/Configuration.h"
17 #include "eckit/testing/Test.h"
42 template <
typename OBS>
void testBasic() {
44 typedef ObsTestsFixture<OBS> Test_;
46 for (
size_t jj = 0; jj < Test_::obspace().size(); ++jj) {
47 const double tol = Test_::config(jj).getDouble(
"obs iterator test.tolerance");
50 ObsIterator_ iter1 = Test_::obspace()[jj].begin();
51 EXPECT(iter1 == Test_::obspace()[jj].begin());
53 ObsIterator_ iter2 = Test_::obspace()[jj].end();
54 EXPECT(iter2 == Test_::obspace()[jj].end());
57 EXPECT(iter1 != iter2);
60 oops::Log::test() <<
"ObsSpace::begin " << iter1 << std::endl;
65 for (ObsIterator_ ii = Test_::obspace()[jj].begin(); ii != Test_::obspace()[jj].end(); ++ii) {
68 size_t nlocs_ref = Test_::config(jj).getUnsigned(
"obs iterator test.reference nlocs");
69 EXPECT_EQUAL(nlocs, nlocs_ref);
72 double lon1 = Test_::config(jj).getDouble(
"obs iterator test.lon1");
73 double lat1 = Test_::config(jj).getDouble(
"obs iterator test.lat1");
74 const eckit::geometry::Point2 point1(lon1, lat1);
75 EXPECT((*iter1).distance(point1) <= tol);
79 double lon2 = Test_::config(jj).getDouble(
"obs iterator test.lon2");
80 double lat2 = Test_::config(jj).getDouble(
"obs iterator test.lat2");
81 const eckit::geometry::Point2 point2(lon2, lat2);
82 EXPECT((*iter1).distance(point2) <= tol);
96 std::string
testid()
const override {
return "test::ObsIterator<" + OBS::name() +
">";}
99 std::vector<eckit::testing::Test>& ts = eckit::testing::specification();
101 ts.emplace_back(
CASE(
"interface/ObsIterator/testBasic")
102 { testBasic<OBS>(); });
std::string testid() const override
ObsTestsFixture< OBS > Test_
void register_tests() const override
void clear() const override
virtual ~ObsIterator()=default
void testBasic()
Tests of Geometry::begin/end; GeometryIterator ctor and ==/!= operators.
CASE("test_linearmodelparameterswrapper_valid_name")