| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "gate/tests.hpp" | ||
| 2 | #include "gate/io/serialports.hpp" | ||
| 3 | |||
| 4 | using namespace gate; | ||
| 5 | using namespace gate::io; | ||
| 6 | |||
| 7 | ✗ | static void open_and_close_serial_port(String const& portId) | |
| 8 | { | ||
| 9 | /* we have no guarantee a serial port is working on the test platform */ | ||
| 10 | /* so we just try to open it without further validation */ | ||
| 11 | try | ||
| 12 | { | ||
| 13 | ✗ | SerialPort::porthandle_t handle = SerialPort::open( | |
| 14 | portId, | ||
| 15 | SerialPort::Baudrate_9600, 8, | ||
| 16 | SerialPort::Parity_None, | ||
| 17 | SerialPort::Stopbits_1_0, | ||
| 18 | SerialPort::FlowControl_None, | ||
| 19 | 100, false); | ||
| 20 | ✗ | SerialPort::close(handle); | |
| 21 | Stream strm = SerialPort::openStream(portId, | ||
| 22 | SerialPort::Baudrate_9600, 8, | ||
| 23 | SerialPort::Parity_None, | ||
| 24 | SerialPort::Stopbits_1_0, | ||
| 25 | ✗ | SerialPort::FlowControl_None); | |
| 26 | } | ||
| 27 | ✗ | catch(...) | |
| 28 | { | ||
| 29 | } | ||
| 30 | ✗ | } | |
| 31 | |||
| 32 |
2/7✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
6 | GATEXX_TEST_UNIT(SerialPortsEnum) |
| 33 | { | ||
| 34 | 4 | Array<String> portPaths; | |
| 35 |
4/14✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
|
2 | GATEXX_TEST_CHECK_NOTHROW(portPaths = SerialPort::enumPorts()); |
| 36 | |||
| 37 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
2 | GATEXX_ENUMERATE(String const, portId, portPaths.enumerate()) |
| 38 | { | ||
| 39 | ✗ | open_and_close_serial_port(*portId); | |
| 40 | } | ||
| 41 | 2 | } | |
| 42 | |||
| 43 |