Version 0.8.0
[marnav.git] / test / seatalk / Test_seatalk_message.cpp
blob07ef14a5fb69065c666fbd0a49bd5e3b71969cb4
1 #include <gtest/gtest.h>
2 #include <marnav/seatalk/seatalk.hpp>
3 #include <marnav/seatalk/message_00.hpp>
4 #include <marnav/seatalk/message_01.hpp>
6 namespace
9 using namespace marnav;
11 class Test_seatalk_message : public ::testing::Test
15 TEST_F(Test_seatalk_message, message_is_null)
17 std::unique_ptr<seatalk::message> p;
18 auto rc = seatalk::message_cast<seatalk::message_00>(p);
20 EXPECT_EQ(nullptr, rc);
23 TEST_F(Test_seatalk_message, message_wrong_id)
25 std::unique_ptr<seatalk::message> p(new seatalk::message_00);
26 EXPECT_ANY_THROW(seatalk::message_cast<seatalk::message_01>(p));
29 TEST_F(Test_seatalk_message, message_size)
31 EXPECT_TRUE(seatalk::message_size(seatalk::message_id::depth_below_transducer) != 0u);
34 TEST_F(Test_seatalk_message, message_size_invalid_message)
36 EXPECT_ANY_THROW(seatalk::message_size(static_cast<seatalk::message_id>(-1)));