1 #include <gtest/gtest.h>
2 #include <marnav/seatalk/message_87.hpp>
6 using namespace marnav::seatalk
;
8 class Test_seatalk_message_87
: public ::testing::Test
13 message_87::response_level level
;
16 const std::vector
<test_case
> cases
{
17 {{0x86, 0x00, 0x00}, message_87::response_level::invalid
},
18 {{0x86, 0x00, 0x01}, message_87::response_level::automatic
},
19 {{0x86, 0x00, 0x02}, message_87::response_level::minimum
},
23 TEST_F(Test_seatalk_message_87
, construction
)
25 EXPECT_NO_THROW(message_87 m
);
28 TEST_F(Test_seatalk_message_87
, parse_invalid_data_size
)
30 EXPECT_ANY_THROW(message_87::parse({1, 0x00}));
33 TEST_F(Test_seatalk_message_87
, parse_invalid_length
)
35 EXPECT_ANY_THROW(message_87::parse({0x87, 0x01, 0x00}));
38 TEST_F(Test_seatalk_message_87
, parse
)
40 for (auto const & t
: cases
) {
41 auto generic_message
= message_87::parse(t
.data
);
42 EXPECT_TRUE(generic_message
!= nullptr);
45 auto m
= message_cast
<message_87
>(generic_message
);
46 EXPECT_TRUE(m
!= nullptr);
49 EXPECT_EQ(t
.level
, m
->get_level());
53 TEST_F(Test_seatalk_message_87
, write_default
)
55 const raw expected
{0x87, 0x00, 0x01};
58 EXPECT_EQ(expected
, m
.get_data());