summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-09-25 15:43:15 +0100
committerCarl Hetherington <cth@carlh.net>2013-09-25 15:43:15 +0100
commit43465aa4037cec6d351a842a6624a50685d6c127 (patch)
treec4a7ddc4ee7fd49492588422bb53b2c84760e83c
parentb405b414993458babbb4532ddeeef9928ec7c06e (diff)
Split tests up.
-rw-r--r--src/signer.h5
-rw-r--r--src/xml/kdm_smpte.h3
-rw-r--r--test/certificates_test.cc6
-rw-r--r--test/color_test.cc4
-rw-r--r--test/dcp_test.cc12
-rw-r--r--test/dcp_time_test.cc3
-rw-r--r--test/decryption_test.cc7
-rw-r--r--test/encryption_test.cc13
-rw-r--r--test/error_test.cc10
-rw-r--r--test/kdm_test.cc4
-rw-r--r--test/lut_test.cc1
-rw-r--r--test/read_dcp_test.cc7
-rw-r--r--test/recovery_test.cc7
-rw-r--r--test/subtitle_tests.cc6
-rw-r--r--test/test.cc (renamed from test/tests.cc)52
-rw-r--r--test/test.h22
-rw-r--r--test/utc_offset_to_string_test.cc4
-rw-r--r--test/util_test.cc3
-rw-r--r--test/wscript18
19 files changed, 137 insertions, 50 deletions
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 <boost/filesystem.hpp>
#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 <boost/optional.hpp>
#include <boost/filesystem.hpp>
#include <libxml/parser.h>
+#include <libxml++/libxml++.h>
+#include <libcxml/cxml.h>
+#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 <boost/test/unit_test.hpp>
+#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 <boost/test/unit_test.hpp>
+
+#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 <boost/test/unit_test.hpp>
+#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 <boost/test/unit_test.hpp>
+#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 <boost/test/unit_test.hpp>
#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<const libdcp::ARGBFrame>
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 <boost/test/unit_test.hpp>
#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 <boost/test/unit_test.hpp>
+#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 <boost/test/unit_test.hpp>
#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 <boost/test/unit_test.hpp>
#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 <boost/test/unit_test.hpp>
+#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 <boost/test/unit_test.hpp>
+#include <boost/filesystem.hpp>
#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 <boost/test/unit_test.hpp>
+#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/tests.cc b/test/test.cc
index 5e63d5ed..926eb0fb 100644
--- a/test/tests.cc
+++ b/test/test.cc
@@ -17,34 +17,12 @@
*/
-#include <cmath>
-#include <boost/filesystem.hpp>
-#include <libxml++/libxml++.h>
-#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 <boost/test/unit_test.hpp>
+#include "util.h"
using std::string;
-using std::cout;
-using std::vector;
-using std::list;
-using boost::shared_ptr;
struct TestConfig
{
@@ -56,39 +34,17 @@ struct TestConfig
BOOST_GLOBAL_FIXTURE (TestConfig);
-static string
+string
j2c (int)
{
return "test/data/32x32_red_square.j2c";
}
-static string
+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");
-}
+string test_corpus = "../libdcp-test";
-#include "encryption_test.cc"
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 <cth@carlh.net>
+
+ 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/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 <boost/test/unit_test.hpp>
#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 <fstream>
+#include <boost/test/unit_test.hpp>
+#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 = ''