| 592 | |
| 593 | template <class CoupledTransports> |
| 594 | void test_read_part_available() { |
| 595 | CoupledTransports transports; |
| 596 | BOOST_REQUIRE(transports.in != nullptr); |
| 597 | BOOST_REQUIRE(transports.out != nullptr); |
| 598 | |
| 599 | uint8_t write_buf[16]; |
| 600 | uint8_t read_buf[16]; |
| 601 | memset(write_buf, 'a', sizeof(write_buf)); |
| 602 | |
| 603 | // Attemping to read 10 bytes when only 9 are available should return 9 |
| 604 | // immediately. |
| 605 | transports.out->write(write_buf, 9); |
| 606 | transports.out->flush(); |
| 607 | set_trigger(3, transports.out, 1); |
| 608 | uint32_t bytes_read = transports.in->read(read_buf, 10); |
| 609 | BOOST_CHECK_EQUAL(g_numTriggersFired, (unsigned int)0); |
| 610 | BOOST_CHECK_EQUAL(bytes_read, (uint32_t)9); |
| 611 | |
| 612 | clear_triggers(); |
| 613 | } |
| 614 | |
| 615 | template <class CoupledTransports> |
| 616 | void test_read_part_available_in_chunks() { |
nothing calls this directly
no test coverage detected