tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

TestOpusParser.cpp (1001B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #include <algorithm>
      8 
      9 #include "OpusParser.h"
     10 #include "gtest/gtest.h"
     11 
     12 using namespace mozilla;
     13 
     14 TEST(OpusParser, Mapping2)
     15 {
     16  uint8_t validChannels[] = {1,   3,   4,   6,   9,   11,  16,  18,  25,  27,
     17                             36,  38,  49,  51,  64,  66,  81,  83,  100, 102,
     18                             121, 123, 144, 146, 169, 171, 196, 198, 225, 227};
     19  for (uint8_t channels = 0; channels < 255; channels++) {
     20    bool found = OpusParser::IsValidMapping2ChannelsCount(channels);
     21    bool foundTable =
     22        std::find(std::begin(validChannels), std::end(validChannels),
     23                  channels) != std::end(validChannels);
     24    EXPECT_EQ(found, foundTable);
     25  }
     26 }