Add some context markers to a test.
[dcpomatic.git] / test / torture_test.cc
index 10d343268c12520084e779627c93dd534128fe8b..979e1beb84c917cd20e3f71f464d0fb9c5bd9bc0 100644 (file)
@@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE (torture_test1)
        film->set_container (Ratio::from_id ("185"));
        film->set_sequence (false);
 
-       /* Staircase at an offset of 2000 samples, trimmed both start and end, with a gain of 6dB */
+       /* Staircase at an offset of 2000 samples, trimmed both start and end, with a gain of exactly 2 (linear) */
        shared_ptr<Content> staircase = content_factory("test/data/staircase.wav").front ();
        film->examine_and_add_content (staircase);
        BOOST_REQUIRE (!wait_for_jobs());
@@ -65,7 +65,7 @@ BOOST_AUTO_TEST_CASE (torture_test1)
        staircase->set_trim_end (ContentTime::from_frames (35, 48000));
        staircase->audio->set_gain (20 * log10(2));
 
-       /* And again at an offset of 50000 samples, trimmed both start and end, with a gain of 6dB */
+       /* And again at an offset of 50000 samples, trimmed both start and end, with a gain of exactly 2 (linear) */
        staircase = content_factory("test/data/staircase.wav").front ();
        film->examine_and_add_content (staircase);
        BOOST_REQUIRE (!wait_for_jobs());
@@ -118,49 +118,57 @@ BOOST_AUTO_TEST_CASE (torture_test1)
 
        int stair = 12;
 
-       fr = sound_reader->get_frame (1);
-       for (int i = 0; i < fr->samples(); ++i) {
-               for (int j = 0; j < 6; ++j) {
-                       if (j == 2) {
-                               BOOST_CHECK_EQUAL ((fr->get(j, i) + 128) >> 8, stair * 2);
-                               ++stair;
-                       } else {
-                               BOOST_CHECK_EQUAL (fr->get(j, i), 0);
+       BOOST_TEST_CONTEXT("First staircase, frame #1") {
+               fr = sound_reader->get_frame (1);
+               for (int i = 0; i < fr->samples(); ++i) {
+                       for (int j = 0; j < 6; ++j) {
+                               if (j == 2) {
+                                       BOOST_CHECK_EQUAL ((fr->get(j, i) + 128) >> 8, stair * 2);
+                                       ++stair;
+                               } else {
+                                       BOOST_CHECK_EQUAL (fr->get(j, i), 0);
+                               }
                        }
                }
        }
 
-       fr = sound_reader->get_frame (2);
-       for (int i = 0; i < fr->samples(); ++i) {
-               for (int j = 0; j < 6; ++j) {
-                       if (j == 2) {
-                               BOOST_CHECK_EQUAL ((fr->get(j, i) + 128) >> 8, stair * 2);
-                               ++stair;
-                       } else {
-                               BOOST_CHECK_EQUAL (fr->get(j, i), 0);
+       BOOST_TEST_CONTEXT("First staircase, frame #2") {
+               fr = sound_reader->get_frame (2);
+               for (int i = 0; i < fr->samples(); ++i) {
+                       for (int j = 0; j < 6; ++j) {
+                               if (j == 2) {
+                                       BOOST_CHECK_EQUAL ((fr->get(j, i) + 128) >> 8, stair * 2);
+                                       ++stair;
+                               } else {
+                                       BOOST_CHECK_EQUAL (fr->get(j, i), 0);
+                               }
                        }
                }
        }
 
-       fr = sound_reader->get_frame (3);
-       for (int i = 0; i < fr->samples(); ++i) {
-               for (int j = 0; j < 6; ++j) {
-                       if (j == 2 && i < (4753 - (2000 * 2))) {
-                               BOOST_CHECK_EQUAL ((fr->get(j, i) + 128) >> 8, stair * 2);
-                               ++stair;
-                       } else {
-                               BOOST_CHECK_EQUAL (fr->get(j, i), 0);
+       BOOST_TEST_CONTEXT("First staircase, frame #3") {
+               fr = sound_reader->get_frame (3);
+               for (int i = 0; i < fr->samples(); ++i) {
+                       for (int j = 0; j < 6; ++j) {
+                               if (j == 2 && i < (4753 - (2000 * 2))) {
+                                       BOOST_CHECK_EQUAL ((fr->get(j, i) + 128) >> 8, stair * 2);
+                                       ++stair;
+                               } else {
+                                       BOOST_CHECK_EQUAL (fr->get(j, i), 0);
+                               }
                        }
                }
        }
 
        /* Then some silence */
 
-       for (int i = 4; i < 24; ++i) {
-               fr = sound_reader->get_frame (i);
-               for (int j = 0; j < fr->samples(); ++j) {
-                       for (int k = 0; k < 6; ++k) {
-                               BOOST_CHECK_EQUAL (fr->get(k, j), 0);
+       BOOST_TEST_CONTEXT("Silence") {
+               for (int i = 4; i < 24; ++i) {
+                       fr = sound_reader->get_frame (i);
+                       for (int j = 0; j < fr->samples(); ++j) {
+                               for (int k = 0; k < 6; ++k) {
+                                       BOOST_CHECK_EQUAL (fr->get(k, j), 0);
+                               }
                        }
                }
        }