-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔀 Merge branch 'ladislas+mmyster/feature/functional-tests' into develop
- Loading branch information
Showing
22 changed files
with
527 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Leka - LekaOS | ||
# Copyright 2022 APF France handicap | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set(TESTS_FUNCTIONAL_INCLUDE_DIR ${TESTS_FUNCTIONAL_DIR}/include) | ||
set(TESTS_FUNCTIONAL_SOURCE_DIR ${TESTS_FUNCTIONAL_DIR}/source) | ||
set(TESTS_FUNCTIONAL_TESTS_DIR ${TESTS_FUNCTIONAL_DIR}/tests) | ||
|
||
function(register_functional_test) | ||
set(options "") | ||
set(oneValueArgs TARGET) | ||
set(multiValueArgs INCLUDE_DIRECTORIES SOURCES LINK_LIBRARIES) | ||
|
||
cmake_parse_arguments(REGISTER_FT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | ||
|
||
add_mbed_executable(${REGISTER_FT_TARGET}) | ||
|
||
target_include_directories(${REGISTER_FT_TARGET} | ||
PRIVATE | ||
${TESTS_FUNCTIONAL_INCLUDE_DIR} | ||
${REGISTER_FT_INCLUDE_DIRECTORIES} | ||
) | ||
|
||
target_sources(${REGISTER_FT_TARGET} | ||
PRIVATE | ||
${TESTS_FUNCTIONAL_SOURCE_DIR}/test_main.cpp | ||
${REGISTER_FT_SOURCES} | ||
) | ||
|
||
target_link_libraries(${REGISTER_FT_TARGET} | ||
${REGISTER_FT_LINK_LIBRARIES} | ||
) | ||
|
||
target_compile_definitions(${REGISTER_FT_TARGET} | ||
PUBLIC | ||
TARGET="${REGISTER_FT_TARGET}" | ||
) | ||
endfunction() | ||
|
||
add_subdirectory(${TESTS_FUNCTIONAL_TESTS_DIR}/boost_ut) | ||
|
||
add_subdirectory(${TESTS_FUNCTIONAL_TESTS_DIR}/io_expander) | ||
add_subdirectory(${TESTS_FUNCTIONAL_TESTS_DIR}/qdac) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Leka - LekaOS | ||
# Copyright 2022 APF France handicap | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
register_functional_test( | ||
TARGET | ||
functional_ut_boost_ut | ||
|
||
INCLUDE_DIRECTORIES | ||
|
||
SOURCES | ||
test_array.cpp | ||
test_expect.cpp | ||
test_minimal.cpp | ||
test_mutable.cpp | ||
test_parametrized.cpp | ||
test_should.cpp | ||
test_skip.cpp | ||
test_spec.cpp | ||
|
||
LINK_LIBRARIES | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Leka - LekaOS | ||
# Copyright 2022 APF France handicap | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
register_functional_test( | ||
TARGET | ||
functional_ut_io_expander | ||
|
||
INCLUDE_DIRECTORIES | ||
|
||
SOURCES | ||
suite_io_expander.cpp | ||
|
||
LINK_LIBRARIES | ||
CoreI2C | ||
CoreIOExpander | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Leka - LekaOS | ||
// Copyright 2022 APF France handicap | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include "CoreI2C.h" | ||
#include "CoreIOExpander.h" | ||
#include "DigitalOut.h" | ||
#include "tests/config.h" | ||
|
||
using namespace leka; | ||
using namespace std::chrono; | ||
using namespace boost::ut; | ||
|
||
suite suite_io_expander = [] { | ||
const uint8_t i2c_address {0x4E}; | ||
auto corei2c = CoreI2C {PinName::SENSOR_PROXIMITY_MUX_I2C_SDA, PinName::SENSOR_PROXIMITY_MUX_I2C_SCL}; | ||
auto io_expander_reset = mbed::DigitalOut {PinName::SENSOR_PROXIMITY_MUX_RESET, 0}; | ||
auto io_expander = CoreIOExpanderMCP23017 {corei2c, io_expander_reset}; | ||
|
||
"Initialization"_test = [&] { expect(neq(&io_expander, nullptr)); }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Leka - LekaOS | ||
# Copyright 2022 APF France handicap | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
register_functional_test( | ||
TARGET | ||
functional_ut_qdac | ||
|
||
INCLUDE_DIRECTORIES | ||
|
||
SOURCES | ||
suite_qdac.cpp | ||
|
||
LINK_LIBRARIES | ||
CoreI2C | ||
CoreQDAC | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Leka - LekaOS | ||
// Copyright 2022 APF France handicap | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include "CoreI2C.h" | ||
#include "CoreQDAC.h" | ||
#include "tests/config.h" | ||
|
||
using namespace leka; | ||
using namespace std::chrono; | ||
using namespace boost::ut; | ||
|
||
suite suite_qdac = [] { | ||
auto corei2c = CoreI2C {PinName::SENSOR_PROXIMITY_MUX_I2C_SDA, PinName::SENSOR_PROXIMITY_MUX_I2C_SCL}; | ||
auto dac = CoreQDACMCP4728 {corei2c, 0xC2}; | ||
auto data = uint16_t {}; | ||
auto channel = uint8_t {}; | ||
|
||
"read channel A"_test = [&] { | ||
data = 0x0ABC; | ||
channel = 0x00; | ||
dac.write(channel, data); | ||
auto ret = dac.read(channel); | ||
expect(data == ret) << "Failed to read Channel A"; | ||
}; | ||
|
||
"read channel B"_test = [&] { | ||
data = 0x0DEF; | ||
channel = 0x01; | ||
dac.write(channel, data); | ||
auto ret = dac.read(channel); | ||
expect(data == ret) << "Failed to read Channel B"; | ||
}; | ||
}; |
Oops, something went wrong.