MCPcopy Create free account
hub / github.com/apache/thrift / test_borrow_part_available

Function test_borrow_part_available

lib/cpp/test/TransportTest.cpp:701–721  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

699
700template <class CoupledTransports>
701void 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
723template <class CoupledTransports>
724void test_read_none_available() {

Callers

nothing calls this directly

Calls 5

set_triggerFunction · 0.85
clear_triggersFunction · 0.85
writeMethod · 0.65
flushMethod · 0.45
borrowMethod · 0.45

Tested by

no test coverage detected