]> git.gir.st - tmk_keyboard.git/blob - tool/mbed/mbed-sdk/libraries/tests/mbed/dev_null/main.cpp
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[tmk_keyboard.git] / tool / mbed / mbed-sdk / libraries / tests / mbed / dev_null / main.cpp
1 #include "mbed.h"
2 #include "test_env.h"
3
4 class DevNull : public Stream {
5 public:
6 DevNull(const char *name = NULL) : Stream(name) {}
7
8 protected:
9 virtual int _getc() {
10 return 0;
11 }
12 virtual int _putc(int c) {
13 return c;
14 }
15 };
16
17 DevNull null("null");
18
19 int main() {
20 MBED_HOSTTEST_TIMEOUT(20);
21 MBED_HOSTTEST_SELECT(dev_null_auto);
22 MBED_HOSTTEST_DESCRIPTION(stdout redirected to dev null);
23 MBED_HOSTTEST_START("EXAMPLE_1");
24
25 printf("MBED: re-routing stdout to /null\r\n");
26 freopen("/null", "w", stdout);
27 printf("MBED: printf redirected to /null\r\n"); // This shouldn't appear
28 // If failure message can be seen test should fail :)
29 MBED_HOSTTEST_RESULT(false); // This is 'false' on purpose
30 }
Imprint / Impressum