Skip to content

Commit

Permalink
🧪 (tests): on device - add firmwarekit version tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ladislas committed Jan 12, 2023
1 parent 1d96c89 commit 26a4fcf
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/functional/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ add_subdirectory(${TESTS_FUNCTIONAL_TESTS_DIR}/deep_sleep_core_pwm)
add_subdirectory(${TESTS_FUNCTIONAL_TESTS_DIR}/deep_sleep_log_kit)
add_subdirectory(${TESTS_FUNCTIONAL_TESTS_DIR}/deep_sleep_mbed_hal)
add_subdirectory(${TESTS_FUNCTIONAL_TESTS_DIR}/file_manager)
add_subdirectory(${TESTS_FUNCTIONAL_TESTS_DIR}/firmware_kit)
add_subdirectory(${TESTS_FUNCTIONAL_TESTS_DIR}/imu_kit)
add_subdirectory(${TESTS_FUNCTIONAL_TESTS_DIR}/io_expander)
add_subdirectory(${TESTS_FUNCTIONAL_TESTS_DIR}/qdac)
16 changes: 16 additions & 0 deletions tests/functional/tests/firmware_kit/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Leka - LekaOS
# Copyright 2022 APF France handicap
# SPDX-License-Identifier: Apache-2.0

register_functional_test(
TARGET
functional_ut_firmware_kit

INCLUDE_DIRECTORIES

SOURCES
suite_firmware_kit.cpp

LINK_LIBRARIES
FirmwareKit
)
36 changes: 36 additions & 0 deletions tests/functional/tests/firmware_kit/suite_firmware_kit.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Leka - LekaOS
// Copyright 2022 APF France handicap
// SPDX-License-Identifier: Apache-2.0

#include <cstddef>

#include "CoreFlashIS25LP016D.h"
#include "CoreFlashManagerIS25LP016D.h"
#include "CoreQSPI.h"
#include "FirmwareKit.h"
#include "os_version.h"
#include "semver/semver.hpp"
#include "tests/config.h"
#include "tests/utils.h"
#include "tests/utils_sleep.h"

using namespace leka;
using namespace boost::ut;
using namespace std::chrono;

auto qspi = CoreQSPI();
auto flash_manager = CoreFlashManagerIS25LP016D(qspi);
auto flash_memory = CoreFlashIS25LP016D(qspi, flash_manager);

suite suite_firmware_kit = [] {
"config version and firmware kit version are the same"_test = [&] {
auto firmwarekit = FirmwareKit(flash_memory, FirmwareKit::DEFAULT_CONFIG);
auto firmwarekit_version = firmwarekit.getCurrentVersion();

auto semver_version = semver::version {OS_VERSION};

expect(eq(firmwarekit_version.major, semver_version.major));
expect(eq(firmwarekit_version.minor, semver_version.minor));
expect(eq(firmwarekit_version.revision, semver_version.patch));
};
};

0 comments on commit 26a4fcf

Please sign in to comment.