From 898846f1f421ae26f3b1b4291f7be451ad3bb43d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Mangano?= Date: Wed, 2 Mar 2016 15:15:40 +0100 Subject: [PATCH] ogg: test up to tags decoding and it works! --- tests/ogg_test.cc | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/tests/ogg_test.cc b/tests/ogg_test.cc index 5b24167..1e399eb 100644 --- a/tests/ogg_test.cc +++ b/tests/ogg_test.cc @@ -5,21 +5,19 @@ using namespace opustags; -SCENARIO("decoding a single-stream file", "[ogg]") +TEST_CASE("decoding a single-stream file", "[ogg]") { + std::ifstream src("../tests/samples/mystery.ogg"); + ogg::Decoder dec(src); - GIVEN("an ogg::Decoder") { - std::ifstream src("../tests/samples/mystery.ogg"); - ogg::Decoder dec(src); - - WHEN("reading the first page") { - std::shared_ptr s = dec.read_page(); - THEN("the Opus header is ready") { - REQUIRE(s != nullptr); - REQUIRE(s->state == ogg::HEADER_READY); - REQUIRE(s->type == ogg::OPUS_STREAM); - } - } - } + std::shared_ptr s = dec.read_page(); + REQUIRE(s != nullptr); + REQUIRE(s->state == ogg::HEADER_READY); + REQUIRE(s->type == ogg::OPUS_STREAM); + std::shared_ptr s2 = dec.read_page(); + REQUIRE(s2 == s); + REQUIRE(s->state == ogg::TAGS_READY); + REQUIRE(s->type == ogg::OPUS_STREAM); + REQUIRE(s->tags.get("encoder") == "Lavc57.24.102 libopus"); }