AP_Common: fixed invalid nmea test

This commit is contained in:
Andrew Tridgell 2021-08-04 16:54:05 +10:00
parent 37935262ff
commit 68a33e996d

View File

@ -31,15 +31,12 @@ static DummyUart test_uart;
TEST(NMEA, Printf)
{
EXPECT_FALSE(nmea_printf(&test_uart, ""));
char test_string[] = "test\n"; // blabla not an NMEA string but whatever
const size_t len = strlen(test_string);
// test not enought space
test_uart.set_txspace(len-2);
EXPECT_FALSE(nmea_printf(&test_uart, test_string));
test_uart.set_txspace(2);
EXPECT_FALSE(nmea_printf(&test_uart, "TEST"));
// normal test
test_uart.set_txspace(42);
EXPECT_TRUE(nmea_printf(&test_uart, test_string));
test_uart.set_txspace(9);
EXPECT_TRUE(nmea_printf(&test_uart, "TEST"));
}
AP_GTEST_MAIN()