src/sim/port.test.cc
/** Test that manually overwriting a bind is possible. */
Test that manually overwriting a bind is possible.
Test that manually overwriting a bind is possible .
TEST(PortTest, OverwriteConnection)
{
    TestPort port(0), port2(2), port3(6);
    ASSERT_FALSE(port.isConnected());
    ASSERT_FALSE(port2.isConnected());
    ASSERT_FALSE(port3.isConnected());
    port.bind(port2);
    ASSERT_TRUE(port.isConnected());
    ASSERT_EQ(&port.getPeer(), &port2);
    ASSERT_FALSE(port2.isConnected());
    ASSERT_FALSE(port3.isConnected());
    port.bind(port3);
    ASSERT_TRUE(port.isConnected());
    ASSERT_EQ(&port.getPeer(), &port3);
    ASSERT_FALSE(port2.isConnected());
    ASSERT_FALSE(port3.isConnected());
}
TEST ( PortTest , OverwriteConnection ) { TestPort port ( 0 ) , port2 ( 2 ) , port3 ( 6 ) ; ASSERT_FALSE ( port . isConnected ( ) ) ; ASSERT_FALSE ( port2 . isConnected ( ) ) ; ASSERT_FALSE ( port3 . isConnected ( ) ) ; port . bind ( port2 ) ; ASSERT_TRUE ( port . isConnected ( ) ) ; ASSERT_EQ ( & port . getPeer ( ) , & port2 ) ; ASSERT_FALSE ( port2 . isConnected ( ) ) ; ASSERT_FALSE ( port3 . isConnected ( ) ) ; port . bind ( port3 ) ; ASSERT_TRUE ( port . isConnected ( ) ) ; ASSERT_EQ ( & port . getPeer ( ) , & port3 ) ; ASSERT_FALSE ( port2 . isConnected ( ) ) ; ASSERT_FALSE ( port3 . isConnected ( ) ) ; }
Test that manually overwriting a bind is possible.
Test that manually overwriting a bind is possible .
// All ports start unconnected // Bind one of the ports to the other // Bind one of the ports to a third