src/sim/port.test.cc
/**
 * Test one-sided take over. This might be a bug caused by the fact that a
 * bind() does not automatically bind both ports.
 *
 * Before the take over the connections are: port2 -> port3 -> port4
 * After the take over the connections are: port <-> port3
 */
Test one-sided take over. This might be a bug caused by the fact that a
bind() does not automatically bind both ports.

Before the take over the connections are: port2 -> port3 -> port4
After the take over the connections are: port <-> port3
Test one - sided take over . This might be a bug caused by the fact that a bind () does not automatically bind both ports . Before the take over the connections are : port2 - > port3 - > port4 After the take over the connections are : port < - > port3
TEST(PortTest, TakeOverOneSided)
{
    TestPort port(0), port2(2), port3(6), port4(10);
    port2.bind(port3);
    port3.bind(port4);
    port.takeOverFrom(&port2);
    ASSERT_TRUE(port.isConnected());
    ASSERT_EQ(&port.getPeer(), &port3);
    ASSERT_FALSE(port2.isConnected());
    ASSERT_TRUE(port3.isConnected());
    ASSERT_EQ(&port3.getPeer(), &port);
    ASSERT_FALSE(port4.isConnected());
}
TEST ( PortTest , TakeOverOneSided ) { TestPort port ( 0 ) , port2 ( 2 ) , port3 ( 6 ) , port4 ( 10 ) ; port2 . bind ( port3 ) ; port3 . bind ( port4 ) ; port . takeOverFrom ( & port2 ) ; ASSERT_TRUE ( port . isConnected ( ) ) ; ASSERT_EQ ( & port . getPeer ( ) , & port3 ) ; ASSERT_FALSE ( port2 . isConnected ( ) ) ; ASSERT_TRUE ( port3 . isConnected ( ) ) ; ASSERT_EQ ( & port3 . getPeer ( ) , & port ) ; ASSERT_FALSE ( port4 . isConnected ( ) ) ; }
Test one-sided take over.
Test one - sided take over .