/** * @file tests/can_net_execute.cpp * @brief CAN Net test periodic executor for node administration * @copyright 2018 Dual Inventive Technology Centre B.V. * */ #include "fixtures/CANTest.hpp" extern "C" { #include "time.c" } TEST_F(DI_CAN, net_execute_discover_state) { SetNodeid(0xdeadbeef); ASSERT_EQ(_ctx.net.discover.state, DI_CAN_NET_DISCOVER_STATE_UNKNOWN); di_can_net_execute(&_ctx); ASSERT_EQ(_ctx.net.discover.state, DI_CAN_NET_DISCOVER_STATE_REQUEST); /* Force discover timeout, execute net subsystem (results in finished state) */ _di_time_uptime = DI_CAN_NET_CFG_DISCOVER_TIMEOUT_MS; di_can_net_execute(&_ctx); ASSERT_EQ(_ctx.net.discover.state, DI_CAN_NET_DISCOVER_STATE_FINISH); }