Tweaks to test setup; don't always compute coverage.
authorCarl Hetherington <cth@carlh.net>
Sat, 3 Jan 2015 22:31:56 +0000 (22:31 +0000)
committerCarl Hetherington <cth@carlh.net>
Sat, 3 Jan 2015 22:31:56 +0000 (22:31 +0000)
run/coverage [new file with mode: 0644]
run/tests
src/image.h
src/rgb_xyz.cc
test/image_test.cc
test/rgb_xyz_test.cc
test/test.cc
test/test.h

diff --git a/run/coverage b/run/coverage
new file mode 100644 (file)
index 0000000..db69a86
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+# Calculate coverage
+cd build
+gcovr --root=$(pwd) --keep
+lcov --capture --directory $(pwd) --base-directory $(pwd) --output-file test/coverage.info
+lcov --remove test/coverage.info "/usr*" -o test/coverage.info
+genhtml test/coverage.info --output-directory test/coverage
index e1beb731ea3e5c79abcc55475d7e991d07df572a..4fe7a3d05ef06678aee3b57763d4e04411de6047 100755 (executable)
--- a/run/tests
+++ b/run/tests
@@ -97,11 +97,4 @@ fi
 # and check that they are right
 $dcpinfo -s $private/JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV >> $work/jah.log
 
-# Calculate coverage
-cd build
-gcovr --root=$(pwd) --keep
-lcov --capture --directory $(pwd) --base-directory $(pwd) --output-file test/coverage.info
-lcov --remove test/coverage.info "/usr*" -o test/coverage.info
-genhtml test/coverage.info --output-directory test/coverage
-
 echo "PASS"
index abc040d4b048b1e10dccba7080c2cdd0766dbc1f..9e85101ac5338cc67c99d58ef950de11f7ed91b5 100644 (file)
@@ -29,7 +29,7 @@ public:
        Image (boost::shared_ptr<const Image>);
        
        virtual ~Image () {}
-       virtual uint16_t * const * data () const = 0;
+       virtual uint8_t * const * data () const = 0;
        /** @return array of strides in bytes */
        virtual int const * stride () const = 0;
 
index faddf013a2b4c9ac02c827daaf0b2c6d8e3d0225..a3f7b424d49e7c5a7300581c8a646733febc8fd3 100644 (file)
@@ -203,7 +203,7 @@ dcp::rgb_to_xyz (
 
        int jn = 0;
        for (int y = 0; y < rgb->size().height; ++y) {
-               uint16_t* p = rgb->data()[0] + y * rgb->stride()[0] / 2;
+               uint16_t* p = reinterpret_cast<uint16_t*> (rgb->data()[0] + y * rgb->stride()[0]);
                for (int x = 0; x < rgb->size().width; ++x) {
 
                        /* In gamma LUT (converting 16-bit to 12-bit) */
@@ -248,7 +248,7 @@ dcp::xyz_to_xyz (shared_ptr<const Image> xyz_16)
 
        int jn = 0;
        for (int y = 0; y < xyz_16->size().height; ++y) {
-               uint16_t* p = xyz_16->data()[0] + y * xyz_16->stride()[0] / 2;
+               uint16_t* p = reinterpret_cast<uint16_t*> (xyz_16->data()[0] + y * xyz_16->stride()[0]);
                for (int x = 0; x < xyz_16->size().width; ++x) {
                        /* Truncate 16-bit to 12-bit */
                        xyz_12->data(0)[jn] = *p++ >> 4;
index 6b024c1a692001d04e6cf2a965c27308c5a769b7..216c3c5c406c5f7909171c2c0527a19f1155e7e4 100644 (file)
@@ -44,7 +44,7 @@ public:
 
        }
 
-       uint16_t * const * data () const {
+       uint8_t * const * data () const {
                return 0;
        }
 
index b33a0f4ac30106adb3b73a1d96b2c31cc10303de..2927bd9afa50f205342c20a407e6df89af986f63 100644 (file)
@@ -34,7 +34,7 @@ public:
        {
                /* 48bpp */
                _stride[0] = _size.width * 6;
-               _data[0] = new uint16_t[size.height * stride()[0] / 2];
+               _data[0] = new uint8_t[size.height * stride()[0]];
        }
 
        ~SimpleImage ()
@@ -42,7 +42,7 @@ public:
                delete[] _data[0];
        }
 
-       uint16_t * const * data () const {
+       uint8_t * const * data () const {
                return _data;
        }
 
@@ -51,7 +51,7 @@ public:
        }
 
 private:
-       uint16_t* _data[1];
+       uint8_t* _data[1];
        int _stride[1];
 };
 
@@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE (rgb_xyz_test)
 
        shared_ptr<const dcp::Image> rgb (new SimpleImage (size));
        for (int y = 0; y < size.height; ++y) {
-               uint16_t* p = rgb->data()[0] + y * rgb->stride()[0] / 2;
+               uint16_t* p = reinterpret_cast<uint16_t*> (rgb->data()[0] + y * rgb->stride()[0]);
                for (int x = 0; x < size.width; ++x) {
                        /* Write a 12-bit random number for each component */
                        for (int c = 0; c < 3; ++c) {
@@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE (rgb_xyz_test)
        shared_ptr<dcp::XYZFrame> xyz = dcp::rgb_to_xyz (rgb, dcp::ColourConversion::srgb_to_xyz);
 
        for (int y = 0; y < size.height; ++y) {
-               uint16_t* p = rgb->data()[0] + y * rgb->stride()[0] / 2;
+               uint16_t* p = reinterpret_cast<uint16_t*> (rgb->data()[0] + y * rgb->stride()[0]);
                for (int x = 0; x < size.width; ++x) {
 
                        double cr = *p++ / 65535.0;
index 995a5b23db488e67935d12c9113589cf4bf5d54c..dee78bfd00f45ddf9f711937b92937b15924b10d 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2015 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
@@ -25,7 +25,7 @@
 
 using std::string;
 
-string private_test;
+boost::filesystem::path private_test;
 
 struct TestConfig
 {
@@ -39,17 +39,3 @@ struct TestConfig
 };
 
 BOOST_GLOBAL_FIXTURE (TestConfig);
-
-boost::filesystem::path
-j2c (int)
-{
-       return "test/data/32x32_red_square.j2c";
-}
-
-boost::filesystem::path
-wav (dcp::Channel)
-{
-       return "test/data/1s_24-bit_48k_silence.wav";
-}
-
-
index f139fa283313ff14935fe355c07d3301d03313ad..c5ae5268fb90b30a0d0113684abdc45f25f1d462 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2015 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
@@ -17,4 +17,4 @@
 
 */
 
-extern std::string private_test;
+extern boost::filesystem::path private_test;