Fix unittest break in Mac due to C++11 incompatibility

Fixes Issue #80

Change-Id: I17bb0706cf99b77fa879f86805017462e5027537
This commit is contained in:
KongQun Yang 2016-02-17 15:50:55 -08:00
parent 890c601dce
commit 0b0a8a721a
1 changed files with 13 additions and 6 deletions

View File

@ -6,6 +6,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "packager/base/macros.h"
#include "packager/media/filters/ec3_audio_util.h" #include "packager/media/filters/ec3_audio_util.h"
namespace edash_packager { namespace edash_packager {
@ -14,18 +15,22 @@ namespace media {
TEST(EC3AudioUtilTest, CalculateEC3ChannelMapTest1) { TEST(EC3AudioUtilTest, CalculateEC3ChannelMapTest1) {
// audio_coding_mode is 7, which is Left, Center, Right, Left surround, Right // audio_coding_mode is 7, which is Left, Center, Right, Left surround, Right
// surround. No dependent substreams. LFE channel on. // surround. No dependent substreams. LFE channel on.
const std::vector<uint8_t> ec3_data = {0, 0, 0, 0x0f, 0}; const uint8_t kEc3Data[] = {0, 0, 0, 0x0f, 0};
uint32_t channel_map; uint32_t channel_map;
EXPECT_TRUE(CalculateEC3ChannelMap(ec3_data, &channel_map)); EXPECT_TRUE(CalculateEC3ChannelMap(
std::vector<uint8_t>(kEc3Data, kEc3Data + arraysize(kEc3Data)),
&channel_map));
EXPECT_EQ(0xF801u, channel_map); EXPECT_EQ(0xF801u, channel_map);
} }
TEST(EC3AudioUtilTest, CalculateEC3ChannelMapTest2) { TEST(EC3AudioUtilTest, CalculateEC3ChannelMapTest2) {
// audio_coding_mode is 2, which is Left and Right. No dependent substreams. // audio_coding_mode is 2, which is Left and Right. No dependent substreams.
// LFE channel off. // LFE channel off.
const std::vector<uint8_t> ec3_data = {0, 0, 0, 0x04, 0}; const uint8_t kEc3Data[] = {0, 0, 0, 0x04, 0};
uint32_t channel_map; uint32_t channel_map;
EXPECT_TRUE(CalculateEC3ChannelMap(ec3_data, &channel_map)); EXPECT_TRUE(CalculateEC3ChannelMap(
std::vector<uint8_t>(kEc3Data, kEc3Data + arraysize(kEc3Data)),
&channel_map));
EXPECT_EQ(0xA000u, channel_map); EXPECT_EQ(0xA000u, channel_map);
} }
@ -33,9 +38,11 @@ TEST(EC3AudioUtilTest, CalculateEC3ChannelMapTest3) {
// audio_coding_mode is 3, which is Left, Center, and Right. Dependent // audio_coding_mode is 3, which is Left, Center, and Right. Dependent
// substreams layout is 0b100000011, which is Left center/ Right center pair, // substreams layout is 0b100000011, which is Left center/ Right center pair,
// Left rear surround/ Right rear surround pair, LFE2 on. LFE channel on. // Left rear surround/ Right rear surround pair, LFE2 on. LFE channel on.
const std::vector<uint8_t> ec3_data = {0, 0, 0, 0x07, 0x07, 0x03}; const uint8_t kEc3Data[] = {0, 0, 0, 0x07, 0x07, 0x03};
uint32_t channel_map; uint32_t channel_map;
EXPECT_TRUE(CalculateEC3ChannelMap(ec3_data, &channel_map)); EXPECT_TRUE(CalculateEC3ChannelMap(
std::vector<uint8_t>(kEc3Data, kEc3Data + arraysize(kEc3Data)),
&channel_map));
EXPECT_EQ(0xE603u, channel_map); EXPECT_EQ(0xE603u, channel_map);
} }