2
* Copyright (C) 2015 Canonical, Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3, as published
6
* by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License along
14
* with this program. If not, see <http://www.gnu.org/licenses/>.
18
#include <gtest/gtest.h>
20
#include <w11t/wfddeviceinfo.h>
22
TEST(WfdDeviceInfo, FromStringWithValidInput) {
23
auto info = w11t::WfdDeviceInfo::Parse("0x00111c440032");
24
EXPECT_TRUE(info.IsSupported());
25
EXPECT_TRUE(info.IsSupportedSink());
26
EXPECT_EQ(info.ctrl_port_, 7236);
27
EXPECT_EQ(info.max_tput_, 50);
30
TEST(WfdDeviceInfo, FromStringWithInvalidInput) {
31
auto info = w11t::WfdDeviceInfo::Parse("0xa1231sdas12312131232134235243rasasdsa");
32
EXPECT_TRUE(!info.IsSupported());
33
EXPECT_TRUE(!info.IsSupportedSink());
34
EXPECT_EQ(info.ctrl_port_, 0);
35
EXPECT_EQ(info.max_tput_, 0);
37
EXPECT_THROW(w11t::WfdDeviceInfo::Parse("0xabcdefghijkl"), std::invalid_argument);