blob: 1e120616496bb52dc0133ff6f72043da2e0352fa [file] [log] [blame]
Brian Silverman7c33ab22018-08-04 17:14:51 -07001//==============================================================================
2// Copyright 2014 LRI UMR 8623 CNRS/Univ Paris Sud XI
3// Copyright 2014 NumScale SAS
4//
5// Distributed under the Boost Software License, Version 1.0.
6// See accompanying file LICENSE.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt
8//==============================================================================
9#include <boost/numeric/odeint.hpp>
10#include <nt2/table.hpp>
11#include <nt2/include/functions/zeros.hpp>
12#include <nt2/include/functions/ones.hpp>
13
14#include <boost/config.hpp>
15#ifdef BOOST_MSVC
16 #pragma warning(disable:4996)
17#endif
18
19#define BOOST_TEST_MODULE odeint_nt2_copy
20
21#include <boost/test/included/unit_test.hpp>
22#include <boost/test/floating_point_comparison.hpp>
23#include <boost/numeric/odeint/external/nt2/nt2_norm_inf.hpp>
24
25#include <boost/mpl/list.hpp>
26
27using namespace boost::unit_test;
28using namespace boost::numeric::odeint;
29
30typedef boost::mpl::list< float , double > fp_types;
31
32BOOST_AUTO_TEST_SUITE( nt2_norm_inf )
33
34BOOST_AUTO_TEST_CASE_TEMPLATE( test_norm_inf, T, fp_types )
35{
36 nt2::table<T> x = nt2::ones(10,1, nt2::meta::as_<T>() );
37 x(4) = 55;
38
39 nt2::table<T> y = nt2::zeros(8,8, nt2::meta::as_<T>() );
40 y(6,4) = -42;
41
42 BOOST_CHECK_SMALL(vector_space_norm_inf<nt2::table<T> >()(x) - T(55), T(1e-10));
43 BOOST_CHECK_SMALL(vector_space_norm_inf<nt2::table<T> >()(y) - T(42), T(1e-10));
44}
45
46BOOST_AUTO_TEST_SUITE_END()