⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 alltests.cpp

📁 ICE-3.2 一个开源的中间件
💻 CPP
📖 第 1 页 / 共 4 页
字号:
        }        {            Test::VariableList in;            Test::Variable inArray[5];            inArray[0].s = "These";            in.push_back(inArray[0]);            inArray[1].s = "are";            in.push_back(inArray[1]);            inArray[2].s = "five";            in.push_back(inArray[2]);            inArray[3].s = "short";            in.push_back(inArray[3]);            inArray[4].s = "strings.";            in.push_back(inArray[4]);            pair<const Test::Variable*, const Test::Variable*> inPair(inArray, inArray + 5);            AMI_TestIntf_opVariableArrayIPtr cb = new AMI_TestIntf_opVariableArrayI(in);            t->opVariableArray_async(cb, inPair);            test(cb->check());        }        {            Test::BoolSeq in(5);            in[0] = false;            in[1] = true;            in[2] = true;            in[3] = false;            in[4] = true;            pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator> inPair(in.begin(), in.end());            AMI_TestIntf_opBoolRangeIPtr cb = new AMI_TestIntf_opBoolRangeI(in);            t->opBoolRange_async(cb, inPair);            test(cb->check());        }        {            Test::ByteList in;            in.push_back('1');            in.push_back('2');            in.push_back('3');            in.push_back('4');            in.push_back('5');            pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator> inPair(in.begin(), in.end());            AMI_TestIntf_opByteRangeIPtr cb = new AMI_TestIntf_opByteRangeI(in);            t->opByteRange_async(cb, inPair);            test(cb->check());        }        {            Test::VariableList in;            Test::Variable v;            v.s = "These";            in.push_back(v);            v.s = "are";            in.push_back(v);            v.s = "five";            in.push_back(v);            v.s = "short";            in.push_back(v);            v.s = "strings.";            in.push_back(v);            pair<Test::VariableList::const_iterator, Test::VariableList::const_iterator> inPair(in.begin(), in.end());            AMI_TestIntf_opVariableRangeIPtr cb = new AMI_TestIntf_opVariableRangeI(in);            t->opVariableRange_async(cb, inPair);            test(cb->check());        }        {            Test::BoolSeq in(5);            in[0] = false;            in[1] = true;            in[2] = true;            in[3] = false;            in[4] = true;            bool inArray[5];            for(int i = 0; i < 5; ++i)            {                inArray[i] = in[i];            }            pair<const bool*, const bool*> inPair(inArray, inArray + 5);            AMI_TestIntf_opBoolRangeTypeIPtr cb = new AMI_TestIntf_opBoolRangeTypeI(in);            t->opBoolRangeType_async(cb, inPair);            test(cb->check());        }        {            Test::ByteList in;            in.push_back('1');            in.push_back('2');            in.push_back('3');            in.push_back('4');            in.push_back('5');            pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator> inPair(in.begin(), in.end());            AMI_TestIntf_opByteRangeTypeIPtr cb = new AMI_TestIntf_opByteRangeTypeI(in);            t->opByteRangeType_async(cb, inPair);            test(cb->check());        }        {            Test::VariableList in;            deque<Test::Variable> inSeq;            Test::Variable v;            v.s = "These";            in.push_back(v);            inSeq.push_back(v);            v.s = "are";            in.push_back(v);            inSeq.push_back(v);            v.s = "five";            in.push_back(v);            inSeq.push_back(v);            v.s = "short";            in.push_back(v);            inSeq.push_back(v);            v.s = "strings.";            in.push_back(v);            inSeq.push_back(v);            pair<deque<Test::Variable>::const_iterator, deque<Test::Variable>::const_iterator>                inPair(inSeq.begin(), inSeq.end());            AMI_TestIntf_opVariableRangeTypeIPtr cb = new AMI_TestIntf_opVariableRangeTypeI(in);            t->opVariableRangeType_async(cb, inPair);            test(cb->check());        }        {            deque<bool> in(5);            in[0] = false;            in[1] = true;            in[2] = true;            in[3] = false;            in[4] = true;            AMI_TestIntf_opBoolSeqIPtr cb = new AMI_TestIntf_opBoolSeqI(in);            t->opBoolSeq_async(cb, in);            test(cb->check());        }        {            list<bool> in;            in.push_back(false);            in.push_back(true);            in.push_back(true);            in.push_back(false);            in.push_back(true);            AMI_TestIntf_opBoolListIPtr cb = new AMI_TestIntf_opBoolListI(in);            t->opBoolList_async(cb, in);            test(cb->check());        }        {            deque< ::Ice::Byte> in(5);            in[0] = '1';            in[1] = '2';            in[2] = '3';            in[3] = '4';            in[4] = '5';            AMI_TestIntf_opByteSeqIPtr cb = new AMI_TestIntf_opByteSeqI(in);            t->opByteSeq_async(cb, in);            test(cb->check());        }        {            list< ::Ice::Byte> in;            in.push_back('1');            in.push_back('2');            in.push_back('3');            in.push_back('4');            in.push_back('5');            AMI_TestIntf_opByteListIPtr cb = new AMI_TestIntf_opByteListI(in);            t->opByteList_async(cb, in);            test(cb->check());        }        {            MyByteSeq in(5);            int i = 0;            for(MyByteSeq::iterator p = in.begin(); p != in.end(); ++p)            {                *p = '1' + i++;            }            AMI_TestIntf_opMyByteSeqIPtr cb = new AMI_TestIntf_opMyByteSeqI(in);            t->opMyByteSeq_async(cb, in);            test(cb->check());        }        {            deque<string> in(5);            in[0] = "These";            in[1] = "are";            in[2] = "five";            in[3] = "short";            in[4] = "strings.";            AMI_TestIntf_opStringSeqIPtr cb = new AMI_TestIntf_opStringSeqI(in);            t->opStringSeq_async(cb, in);            test(cb->check());        }        {            list<string> in;            in.push_back("These");            in.push_back("are");            in.push_back("five");            in.push_back("short");            in.push_back("strings.");            AMI_TestIntf_opStringListIPtr cb = new AMI_TestIntf_opStringListI(in);            t->opStringList_async(cb, in);            test(cb->check());        }        {            deque<Test::Fixed> in(5);            in[0].s = 1;            in[1].s = 2;            in[2].s = 3;            in[3].s = 4;            in[4].s = 5;            AMI_TestIntf_opFixedSeqIPtr cb = new AMI_TestIntf_opFixedSeqI(in);            t->opFixedSeq_async(cb, in);            test(cb->check());        }        {            list<Test::Fixed> in(5);            short num = 1;            for(list<Test::Fixed>::iterator p = in.begin(); p != in.end(); ++p)            {                (*p).s = num++;            }            AMI_TestIntf_opFixedListIPtr cb = new AMI_TestIntf_opFixedListI(in);            t->opFixedList_async(cb, in);            test(cb->check());        }        {            deque<Test::Variable> in(5);            in[0].s = "These";            in[1].s = "are";            in[2].s = "five";            in[3].s = "short";            in[4].s = "strings.";            AMI_TestIntf_opVariableSeqIPtr cb = new AMI_TestIntf_opVariableSeqI(in);            t->opVariableSeq_async(cb, in);            test(cb->check());        }        {            list<Test::Variable> in;            Test::Variable v;            v.s = "These";            in.push_back(v);            v.s = "are";            in.push_back(v);            v.s = "five";            in.push_back(v);            v.s = "short";            in.push_back(v);            v.s = "strings.";            in.push_back(v);            AMI_TestIntf_opVariableListIPtr cb = new AMI_TestIntf_opVariableListI(in);            t->opVariableList_async(cb, in);            test(cb->check());        }        {            deque<Test::StringStringDict> in(5);            in[0]["A"] = "a";            in[1]["B"] = "b";            in[2]["C"] = "c";            in[3]["D"] = "d";            in[4]["E"] = "e";            AMI_TestIntf_opStringStringDictSeqIPtr cb = new AMI_TestIntf_opStringStringDictSeqI(in);            t->opStringStringDictSeq_async(cb, in);            test(cb->check());        }        {            list<Test::StringStringDict> in;            Test::StringStringDict ssd;            ssd["A"] = "a";            in.push_back(ssd);            ssd["B"] = "b";            in.push_back(ssd);            ssd["C"] = "c";            in.push_back(ssd);            ssd["D"] = "d";            in.push_back(ssd);            ssd["E"] = "e";            in.push_back(ssd);            AMI_TestIntf_opStringStringDictListIPtr cb = new AMI_TestIntf_opStringStringDictListI(in);            t->opStringStringDictList_async(cb, in);            test(cb->check());        }        {            deque<Test::E> in(5);            in[0] = Test::E1;            in[1] = Test::E2;            in[2] = Test::E3;            in[3] = Test::E1;            in[4] = Test::E3;            AMI_TestIntf_opESeqIPtr cb = new AMI_TestIntf_opESeqI(in);            t->opESeq_async(cb, in);            test(cb->check());        }        {            list<Test::E> in;            in.push_back(Test::E1);            in.push_back(Test::E2);            in.push_back(Test::E3);            in.push_back(Test::E1);            in.push_back(Test::E3);            AMI_TestIntf_opEListIPtr cb = new AMI_TestIntf_opEListI(in);            t->opEList_async(cb, in);            test(cb->check());        }        {            deque<Test::CPrx> in(5);            in[0] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C1:default -p 12010 -t 10000"));            in[1] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C2:default -p 12010 -t 10001"));            in[2] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C3:default -p 12010 -t 10002"));            in[3] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C4:default -p 12010 -t 10003"));            in[4] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C5:default -p 12010 -t 10004"));            AMI_TestIntf_opCPrxSeqIPtr cb = new AMI_TestIntf_opCPrxSeqI(in);            t->opCPrxSeq_async(cb, in);            test(cb->check());        }        {            list<Test::CPrx> in;            in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C1:default -p 12010 -t 10000")));            in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C2:default -p 12010 -t 10001")));            in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C3:default -p 12010 -t 10002")));            in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C4:default -p 12010 -t 10003")));            in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C5:default -p 12010 -t 10004")));            AMI_TestIntf_opCPrxListIPtr cb = new AMI_TestIntf_opCPrxListI(in);            t->opCPrxList_async(cb, in);            test(cb->check());        }        {            deque<Test::CPtr> in(5);            in[0] = new Test::C();            in[1] = in[0];            in[2] = in[0];            in[3] = in[0];            in[4] = in[0];            AMI_TestIntf_opCSeqIPtr cb = new AMI_TestIntf_opCSeqI(in);            t->opCSeq_async(cb, in);            test(cb->check());        }            {            list<Test::CPtr> in;            in.push_back(new Test::C());            in.push_back(new Test::C());            in.push_back(new Test::C());            in.push_back(new Test::C());            in.push_back(new Test::C());            AMI_TestIntf_opCListIPtr cb = new AMI_TestIntf_opCListI(in);            t->opCList_async(cb, in);            test(cb->check());        }        cout << "ok" << endl;    }    cout << "testing class mapped structs ... " << flush;    Test::ClassStructPtr cs = new Test::ClassStruct();    cs->y = 10;    cs->other = new Test::ClassOtherStruct;    cs->other->x = 20;    cs->otherSeq.push_back(new Test::ClassOtherStruct);    cs->otherSeq[0]->x = 30;    cs->otherSeq.push_back(new Test::ClassOtherStruct);    cs->otherSeq[1]->x = 40;    Test::ClassStructSeq csseq1;    csseq1.push_back(cs);    Test::ClassStructPtr cs2;    Test::ClassStructSeq csseq2;    Test::ClassStructPtr cs3 = t->opClassStruct(cs, csseq1, cs2, csseq2);    assert(cs3 == cs);    assert(csseq1.size() == csseq2.size());    assert(csseq1[0] == csseq2[0]);    cout << "ok" << endl;    if(!collocated)    {        cout << "testing class mapped structs with AMI... " << flush;        AMI_TestIntf_opClassStructIPtr cb = new AMI_TestIntf_opClassStructI(cs, csseq1);        t->opClassStruct_async(cb, cs, csseq1);        test(cb->check());        cout << "ok" << endl;    }    cout << "testing wstring... " << flush;    Test1::WstringSeq wseq1;    wseq1.push_back(L"Wide String");    Test2::WstringSeq wseq2;    wseq2 = wseq1;    Test1::WstringWStringDict wdict1;    wdict1[L"Key"] = L"Value";    Test2::WstringWStringDict wdict2;    wdict2 = wdict1;    ref = communicator->getProperties()->getPropertyWithDefault(        "Custom.WstringProxy1", "wstring1:default -p 12010 -t 10000");    base = communicator->stringToProxy(ref);    test(base);    Test1::WstringClassPrx wsc1 = Test1::WstringClassPrx::checkedCast(base);    test(t);    ref = communicator->getProperties()->getPropertyWithDefault(        "Custom.WstringProxy2", "wstring2:default -p 12010 -t 10000");    base = communicator->stringToProxy(ref);    test(base);    Test2::WstringClassPrx wsc2 = Test2::WstringClassPrx::checkedCast(base);    test(t);    wstring wstr = L"A Wide String";    wstring out;    wstring ret = wsc1->opString(wstr, out);    test(out == wstr);    test(ret == wstr);    if(!collocated)    {        AMI_Test1_opStringIPtr cb = new AMI_Test1_opStringI(wstr);        wsc1->opString_async(cb, wstr);        test(cb->check());    }    ret = wsc2->opString(wstr, out);    test(out == wstr);    test(ret == wstr);    if(!collocated)    {        AMI_Test2_opStringIPtr cb = new AMI_Test2_opStringI(wstr);        wsc2->opString_async(cb, wstr);        test(cb->check());    }    Test1::WstringStruct wss1;    wss1.s = wstr;    Test1::WstringStruct wss1out;    Test1::WstringStruct wss1ret = wsc1->opStruct(wss1, wss1out);    test(wss1out == wss1);    test(wss1ret == wss1);    Test2::WstringStruct wss2;    wss2.s = wstr;    Test2::WstringStruct wss2out;    Test2::WstringStruct wss2ret = wsc2->opStruct(wss2, wss2out);    test(wss2out == wss2);    test(wss2ret == wss2);    try    {        wsc1->throwExcept(wstr);    }    catch(const Test1::WstringException& ex)    {        test(ex.reason == wstr);    }    if(!collocated)    {        AMI_Test1_throwExceptIPtr cb = new AMI_Test1_throwExceptI(wstr);        wsc1->throwExcept_async(cb, wstr);        test(cb->check());    }    try    {        wsc2->throwExcept(wstr);    }    catch(const Test2::WstringException& ex)    {        test(ex.reason == wstr);    }    if(!collocated)    {        AMI_Test2_throwExceptIPtr cb = new AMI_Test2_throwExceptI(wstr);        wsc2->throwExcept_async(cb, wstr);        test(cb->check());    }    cout << "ok" << endl;    return t;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -