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

📄 alltests.cpp

📁 ICE-3.2 一个开源的中间件
💻 CPP
📖 第 1 页 / 共 4 页
字号:
            test->paramTest1(b1, b2);            test(b1);            test(b1->ice_id() == "::Test::D1");            test(b1->sb == "D1.sb");            test(b1->pb == b2);            D1Ptr d1 = D1Ptr::dynamicCast(b1);            test(d1);            test(d1->sd1 == "D1.sd1");            test(d1->pd1 == b2);            test(b2);            test(b2->ice_id() == "::Test::B");  // No factory, must be sliced            test(b2->sb == "D2.sb");            test(b2->pb == b1);        }        catch(...)        {            test(0);        }    }    cout << "ok" << endl;    cout << "param ptr slicing with known first (AMI)... " << flush;    {        AMI_Test_paramTest1IPtr cb = new AMI_Test_paramTest1I;        test->paramTest1_async(cb);        test(cb->check());    }    cout << "ok" << endl;    cout << "param ptr slicing with unknown first... " << flush;    {        try        {            BPtr b2;            BPtr b1;            test->paramTest2(b2, b1);            test(b1);            test(b1->ice_id() == "::Test::D1");            test(b1->sb == "D1.sb");            test(b1->pb == b2);            D1Ptr d1 = D1Ptr::dynamicCast(b1);            test(d1);            test(d1->sd1 == "D1.sd1");            test(d1->pd1 == b2);            test(b2);            test(b2->ice_id() == "::Test::B");  // No factory, must be sliced            test(b2->sb == "D2.sb");            test(b2->pb == b1);        }        catch(...)        {            test(0);        }    }    cout << "ok" << endl;    cout << "return value identity with known first... " << flush;    {        try        {            BPtr p1;            BPtr p2;            BPtr r = test->returnTest1(p1, p2);            test(r == p1);        }        catch(...)        {            test(0);        }    }    cout << "ok" << endl;    cout << "return value identity with known first (AMI)... " << flush;    {        AMI_Test_returnTest1IPtr cb = new AMI_Test_returnTest1I;        test->returnTest1_async(cb);        test(cb->check());    }    cout << "ok" << endl;    cout << "return value identity with unknown first... " << flush;    {        try        {            BPtr p1;            BPtr p2;            BPtr r = test->returnTest2(p1, p2);            test(r == p1);        }        catch(...)        {            test(0);        }    }    cout << "ok" << endl;    cout << "return value identity with unknown first (AMI)... " << flush;    {        AMI_Test_returnTest2IPtr cb = new AMI_Test_returnTest2I;        test->returnTest2_async(cb);        test(cb->check());    }    cout << "ok" << endl;    cout << "return value identity for input params known first... " << flush;    {        try        {            D1Ptr d1 = new D1;            d1->sb = "D1.sb";            d1->sd1 = "D1.sd1";            D3Ptr d3 = new D3;            d3->pb = d1;            d3->sb = "D3.sb";            d3->sd3 = "D3.sd3";            d3->pd3 = d1;            d1->pb = d3;            d1->pd1 = d3;            BPtr b1 = test->returnTest3(d1, d3);            test(b1);            test(b1->sb == "D1.sb");            test(b1->ice_id() == "::Test::D1");            D1Ptr p1 = D1Ptr::dynamicCast(b1);            test(p1);            test(p1->sd1 == "D1.sd1");            test(p1->pd1 == b1->pb);            BPtr b2 = b1->pb;            test(b2);            test(b2->sb == "D3.sb");            test(b2->ice_id() == "::Test::B");  // Sliced by server            test(b2->pb == b1);            D3Ptr p3 = D3Ptr::dynamicCast(b2);            test(!p3);            test(b1 != d1);            test(b1 != d3);            test(b2 != d1);            test(b2 != d3);        }        catch(...)        {            test(0);        }    }    cout << "ok" << endl;    cout << "return value identity for input params known first (AMI)... " << flush;    {        try        {            D1Ptr d1 = new D1;            d1->sb = "D1.sb";            d1->sd1 = "D1.sd1";            D3Ptr d3 = new D3;            d3->pb = d1;            d3->sb = "D3.sb";            d3->sd3 = "D3.sd3";            d3->pd3 = d1;            d1->pb = d3;            d1->pd1 = d3;            AMI_Test_returnTest3IPtr cb = new AMI_Test_returnTest3I;            test->returnTest3_async(cb, d1, d3);            test(cb->check());            BPtr b1 = cb->r;            test(b1);            test(b1->sb == "D1.sb");            test(b1->ice_id() == "::Test::D1");            D1Ptr p1 = D1Ptr::dynamicCast(b1);            test(p1);            test(p1->sd1 == "D1.sd1");            test(p1->pd1 == b1->pb);            BPtr b2 = b1->pb;            test(b2);            test(b2->sb == "D3.sb");            test(b2->ice_id() == "::Test::B");  // Sliced by server            test(b2->pb == b1);            D3Ptr p3 = D3Ptr::dynamicCast(b2);            test(!p3);            test(b1 != d1);            test(b1 != d3);            test(b2 != d1);            test(b2 != d3);        }        catch(...)        {            test(0);        }    }    cout << "ok" << endl;    cout << "return value identity for input params unknown first... " << flush;    {        try        {            D1Ptr d1 = new D1;            d1->sb = "D1.sb";            d1->sd1 = "D1.sd1";            D3Ptr d3 = new D3;            d3->pb = d1;            d3->sb = "D3.sb";            d3->sd3 = "D3.sd3";            d3->pd3 = d1;            d1->pb = d3;            d1->pd1 = d3;            BPtr b1 = test->returnTest3(d3, d1);            test(b1);            test(b1->sb == "D3.sb");            test(b1->ice_id() == "::Test::B");  // Sliced by server            D3Ptr p1 = D3Ptr::dynamicCast(b1);            test(!p1);            BPtr b2 = b1->pb;            test(b2);            test(b2->sb == "D1.sb");            test(b2->ice_id() == "::Test::D1");            test(b2->pb == b1);            D1Ptr p3 = D1Ptr::dynamicCast(b2);            test(p3);            test(p3->sd1 == "D1.sd1");            test(p3->pd1 == b1);            test(b1 != d1);            test(b1 != d3);            test(b2 != d1);            test(b2 != d3);        }        catch(...)        {            test(0);        }    }    cout << "ok" << endl;    cout << "return value identity for input params unknown first (AMI)... " << flush;    {        try        {            D1Ptr d1 = new D1;            d1->sb = "D1.sb";            d1->sd1 = "D1.sd1";            D3Ptr d3 = new D3;            d3->pb = d1;            d3->sb = "D3.sb";            d3->sd3 = "D3.sd3";            d3->pd3 = d1;            d1->pb = d3;            d1->pd1 = d3;            AMI_Test_returnTest3IPtr cb = new AMI_Test_returnTest3I;            test->returnTest3_async(cb, d3, d1);            test(cb->check());            BPtr b1 = cb->r;            test(b1);            test(b1->sb == "D3.sb");            test(b1->ice_id() == "::Test::B");  // Sliced by server            D3Ptr p1 = D3Ptr::dynamicCast(b1);            test(!p1);            BPtr b2 = b1->pb;            test(b2);            test(b2->sb == "D1.sb");            test(b2->ice_id() == "::Test::D1");            test(b2->pb == b1);            D1Ptr p3 = D1Ptr::dynamicCast(b2);            test(p3);            test(p3->sd1 == "D1.sd1");            test(p3->pd1 == b1);            test(b1 != d1);            test(b1 != d3);            test(b2 != d1);            test(b2 != d3);        }        catch(...)        {            test(0);        }    }    cout << "ok" << endl;    cout << "remainder unmarshaling (3 instances)... " << flush;    {        try        {            BPtr p1;            BPtr p2;            BPtr ret = test->paramTest3(p1, p2);            test(p1);            test(p1->sb == "D2.sb (p1 1)");            test(p1->pb == 0);            test(p1->ice_id() == "::Test::B");            test(p2);            test(p2->sb == "D2.sb (p2 1)");            test(p2->pb == 0);            test(p2->ice_id() == "::Test::B");            test(ret);            test(ret->sb == "D1.sb (p2 2)");            test(ret->pb == 0);            test(ret->ice_id() == "::Test::D1");        }        catch(...)        {            test(0);        }    }    cout << "ok" << endl;    cout << "remainder unmarshaling (3 instances) (AMI)... " << flush;    {        AMI_Test_paramTest3IPtr cb = new AMI_Test_paramTest3I;        test->paramTest3_async(cb);        test(cb->check());    }    cout << "ok" << endl;    cout << "remainder unmarshaling (4 instances)... " << flush;    {        try        {            BPtr b;            BPtr ret = test->paramTest4(b);            test(b);            test(b->sb == "D4.sb (1)");            test(b->pb == 0);            test(b->ice_id() == "::Test::B");            test(ret);            test(ret->sb == "B.sb (2)");            test(ret->pb == 0);            test(ret->ice_id() == "::Test::B");        }        catch(...)        {            test(0);        }    }    cout << "ok" << endl;    cout << "remainder unmarshaling (4 instances) (AMI)... " << flush;    {        BPtr b;        AMI_Test_paramTest4IPtr cb = new AMI_Test_paramTest4I;        test->paramTest4_async(cb);        test(cb->check());    }    cout << "ok" << endl;    cout << "param ptr slicing, instance marshaled in unknown derived as base... " << flush;    {        try        {            BPtr b1 = new B;            b1->sb = "B.sb(1)";            b1->pb = b1;            D3Ptr d3 = new D3;            d3->sb = "D3.sb";            d3->pb = d3;            d3->sd3 = "D3.sd3";            d3->pd3 = b1;            BPtr b2 = new B;            b2->sb = "B.sb(2)";            b2->pb = b1;            BPtr r = test->returnTest3(d3, b2);            test(r);            test(r->ice_id() == "::Test::B");            test(r->sb == "D3.sb");            test(r->pb == r);        }        catch(...)        {            test(0);        }    }    cout << "ok" << endl;    cout << "param ptr slicing, instance marshaled in unknown derived as base (AMI)... " << flush;    {        try        {            BPtr b1 = new B;            b1->sb = "B.sb(1)";            b1->pb = b1;            D3Ptr d3 = new D3;            d3->sb = "D3.sb";            d3->pb = d3;            d3->sd3 = "D3.sd3";            d3->pd3 = b1;            BPtr b2 = new B;            b2->sb = "B.sb(2)";            b2->pb = b1;            AMI_Test_returnTest3IPtr cb = new AMI_Test_returnTest3I;            test->returnTest3_async(cb, d3, b2);            test(cb->check());            BPtr r = cb->r;            test(r);            test(r->ice_id() == "::Test::B");            test(r->sb == "D3.sb");            test(r->pb == r);        }        catch(...)        {            test(0);        }    }    cout << "ok" << endl;    cout << "param ptr slicing, instance marshaled in unknown derived as derived... "         << flush;    {        try        {            D1Ptr d11 = new D1;            d11->sb = "D1.sb(1)";            d11->pb = d11;            d11->sd1 = "D1.sd1(1)";            D3Ptr d3 = new D3;            d3->sb = "D3.sb";            d3->pb = d3;            d3->sd3 = "D3.sd3";            d3->pd3 = d11;            D1Ptr d12 = new D1;            d12->sb = "D1.sb(2)";            d12->pb = d12;            d12->sd1 = "D1.sd1(2)";            d12->pd1 = d11;            BPtr r = test->returnTest3(d3, d12);            test(r);            test(r->ice_id() == "::Test::B");            test(r->sb == "D3.sb");            test(r->pb == r);        }        catch(...)        {            test(0);        }    }    cout << "ok" << endl;    cout << "param ptr slicing, instance marshaled in unknown derived as derived (AMI)... "         << flush;    {        try        {            D1Ptr d11 = new D1;            d11->sb = "D1.sb(1)";            d11->pb = d11;            d11->sd1 = "D1.sd1(1)";            D3Ptr d3 = new D3;            d3->sb = "D3.sb";

⌨️ 快捷键说明

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