Build: update docker build scripts
[marnav.git] / test / seatalk / Test_seatalk_message_26.cpp
blobfdd556907e3789d82e63c1224a92a8ffa519faca
1 #include <gtest/gtest.h>
2 #include <marnav/seatalk/message_26.hpp>
4 namespace
7 using namespace marnav;
9 class Test_seatalk_message_26 : public ::testing::Test
13 TEST_F(Test_seatalk_message_26, construction)
15 seatalk::message_26 m;
18 TEST_F(Test_seatalk_message_26, parse_invalid_data_size)
20 EXPECT_ANY_THROW(seatalk::message_26::parse({6, 0x00}));
21 EXPECT_ANY_THROW(seatalk::message_26::parse({8, 0x00}));
24 TEST_F(Test_seatalk_message_26, parse_invalid_length)
26 EXPECT_ANY_THROW(seatalk::message_26::parse({0x26, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}));
27 EXPECT_ANY_THROW(seatalk::message_26::parse({0x26, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00}));
30 TEST_F(Test_seatalk_message_26, parse)
32 struct test_case {
33 seatalk::raw data;
36 std::vector<test_case> cases{
37 {{0x26, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00}},
40 for (auto const & t : cases) {
41 auto generic_message = seatalk::message_26::parse(t.data);
42 EXPECT_TRUE(generic_message != nullptr);
43 if (!generic_message)
44 continue;
45 auto m = seatalk::message_cast<seatalk::message_26>(generic_message);
46 EXPECT_TRUE(m != nullptr);
47 if (!m)
48 continue;
49 EXPECT_EQ(seatalk::message_id::speed_through_water_2, m->type());