blob: f7eedf9c12ffc9ce612fdb54c3313626d77e085f [file] [log] [blame]
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cast/streaming/message_fields.h"
#include <array>
#include <cstring>
#include <vector>
#include "gtest/gtest.h"
namespace openscreen {
namespace cast {
namespace {
// NOTE: We don't do an exhaustive check of all values here, to avoid
// unnecessary duplication, but want to ensure that lookup is working properly.
TEST(MessageFieldsTest, CanParseEnumToString) {
EXPECT_STREQ("aac", CodecToString(AudioCodec::kAac));
EXPECT_STREQ("vp8", CodecToString(VideoCodec::kVp8));
}
TEST(MessageFieldsTest, CanStringToEnum) {
EXPECT_EQ(AudioCodec::kOpus, StringToAudioCodec("opus"));
EXPECT_EQ(VideoCodec::kHevc, StringToVideoCodec("hevc"));
}
TEST(MessageFieldsTest, Identity) {
EXPECT_STREQ("opus", CodecToString(StringToAudioCodec("opus")));
EXPECT_STREQ("vp8", CodecToString(StringToVideoCodec("vp8")));
}
} // namespace
} // namespace cast
} // namespace openscreen