CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_Common/tests/test_fwversion.cpp
Views: 1799
1
2
#define APM_BUILD_DIRECTORY APM_BUILD_UNKNOWN
3
4
#include <AP_gtest.h>
5
#include <AP_Common/AP_FWVersion.h>
6
#include <GCS_MAVLink/GCS_Dummy.h>
7
#include <AP_Vehicle/AP_Vehicle_Type.h>
8
9
const AP_HAL::HAL& hal = AP_HAL::get_HAL();
10
11
12
TEST(AP_FWVersion, FWVersion)
13
{
14
EXPECT_EQ(AP::fwversion().header, 0x61706677766572fbu);
15
EXPECT_EQ(AP::fwversion().header_version, 0x0200U);
16
EXPECT_EQ(AP::fwversion().pointer_size, static_cast<uint8_t>(sizeof(void*)));
17
EXPECT_EQ(AP::fwversion().reserved, 0);
18
EXPECT_EQ(AP::fwversion().vehicle_type, static_cast<uint8_t>(APM_BUILD_DIRECTORY));
19
EXPECT_EQ(AP::fwversion().board_type, static_cast<uint8_t>(CONFIG_HAL_BOARD));
20
EXPECT_EQ(AP::fwversion().board_subtype, static_cast<uint16_t>(CONFIG_HAL_BOARD_SUBTYPE));
21
EXPECT_EQ(AP::fwversion().major, FW_MAJOR);
22
EXPECT_EQ(AP::fwversion().minor, FW_MINOR);
23
EXPECT_EQ(AP::fwversion().patch, FW_PATCH);
24
EXPECT_EQ(AP::fwversion().fw_type, FW_TYPE);
25
EXPECT_EQ(AP::fwversion().os_sw_version, 0u);
26
EXPECT_STREQ(AP::fwversion().fw_string, THISFIRMWARE);
27
EXPECT_STREQ(AP::fwversion().fw_hash_str, "");
28
EXPECT_STREQ(AP::fwversion().fw_short_string, THISFIRMWARE);
29
EXPECT_EQ(AP::fwversion().fw_hash, 0u);
30
EXPECT_EQ(AP::fwversion().middleware_name, nullptr);
31
EXPECT_EQ(AP::fwversion().middleware_hash_str, nullptr);
32
EXPECT_EQ(AP::fwversion().os_name, nullptr);
33
EXPECT_EQ(AP::fwversion().os_hash_str, nullptr);
34
}
35
36
AP_GTEST_MAIN()
37
38