From: Carl Hetherington Date: Wed, 25 Sep 2013 14:43:15 +0000 (+0100) Subject: Split tests up. X-Git-Tag: v0.80~5 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=43465aa4037cec6d351a842a6624a50685d6c127;p=libdcp.git Split tests up. --- diff --git a/src/signer.h b/src/signer.h index 5ae7cf51..efb8099b 100644 --- a/src/signer.h +++ b/src/signer.h @@ -20,6 +20,11 @@ #include #include "certificates.h" +namespace xmlpp { + class Element; + class Node; +} + namespace libdcp { class Signer diff --git a/src/xml/kdm_smpte.h b/src/xml/kdm_smpte.h index e8e65e98..0139876f 100644 --- a/src/xml/kdm_smpte.h +++ b/src/xml/kdm_smpte.h @@ -37,6 +37,9 @@ #include #include #include +#include +#include +#include "../exceptions.h" namespace libdcp { namespace xml { diff --git a/test/certificates_test.cc b/test/certificates_test.cc index ba29549b..0a66bc66 100644 --- a/test/certificates_test.cc +++ b/test/certificates_test.cc @@ -17,6 +17,12 @@ */ +#include +#include "certificates.h" + +using std::list; +using boost::shared_ptr; + BOOST_AUTO_TEST_CASE (certificates) { libdcp::CertificateChain c; diff --git a/test/color_test.cc b/test/color_test.cc index cd66f09b..30a96a0d 100644 --- a/test/color_test.cc +++ b/test/color_test.cc @@ -17,6 +17,10 @@ */ +#include + +#include "util.h" + /* Check that libdcp::Color works */ BOOST_AUTO_TEST_CASE (color) { diff --git a/test/dcp_test.cc b/test/dcp_test.cc index d4207d5a..9d3b8171 100644 --- a/test/dcp_test.cc +++ b/test/dcp_test.cc @@ -17,6 +17,18 @@ */ +#include +#include "dcp.h" +#include "metadata.h" +#include "cpl.h" +#include "picture_asset.h" +#include "sound_asset.h" +#include "reel.h" +#include "test.h" +#include "KM_util.h" + +using boost::shared_ptr; + /* Test creation of a DCP from very simple inputs */ BOOST_AUTO_TEST_CASE (dcp_test) { diff --git a/test/dcp_time_test.cc b/test/dcp_time_test.cc index 35f569cf..d6952f88 100644 --- a/test/dcp_time_test.cc +++ b/test/dcp_time_test.cc @@ -17,6 +17,9 @@ */ +#include +#include "dcp_time.h" + /** Check that libdcp::Time works */ BOOST_AUTO_TEST_CASE (dcp_time) { diff --git a/test/decryption_test.cc b/test/decryption_test.cc index 253efac1..73dc9b97 100644 --- a/test/decryption_test.cc +++ b/test/decryption_test.cc @@ -17,11 +17,18 @@ */ +#include #include "kdm.h" +#include "dcp.h" #include "picture_frame.h" +#include "cpl.h" #include "argb_frame.h" +#include "picture_asset.h" +#include "reel.h" +#include "test.h" using boost::dynamic_pointer_cast; +using boost::shared_ptr; static shared_ptr get_frame (libdcp::DCP const & dcp) diff --git a/test/encryption_test.cc b/test/encryption_test.cc index 60177438..82d5fe27 100644 --- a/test/encryption_test.cc +++ b/test/encryption_test.cc @@ -17,7 +17,20 @@ */ +#include #include "kdm.h" +#include "KM_util.h" +#include "metadata.h" +#include "certificates.h" +#include "dcp.h" +#include "signer.h" +#include "cpl.h" +#include "picture_asset.h" +#include "sound_asset.h" +#include "reel.h" +#include "test.h" + +using boost::shared_ptr; /* Load a certificate chain from build/test/data/ *.pem and then build an encrypted DCP and a KDM using it. diff --git a/test/error_test.cc b/test/error_test.cc index 5477ca5a..6992acff 100644 --- a/test/error_test.cc +++ b/test/error_test.cc @@ -17,6 +17,16 @@ */ +#include +#include "dcp.h" +#include "picture_asset.h" +#include "sound_asset.h" +#include "util.h" +#include "exceptions.h" + +using std::vector; +using std::string; + /* Check that an exception is thrown when trying to create MXFs from non-existant sources */ BOOST_AUTO_TEST_CASE (error_test) { diff --git a/test/kdm_test.cc b/test/kdm_test.cc index d9ba3745..a1ea0ec4 100644 --- a/test/kdm_test.cc +++ b/test/kdm_test.cc @@ -17,9 +17,13 @@ */ +#include #include "kdm.h" #include "xml/kdm_smpte.h" +using std::list; +using boost::shared_ptr; + BOOST_AUTO_TEST_CASE (kdm_test) { libdcp::KDM kdm ( diff --git a/test/lut_test.cc b/test/lut_test.cc index 41d985f7..c90dff76 100644 --- a/test/lut_test.cc +++ b/test/lut_test.cc @@ -17,6 +17,7 @@ */ +#include #include "opendcp_lut.h" #include "opendcp_lut.cc" #include "srgb_linearised_gamma_lut.h" diff --git a/test/read_dcp_test.cc b/test/read_dcp_test.cc index 5e6827d1..0a9ac119 100644 --- a/test/read_dcp_test.cc +++ b/test/read_dcp_test.cc @@ -17,6 +17,13 @@ */ +#include +#include "dcp.h" +#include "cpl.h" + +using std::list; +using boost::shared_ptr; + /* Read DCP that is in git and make sure that basic stuff is read in correctly */ BOOST_AUTO_TEST_CASE (read_dcp) { diff --git a/test/recovery_test.cc b/test/recovery_test.cc index d8ffea6a..43858b10 100644 --- a/test/recovery_test.cc +++ b/test/recovery_test.cc @@ -17,7 +17,14 @@ */ +#include +#include #include "picture_asset_writer.h" +#include "picture_asset.h" +#include "KM_util.h" + +using std::string; +using boost::shared_ptr; /* Check that recovery from a partially-written MXF works */ BOOST_AUTO_TEST_CASE (recovery) diff --git a/test/subtitle_tests.cc b/test/subtitle_tests.cc index 64a3f6bd..a8fa78b7 100644 --- a/test/subtitle_tests.cc +++ b/test/subtitle_tests.cc @@ -17,6 +17,12 @@ */ +#include +#include "subtitle_asset.h" + +using std::list; +using boost::shared_ptr; + /* Load a subtitle asset from XML and check that it is read correctly */ BOOST_AUTO_TEST_CASE (subtitles1) { diff --git a/test/test.cc b/test/test.cc new file mode 100644 index 00000000..926eb0fb --- /dev/null +++ b/test/test.cc @@ -0,0 +1,50 @@ +/* + Copyright (C) 2012 Carl Hetherington + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE libdcp_test +#include +#include "util.h" + +using std::string; + +struct TestConfig +{ + TestConfig() + { + libdcp::init (); + } +}; + +BOOST_GLOBAL_FIXTURE (TestConfig); + +string +j2c (int) +{ + return "test/data/32x32_red_square.j2c"; +} + +string +wav (libdcp::Channel) +{ + return "test/data/1s_24-bit_48k_silence.wav"; +} + +string test_corpus = "../libdcp-test"; + diff --git a/test/test.h b/test/test.h new file mode 100644 index 00000000..de790364 --- /dev/null +++ b/test/test.h @@ -0,0 +1,22 @@ +/* + Copyright (C) 2012-2013 Carl Hetherington + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +extern std::string j2c (int); +extern std::string wav (libdcp::Channel); +extern std::string test_corpus; diff --git a/test/tests.cc b/test/tests.cc deleted file mode 100644 index 5e63d5ed..00000000 --- a/test/tests.cc +++ /dev/null @@ -1,94 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include -#include -#include -#include "KM_prng.h" -#include "dcp.h" -#include "util.h" -#include "metadata.h" -#include "types.h" -#include "exceptions.h" -#include "subtitle_asset.h" -#include "picture_asset.h" -#include "sound_asset.h" -#include "reel.h" -#include "certificates.h" -#include "signer_chain.h" -#include "gamma_lut.h" -#include "cpl.h" -#include "signer.h" - -#define BOOST_TEST_DYN_LINK -#define BOOST_TEST_MODULE libdcp_test -#include - -using std::string; -using std::cout; -using std::vector; -using std::list; -using boost::shared_ptr; - -struct TestConfig -{ - TestConfig() - { - libdcp::init (); - } -}; - -BOOST_GLOBAL_FIXTURE (TestConfig); - -static string -j2c (int) -{ - return "test/data/32x32_red_square.j2c"; -} - -static string -wav (libdcp::Channel) -{ - return "test/data/1s_24-bit_48k_silence.wav"; -} - -static string test_corpus = "../libdcp-test"; - -#include "utc_offset_to_string_test.cc" -#include "lut_test.cc" -#include "util_test.cc" -#include "decryption_test.cc" -#include "kdm_test.cc" -#include "dcp_test.cc" -#include "error_test.cc" -#include "read_dcp_test.cc" -#include "subtitle_tests.cc" -#include "dcp_time_test.cc" -#include "color_test.cc" -#include "recovery_test.cc" -#include "certificates_test.cc" - -BOOST_AUTO_TEST_CASE (signer_chain) -{ - boost::filesystem::remove_all ("build/test/signer"); - boost::filesystem::create_directory ("build/test/signer"); - libdcp::make_signer_chain ("build/test/signer"); -} - -#include "encryption_test.cc" diff --git a/test/utc_offset_to_string_test.cc b/test/utc_offset_to_string_test.cc index ad1d1249..af9c6533 100644 --- a/test/utc_offset_to_string_test.cc +++ b/test/utc_offset_to_string_test.cc @@ -17,9 +17,11 @@ */ +#include #include "metadata.h" +#include "util.h" -/** Test XMLMetadata::utc_offset_to_string */ +/** Test libdcp::utc_offset_to_string */ BOOST_AUTO_TEST_CASE (utc_offset_to_string_test) { BOOST_CHECK_EQUAL (libdcp::utc_offset_to_string (30), "+00:30"); diff --git a/test/util_test.cc b/test/util_test.cc index fa873c75..2ed5e46a 100644 --- a/test/util_test.cc +++ b/test/util_test.cc @@ -18,8 +18,11 @@ */ #include +#include +#include "util.h" using std::ifstream; +using std::string; BOOST_AUTO_TEST_CASE (bsae64_decode_test) { diff --git a/test/wscript b/test/wscript index 2892bf9e..ec70288b 100644 --- a/test/wscript +++ b/test/wscript @@ -20,7 +20,23 @@ def build(bld): obj.name = 'tests' obj.uselib = 'BOOST_TEST OPENJPEG CXML XMLSEC1' obj.use = 'libdcp' - obj.source = 'tests.cc' + obj.source = """ + test.cc + certificates_test.cc + dcp_test.cc + encryption_test.cc + lut_test.cc + read_dcp_test.cc + color_test.cc + dcp_time_test.cc + error_test.cc + recovery_test.cc + utc_offset_to_string_test.cc + decryption_test.cc + kdm_test.cc + subtitle_tests.cc + util_test.cc + """ obj.target = 'tests' obj.install_path = ''