NerfUS mobile node that manages a target for the Nerf gun firing range

Dependencies:   LedController mbed-rtos mbed NerfUSXbee Servomotor TargetManager

Fork of NerfUS by NerfUS

Revision:
35:7ee45f6d6484
Parent:
34:85994e0501fb
Child:
37:8fc7845ae95b
--- a/TESTS/TargetManagerTest.cpp	Thu Mar 30 14:38:38 2017 -0400
+++ b/TESTS/TargetManagerTest.cpp	Thu Mar 30 15:06:01 2017 -0400
@@ -5,6 +5,8 @@
 #include "mocks/MockTarget.hpp"
 #include "TargetManager.hpp"
 
+#include "stdint.h"
+
 class TargetManagerTest : public ::testing::Test
 {
     public:
@@ -82,3 +84,20 @@
     target_manager.target_missed(0);
 }
 
+TEST_F(TargetManagerTest, WhenReceivingCommandInBytesThenExecuteIt)
+{
+    TargetManager target_manager(targets, mock_nerfus_ticker);
+
+    EXPECT_CALL(mock_target_b, ally_command());
+    EXPECT_CALL(mock_nerfus_ticker, start(0x1234));
+
+    std::vector<uint8_t> target_info_bytes;
+    target_info_bytes.push_back(0x00); //Message from coordinator
+    target_info_bytes.push_back(0x01); //Second target
+    target_info_bytes.push_back(0x00); //Mode ally
+    target_info_bytes.push_back(0x12); //Timeout MSB
+    target_info_bytes.push_back(0x34); //Timeout MSB
+
+    target_manager.execute(target_info_bytes);
+}
+