| 699 | |
| 700 | template <class CoupledTransports> |
| 701 | void test_borrow_part_available() { |
| 702 | CoupledTransports transports; |
| 703 | BOOST_REQUIRE(transports.in != nullptr); |
| 704 | BOOST_REQUIRE(transports.out != nullptr); |
| 705 | |
| 706 | uint8_t write_buf[16]; |
| 707 | uint8_t read_buf[16]; |
| 708 | memset(write_buf, 'a', sizeof(write_buf)); |
| 709 | |
| 710 | // Attemping to borrow 10 bytes when only 9 are available should return nullptr |
| 711 | // immediately. |
| 712 | transports.out->write(write_buf, 9); |
| 713 | transports.out->flush(); |
| 714 | set_trigger(3, transports.out, 1); |
| 715 | uint32_t borrow_len = 10; |
| 716 | const uint8_t* borrowed_buf = transports.in->borrow(read_buf, &borrow_len); |
| 717 | BOOST_CHECK_EQUAL(g_numTriggersFired, (unsigned int)0); |
| 718 | BOOST_CHECK(borrowed_buf == nullptr); |
| 719 | |
| 720 | clear_triggers(); |
| 721 | } |
| 722 | |
| 723 | template <class CoupledTransports> |
| 724 | void test_read_none_available() { |
nothing calls this directly
no test coverage detected