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

Function test_read_part_available

lib/cpp/test/TransportTest.cpp:594–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

592
593template <class CoupledTransports>
594void 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
615template <class CoupledTransports>
616void test_read_part_available_in_chunks() {

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