Пример #1
0
    void testManipulators()
    {
        PtTerminal*  pTempPtTerminal;
        PtTerminal*  pTempPtTerminal_1;
                                                                                
        pTempPtTerminal = new PtTerminal("first");
        pTempPtTerminal_1 = new PtTerminal("second");
        *pTempPtTerminal_1 = *pTempPtTerminal;

        char name[128];
        CPPUNIT_ASSERT_EQUAL_MESSAGE("get name", PT_SUCCESS, 
                pTempPtTerminal->getName(name, sizeof(name) - 1));
        CPPUNIT_ASSERT_EQUAL_MESSAGE("correct terminal name", 0, strcmp(name, "first"));

        delete pTempPtTerminal;
        delete pTempPtTerminal_1;

        pTempPtTerminal = new PtTerminal("first");
        pTempPtTerminal_1 = new PtTerminal();
        *pTempPtTerminal_1 = *pTempPtTerminal;

        char name_1[128];
        CPPUNIT_ASSERT_EQUAL_MESSAGE("get name", PT_SUCCESS, 
                pTempPtTerminal_1->getName(name_1, sizeof(name_1) - 1));
        CPPUNIT_ASSERT_EQUAL_MESSAGE("correct terminal name", 0, strcmp(name_1, "first"));

        delete pTempPtTerminal;
        delete pTempPtTerminal_1;
    }
Пример #2
0
 void testAccessors()
 {
     PtTerminal*  pTempPtTerminal;
     char         pTestName[64];
                                                                             
     pTempPtTerminal = new PtTerminal("hello");
     pTempPtTerminal->getName(pTestName, 63);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("get name", PT_SUCCESS, 
             pTempPtTerminal->getName(pTestName, 63));
     CPPUNIT_ASSERT_EQUAL_MESSAGE("correct terminal name", 0, strcmp(pTestName, "hello"));
     delete pTempPtTerminal;
 }
Пример #3
0
void MyTerminalConnectionListener::terminalConnectionInUse(const PtTerminalConnectionEvent& rEvent)
{
    // Instantiate a PtTerminalConnection
    PtTerminalConnection terminalConnection;

    // Associate the PtTerminalConnection with the terminal connection
    // on which this event occured.
    rEvent.getTerminalConnection(terminalConnection);

    // Instantiate a PtTerminal
    PtTerminal terminal;

    // Associate the PtTerminal with the terminal which this
    // terminal connection is related
    terminalConnection.getTerminal(terminal);

    // Get the terminal name
    const char* terminalName;
    terminal.getName(terminalName);

    printf("TERMINAL CONNECTION IN USE for terminal: %s\n",
        terminalName);
}