Still more licence fixups.
[libdcp.git] / test / gamma_transfer_function_test.cc
1 /*
2     Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
3
4     This file is part of libdcp.
5
6     libdcp is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     libdcp is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with libdcp.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "gamma_transfer_function.h"
21 #include "modified_gamma_transfer_function.h"
22 #include <boost/test/unit_test.hpp>
23
24 using boost::shared_ptr;
25
26 /** Check GammaTransferFunction::about_equal */
27 BOOST_AUTO_TEST_CASE (gamma_transfer_function_test)
28 {
29         shared_ptr<dcp::GammaTransferFunction> a (new dcp::GammaTransferFunction (1.2));
30         shared_ptr<dcp::GammaTransferFunction> b (new dcp::GammaTransferFunction (1.2));
31         BOOST_CHECK (a->about_equal (b, 1e-6));
32
33         a.reset (new dcp::GammaTransferFunction (1.2));
34         a.reset (new dcp::GammaTransferFunction (1.3));
35         BOOST_CHECK (a->about_equal (b, 0.2));
36         BOOST_CHECK (!a->about_equal (b, 0.05));
37
38         shared_ptr<dcp::ModifiedGammaTransferFunction> c (new dcp::ModifiedGammaTransferFunction (2.4, 0.05, 1, 2));
39         BOOST_CHECK (!a->about_equal (c, 1));
40 }