AP_JSButton: add unittest

This commit is contained in:
Pierre Kancir 2023-05-24 18:08:36 +02:00 committed by Andrew Tridgell
parent d0f06beeaa
commit 95c345e6fb
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,16 @@
#include <AP_gtest.h>
#include <AP_JSButton/AP_JSButton.h>
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()

View File

@ -0,0 +1,7 @@
#!/usr/bin/env python
# encoding: utf-8
def build(bld):
bld.ap_find_tests(
use='ap',
)