diff --git a/libraries/tests/mbed/env/test_env.cpp b/libraries/tests/mbed/env/test_env.cpp index 65c35e286b..0dd3819a81 100644 --- a/libraries/tests/mbed/env/test_env.cpp +++ b/libraries/tests/mbed/env/test_env.cpp @@ -1,6 +1,7 @@ #include "test_env.h" -void led_blink(PinName led, float delay) { +void led_blink(PinName led, float delay) +{ if (led != NC) { DigitalOut myled(led); while (1) { @@ -11,18 +12,29 @@ void led_blink(PinName led, float delay) { while(1); } -void notify_start() { +void notify_start() +{ printf("{{start}}" NL); } -void notify_completion(bool success) { +void notify_completion(bool success) +{ if (success) { printf("{{success}}" NL); } else { printf("{{failure}}" NL); } - printf("{{end}}" NL); - led_blink(LED1, success ? 1.0 : 0.1); } + +// -DMBED_BUILD_TIMESTAMP=1406208182.13 +unsigned int testenv_randseed() +{ + unsigned int seed = 0; +#ifdef MBED_BUILD_TIMESTAMP + long long_seed = MBED_BUILD_TIMESTAMP * 100.0f; + seed = long_seed & 0xFFFFFFFF; +#endif /* MBED_BUILD_TIMESTAMP */ + return seed; +} diff --git a/libraries/tests/mbed/env/test_env.h b/libraries/tests/mbed/env/test_env.h index 3b063659fc..2462d8a534 100644 --- a/libraries/tests/mbed/env/test_env.h +++ b/libraries/tests/mbed/env/test_env.h @@ -4,12 +4,14 @@ #include #include "mbed.h" -#define NL "\n" +#define NL "\n" +// Test result related notification functions void led_blink(PinName led, float delay); - void notify_start(); - void notify_completion(bool success); +// Test functionality useful during testing +unsigned int testenv_randseed(); + #endif