コード例 #1
0
    void checkAccept() {
        report(0, "checking direct object accept...");

        PortReaderBuffer<Bottle> buffer;
        Bottle dummy;
        Bottle data("hello");
        Bottle data2("there");

        buffer.acceptObject(&data, &dummy);
        
        Bottle *bot = buffer.read();
        checkTrue(bot!=NULL,"Inserted message received");
        if (bot!=NULL) {
            checkEqual(bot->toString().c_str(),"hello","value ok");
        }

        buffer.acceptObject(&data2, NULL);

        bot = buffer.read();
        checkTrue(bot!=NULL,"Inserted message received");
        if (bot!=NULL) {
            checkEqual(bot->toString().c_str(),"there","value ok");
        }
        
        buffer.read(false);
    }