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

Function test_read_part_available_in_chunks

lib/cpp/test/TransportTest.cpp:616–640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

614
615template <class CoupledTransports>
616void test_read_part_available_in_chunks() {
617 CoupledTransports transports;
618 BOOST_REQUIRE(transports.in != nullptr);
619 BOOST_REQUIRE(transports.out != nullptr);
620
621 uint8_t write_buf[16];
622 uint8_t read_buf[16];
623 memset(write_buf, 'a', sizeof(write_buf));
624
625 // Write 10 bytes (in a single frame, for transports that use framing)
626 transports.out->write(write_buf, 10);
627 transports.out->flush();
628
629 // Read 1 byte, to force the transport to read the frame
630 uint32_t bytes_read = transports.in->read(read_buf, 1);
631 BOOST_CHECK_EQUAL(bytes_read, 1u);
632
633 // Read more than what is remaining and verify the transport does not block
634 set_trigger(3, transports.out, 1);
635 bytes_read = transports.in->read(read_buf, 10);
636 BOOST_CHECK_EQUAL(g_numTriggersFired, 0u);
637 BOOST_CHECK_EQUAL(bytes_read, 9u);
638
639 clear_triggers();
640}
641
642template <class CoupledTransports>
643void test_read_partial_midframe() {

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected