diff --git a/libraries/AP_JSButton/tests/test_jsbutton.cpp b/libraries/AP_JSButton/tests/test_jsbutton.cpp new file mode 100644 index 0000000000..109db3a04a --- /dev/null +++ b/libraries/AP_JSButton/tests/test_jsbutton.cpp @@ -0,0 +1,16 @@ +#include +#include + +const AP_HAL::HAL& hal = AP_HAL::get_HAL(); + +TEST(JSButtonTest, Test) +{ + JSButton jsbutton; + EXPECT_EQ(jsbutton.function(), JSButton::k_none); + EXPECT_EQ(jsbutton.function(true), JSButton::k_none); + jsbutton.set_default(JSButton::k_shift, JSButton::k_arm_toggle); + EXPECT_EQ(jsbutton.function(), JSButton::k_shift); + EXPECT_EQ(jsbutton.function(true), JSButton::k_arm_toggle); +} + +AP_GTEST_MAIN() diff --git a/libraries/AP_JSButton/tests/wscript b/libraries/AP_JSButton/tests/wscript new file mode 100644 index 0000000000..cd3e5e3ce7 --- /dev/null +++ b/libraries/AP_JSButton/tests/wscript @@ -0,0 +1,7 @@ +#!/usr/bin/env python +# encoding: utf-8 + +def build(bld): + bld.ap_find_tests( + use='ap', + )