Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
MultimediaBoard.cc File Reference

Unit test for MultimediaBoard driver class. More...

Include dependency graph for MultimediaBoard.cc:

Classes

class  MultimediaBoardTests
 Unit Test Class for the MultimediaBoard. More...

Functions

 TEST_F (MultimediaBoardTests, DoesNotLeak)
 Test for memory leaks.
 TEST_F (MultimediaBoardTests, Leaks)
 This should fail when the –check_for_leaks command line flag is specified.
 TEST_F (MultimediaBoardTests, ConstructorInitializesCorrectly)
 Test that the constructor initializes the lighting state and RGB values correctly.
 TEST_F (MultimediaBoardTests, SendLightingStateSetsStateCorrectly)
 Test that the lighting state is set correctly.
 TEST_F (MultimediaBoardTests, SendRGBSetsRGBValuesCorrectly)
 Test that the RGB values are set correctly.

Detailed Description

Unit test for MultimediaBoard driver class.

Author
Targed (ltkli.nosp@m.onel.nosp@m.@gmai.nosp@m.l.co.nosp@m.m)
Date
2024-10-26

Function Documentation

◆ TEST_F() [1/5]

TEST_F ( MultimediaBoardTests ,
DoesNotLeak  )

Test for memory leaks.

Author
Targed (ltkli.nosp@m.onel.nosp@m.@gmai.nosp@m.l.co.nosp@m.m)
Date
2024-10-26
79{
80 MultimediaBoard* pTestBoard = new MultimediaBoard();
81 ASSERT_NE(pTestBoard, nullptr);
82 delete pTestBoard;
83 pTestBoard = nullptr;
84}
This class handles communication with the multimedia board on the rover by sending RoveComm packets o...
Definition MultimediaBoard.h:23

◆ TEST_F() [2/5]

TEST_F ( MultimediaBoardTests ,
Leaks  )

This should fail when the –check_for_leaks command line flag is specified.

Author
Targed (ltkli.nosp@m.onel.nosp@m.@gmai.nosp@m.l.co.nosp@m.m)
Date
2024-10-26
94{
95 MultimediaBoard* pTestBoard = new MultimediaBoard();
96 EXPECT_NE(pTestBoard, nullptr);
97 // Intentionally not deleting to test leak detection
98}

◆ TEST_F() [3/5]

TEST_F ( MultimediaBoardTests ,
ConstructorInitializesCorrectly  )

Test that the constructor initializes the lighting state and RGB values correctly.

Author
Targed (ltkli.nosp@m.onel.nosp@m.@gmai.nosp@m.l.co.nosp@m.m)
Date
2024-10-26
108{
109 EXPECT_EQ(m_pMultimediaBoard->GetCurrentLightingState(), MultimediaBoard::MultimediaBoardLightingState::eOff);
110
111 MultimediaBoard::RGB stDefaultRGB;
112 EXPECT_EQ(m_pMultimediaBoard->GetCustomLightingValues().dRed, stDefaultRGB.dRed);
113 EXPECT_EQ(m_pMultimediaBoard->GetCustomLightingValues().dGreen, stDefaultRGB.dGreen);
114 EXPECT_EQ(m_pMultimediaBoard->GetCustomLightingValues().dBlue, stDefaultRGB.dBlue);
115}
This struct serves as a container for RGB values, and provides a few overridden constructors for conv...
Definition MultimediaBoard.h:39

◆ TEST_F() [4/5]

TEST_F ( MultimediaBoardTests ,
SendLightingStateSetsStateCorrectly  )

Test that the lighting state is set correctly.

Author
Targed (ltkli.nosp@m.onel.nosp@m.@gmai.nosp@m.l.co.nosp@m.m)
Date
2024-10-26
125{
126 m_pMultimediaBoard->SendLightingState(MultimediaBoard::MultimediaBoardLightingState::eTeleOp);
127 EXPECT_EQ(m_pMultimediaBoard->GetCurrentLightingState(), MultimediaBoard::MultimediaBoardLightingState::eTeleOp);
128
129 m_pMultimediaBoard->SendLightingState(MultimediaBoard::MultimediaBoardLightingState::eAutonomy);
130 EXPECT_EQ(m_pMultimediaBoard->GetCurrentLightingState(), MultimediaBoard::MultimediaBoardLightingState::eAutonomy);
131
132 m_pMultimediaBoard->SendLightingState(MultimediaBoard::MultimediaBoardLightingState::eReachedGoal);
133 EXPECT_EQ(m_pMultimediaBoard->GetCurrentLightingState(), MultimediaBoard::MultimediaBoardLightingState::eReachedGoal);
134}

◆ TEST_F() [5/5]

TEST_F ( MultimediaBoardTests ,
SendRGBSetsRGBValuesCorrectly  )

Test that the RGB values are set correctly.

Author
Targed (ltkli.nosp@m.onel.nosp@m.@gmai.nosp@m.l.co.nosp@m.m)
Date
2024-10-26
144{
145 MultimediaBoard::RGB stCurrentRGBValues(255, 128, 64);
146 m_pMultimediaBoard->SendRGB(stCurrentRGBValues);
147
148 MultimediaBoard::RGB stRGBValues = m_pMultimediaBoard->GetCustomLightingValues();
149 EXPECT_EQ(stRGBValues.dRed, stCurrentRGBValues.dRed);
150 EXPECT_EQ(stRGBValues.dGreen, stCurrentRGBValues.dGreen);
151 EXPECT_EQ(stRGBValues.dBlue, stCurrentRGBValues.dBlue);
152}