Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions test/guidance_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#include <gtest/gtest.h>

#include "helpers/control_function_helpers.hpp"
#include "helpers/test_fixture.hpp"
#include "isobus/hardware_integration/can_hardware_interface.hpp"
#include "isobus/hardware_integration/virtual_can_plugin.hpp"
#include "isobus/isobus/can_network_manager.hpp"
#include "isobus/isobus/isobus_guidance_interface.hpp"
#include "isobus/utility/processing_flags.hpp"
#include "isobus/utility/system_timing.hpp"

#include "helpers/control_function_helpers.hpp"
#include "helpers/test_fixture.hpp"

#include <cmath>
#include <vector>

using namespace isobus;

Expand Down Expand Up @@ -80,7 +81,30 @@ TEST_F(GuidanceTest, GuidanceMessages)
{
testPlugin.read_frame(testFrame);
}

ASSERT_TRUE(testPlugin.get_queue_empty());
// Exercise ProcessingFlags across a byte boundary.
// Flag 8 is both the maximum allowed flag and the first flag
// stored in the second byte.
{
std::vector<std::uint32_t> processedFlags;

ProcessingFlags processingFlags(
8,
[](std::uint32_t flag, void *parent) {
auto *flags = static_cast<std::vector<std::uint32_t> *>(parent);
flags->push_back(flag);
},
&processedFlags);

processingFlags.set_flag(7);
processingFlags.set_flag(8);
processingFlags.process_all_flags();

ASSERT_EQ(2, processedFlags.size());
EXPECT_EQ(7, processedFlags.at(0));
EXPECT_EQ(8, processedFlags.at(1));
}

{
TestGuidanceInterface interfaceUnderTest(testECU, nullptr); // Configured for broadcasts, but no message is configured periodically
Expand Down
Loading