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

Function test_borrow_none_available

lib/cpp/test/TransportTest.cpp:752–768  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

750
751template <class CoupledTransports>
752void test_borrow_none_available() {
753 CoupledTransports transports;
754 BOOST_REQUIRE(transports.in != nullptr);
755 BOOST_REQUIRE(transports.out != nullptr);
756
757 uint8_t write_buf[16];
758 memset(write_buf, 'a', sizeof(write_buf));
759
760 // Attempting to borrow when no data is available should fail immediately
761 set_trigger(1, transports.out, 10);
762 uint32_t borrow_len = 10;
763 const uint8_t* borrowed_buf = transports.in->borrow(nullptr, &borrow_len);
764 BOOST_CHECK(borrowed_buf == nullptr);
765 BOOST_CHECK_EQUAL(g_numTriggersFired, (unsigned int)0);
766
767 clear_triggers();
768}
769
770/**************************************************************************
771 * Test case generation

Callers

nothing calls this directly

Calls 3

set_triggerFunction · 0.85
clear_triggersFunction · 0.85
borrowMethod · 0.45

Tested by

no test coverage detected