FIX tests namespaces
This commit is contained in:
@ -31,13 +31,15 @@
|
||||
#include "static_scheduling/gear_device.hpp"
|
||||
#include "unity/unity.h"
|
||||
#include "utest/utest.h"
|
||||
namespace utest::v1 {
|
||||
|
||||
// allow for 0.1 km/h difference
|
||||
static constexpr float kAllowedSpeedDelta = 0.1f;
|
||||
// allow for 1m difference
|
||||
static constexpr float kAllowedDistanceDelta = 1.0f / 1000.0;
|
||||
|
||||
namespace utest {
|
||||
namespace v1 {
|
||||
|
||||
// function called by test handler functions for verifying the current speed
|
||||
void check_current_speed(const std::chrono::milliseconds& pedalRotationTime,
|
||||
uint8_t traySize,
|
||||
@ -74,7 +76,8 @@ float compute_distance(const std::chrono::milliseconds& pedalRotationTime,
|
||||
float trayGearRatio = static_cast<float>(traySize) / static_cast<float>(gearSize);
|
||||
float distancePerPedalTurn = trayGearRatio * wheelCircumference;
|
||||
|
||||
// distancePerPedalTurn is expressed in m, divide per 1000 for a distance in km
|
||||
// distancePerPedalTurn is expressed in m, divide per 1000 for a distance in
|
||||
// km
|
||||
return (distancePerPedalTurn * pedalRotations) / 1000.0;
|
||||
}
|
||||
|
||||
@ -85,7 +88,8 @@ void check_distance(const std::chrono::milliseconds& pedalRotationTime,
|
||||
float wheelCircumference,
|
||||
const std::chrono::milliseconds& travelTime,
|
||||
float distance) {
|
||||
// distancePerPedalTurn is expressed in m, divide per 1000 for a distance in km
|
||||
// distancePerPedalTurn is expressed in m, divide per 1000 for a distance in
|
||||
// km
|
||||
float expectedDistance = compute_distance(
|
||||
pedalRotationTime, traySize, gearSize, wheelCircumference, travelTime);
|
||||
printf(" Expected distance is %f, current distance is %f\n",
|
||||
@ -333,9 +337,9 @@ static control_t test_reset(const size_t call_count) {
|
||||
return CaseNext;
|
||||
}
|
||||
|
||||
static utest::v1::status_t greentea_setup(const size_t number_of_cases) {
|
||||
// Here, we specify the timeout (60s) and the host test (a built-in host test or the
|
||||
// name of our Python file)
|
||||
static status_t greentea_setup(const size_t number_of_cases) {
|
||||
// Here, we specify the timeout (60s) and the host test (a built-in host test
|
||||
// or the name of our Python file)
|
||||
GREENTEA_SETUP(180, "default_auto");
|
||||
|
||||
return greentea_test_setup_handler(number_of_cases);
|
||||
@ -349,6 +353,7 @@ static Case cases[] = {
|
||||
Case("test speedometer reset", test_reset)};
|
||||
|
||||
static Specification specification(greentea_setup, cases);
|
||||
}; // namespace v1
|
||||
}; // namespace utest
|
||||
|
||||
int main() { return !Harness::run(specification); }
|
||||
}; // namespace utest::v1
|
||||
int main() { return !utest::v1::Harness::run(utest::v1::specification); }
|
||||
|
Reference in New Issue
Block a user