Skip to content

Commit 2391b21

Browse files
jhwang04rdenno
andauthored
Buzzer tests (#12)
* Added unit tests for buzzer and vsm (incomplete) * Removed VSM tests --------- Co-authored-by: Rhys Denno <rdenno3@gatech.edu>
1 parent 222171e commit 2391b21

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

test/test_systems/test_buzzer.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include "gtest/gtest.h"
2+
#include "BuzzerController.h"
3+
4+
BuzzerController &buzzer = BuzzerController::getInstance();
5+
int base = 2500; // arbitrary number greater than 2000
6+
7+
TEST (BuzzerControllerTesting, initial_state) {
8+
ASSERT_EQ(buzzer.buzzer_is_active(base), false);
9+
}
10+
11+
TEST (BuzzerControllerTesting, activate_buzzer) {
12+
buzzer.activate(base);
13+
ASSERT_EQ(buzzer.buzzer_is_active(base+10), true);
14+
ASSERT_EQ(buzzer.buzzer_is_active(base+2010), false);
15+
}
16+
17+
TEST (BuzzerControllerTesting, interrupt_buzzer) {
18+
buzzer.activate(base);
19+
ASSERT_EQ(buzzer.buzzer_is_active(base+10), true);
20+
buzzer.deactivate();
21+
ASSERT_EQ(buzzer.buzzer_is_active(base+20), false);
22+
}

test/test_systems/test_systems.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <gmock/gmock.h>
33
#include "test_scheduler.h"
44
#include "test_tcmux.h"
5+
#include "test_buzzer.h"
56
#include "test_watchdog.h"
67

78
int main(int argc, char **argv)

0 commit comments

Comments
 (0)