FV3 Bundle
test/base/Variables.cc
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2009-2016 ECMWF.
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  * In applying this licence, ECMWF does not waive the privileges and immunities
7  * granted to it by virtue of its status as an intergovernmental organisation nor
8  * does it submit to any jurisdiction.
9  */
10 
11 #include <string>
12 #include <boost/scoped_ptr.hpp>
13 #include <boost/test/unit_test.hpp>
14 
15 #include "eckit/config/LocalConfiguration.h"
16 #include "oops/base/Variables.h"
17 #include "test/TestEnvironment.h"
18 #include "test/TestFixture.h"
19 
20 namespace test {
21 
22 // -----------------------------------------------------------------------------
24  public:
26  conf_.reset(new eckit::LocalConfiguration(TestEnvironment::config(), "Variables"));
27  }
28 
30 
31  boost::scoped_ptr<const eckit::LocalConfiguration> conf_;
32 };
33 // -----------------------------------------------------------------------------
34 
35 // -----------------------------------------------------------------------------
36 BOOST_FIXTURE_TEST_SUITE(test_Variables, VariablesFixture)
37 // -----------------------------------------------------------------------------
38 
40  boost::scoped_ptr<oops::Variables> vars(new oops::Variables(*conf_));
41  BOOST_CHECK(vars.get());
42 
43  vars.reset();
44  BOOST_CHECK(!vars.get());
45 }
46 
47 // -----------------------------------------------------------------------------
48 
50  boost::scoped_ptr<oops::Variables> vars(new oops::Variables(*conf_));
51 
52  boost::scoped_ptr<oops::Variables> other(new oops::Variables(*vars));
53  BOOST_CHECK(other.get());
54 
55  other.reset();
56  BOOST_CHECK(!other.get());
57 
58  BOOST_CHECK(vars.get());
59 }
60 
61 // -----------------------------------------------------------------------------
62 BOOST_AUTO_TEST_SUITE_END()
63 // -----------------------------------------------------------------------------
64 
65 } // namespace test
boost::scoped_ptr< const eckit::LocalConfiguration > conf_
static const eckit::Configuration & config()
void testConstructor()
void testCopyConstructor()
BOOST_AUTO_TEST_CASE(test_GomL95_constructor)