Changeset 4956 in CLRX


Ignore:
Timestamp:
Sep 11, 2019, 8:11:38 PM (2 months ago)
Author:
matszpk
Message:

CLRadeonExtender: ROCmBin: Add next testcases to ROCmMsgPackWrite.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/tests/amdbin/ROCmMsgPackWrite.cpp

    r4955 r4956  
    7575    }
    7676    {   // long array (1777777 elements)
    77         Array<cxbyte> outBytes3(1777777+5);
    78         outBytes3[0] = 0xdd;
    79         outBytes3[1] = 1777777>>24;
    80         outBytes3[2] = (1777777>>16)&0xff;
    81         outBytes3[3] = (1777777>>8)&0xff;
    82         outBytes3[4] = 1777777&0xff;
     77        Array<cxbyte> outBytes4(1777777+5);
     78        outBytes4[0] = 0xdd;
     79        outBytes4[1] = 1777777>>24;
     80        outBytes4[2] = (1777777>>16)&0xff;
     81        outBytes4[3] = (1777777>>8)&0xff;
     82        outBytes4[4] = 1777777&0xff;
    8383        std::vector<cxbyte> out;
    8484        MsgPackArrayWriter awriter(1777777, out);
     
    8686        {
    8787            awriter.putUInt(i&0x7f);
    88             outBytes3[i+5] = i&0x7f;
     88            outBytes4[i+5] = i&0x7f;
    8989        }
    90         assertArray("MsgPackWrite0", "tc4", outBytes3, out);
     90        assertArray("MsgPackWrite0", "tc4", outBytes4, out);
    9191    }
    9292    /* test putting values */
     93    {
     94        static const cxbyte outBytes5[21] = { 0x95, 0x12, 0xcc, 0xd1, 0xcd, 0xab, 0x73,
     95            0xce, 0xa1, 0x18, 0xb9, 0x31,
     96            0xcf, 0x11, 0x88, 0x99, 0xa1, 0xb6, 0xa1, 0x9e, 0x1a };
     97        std::vector<cxbyte> out;
     98        MsgPackArrayWriter awriter(5, out);
     99        awriter.putUInt(0x12);
     100        awriter.putUInt(0xd1);
     101        awriter.putUInt(0xab73);
     102        awriter.putUInt(0xa118b931U);
     103        awriter.putUInt(0x118899a1b6a19e1aULL);
     104        assertArray("MsgPackWrite0", "tc5",
     105                    Array<cxbyte>(outBytes5, outBytes5 + sizeof(outBytes5)), out);
     106    }
     107    // testing string putting (short)
     108    {
     109        static const cxbyte outBytes6[7] = { 0x91, 0xa5, 0x4a, 0x5b, 0x31, 0x28, 0x44 };
     110        std::vector<cxbyte> out;
     111        MsgPackArrayWriter awriter(1, out);
     112        awriter.putString("\x4a\x5b\x31\x28\x44");
     113        assertArray("MsgPackWrite0", "tc6",
     114                    Array<cxbyte>(outBytes6, outBytes6 + sizeof(outBytes6)), out);
     115    }
     116    {
     117        Array<cxbyte> outBytes7(187+3);
     118        outBytes7[0] = 0x91;
     119        outBytes7[1] = 0xd9;
     120        outBytes7[2] = 187;
     121        std::vector<cxbyte> out;
     122        MsgPackArrayWriter awriter(1, out);
     123        for (cxuint i = 0; i < 187; i++)
     124            outBytes7[i+3] = (i&0x7f)+10;
     125        std::string s(reinterpret_cast<cxbyte*>(outBytes7.data())+3,
     126                    reinterpret_cast<cxbyte*>(outBytes7.data())+187+3);
     127        awriter.putString(s.c_str());
     128        assertArray("MsgPackWrite0", "tc7", outBytes7, out);
     129    }
     130    {
     131        Array<cxbyte> outBytes8(18529+4);
     132        outBytes8[0] = 0x91;
     133        outBytes8[1] = 0xda;
     134        outBytes8[2] = 18529>>8;
     135        outBytes8[3] = 18529&0xff;
     136        std::vector<cxbyte> out;
     137        MsgPackArrayWriter awriter(1, out);
     138        for (cxuint i = 0; i < 18529; i++)
     139            outBytes8[i+4] = (i&0x7f)+10;
     140        std::string s(reinterpret_cast<cxbyte*>(outBytes8.data())+4,
     141                    reinterpret_cast<cxbyte*>(outBytes8.data())+18529+4);
     142        awriter.putString(s.c_str());
     143        assertArray("MsgPackWrite0", "tc8", outBytes8, out);
     144    }
     145    {
     146        Array<cxbyte> outBytes9(9838391+6);
     147        outBytes9[0] = 0x91;
     148        outBytes9[1] = 0xdb;
     149        outBytes9[2] = 9838391>>24;
     150        outBytes9[3] = (9838391>>16)&0xff;
     151        outBytes9[4] = (9838391>>8)&0xff;
     152        outBytes9[5] = 9838391&0xff;
     153        std::vector<cxbyte> out;
     154        MsgPackArrayWriter awriter(1, out);
     155        for (cxuint i = 0; i < 9838391; i++)
     156            outBytes9[i+6] = (i&0x7f)+10;
     157        std::string s(reinterpret_cast<cxbyte*>(outBytes9.data())+6,
     158                    reinterpret_cast<cxbyte*>(outBytes9.data())+9838391+6);
     159        awriter.putString(s.c_str());
     160        assertArray("MsgPackWrite0", "tc9", outBytes9, out);
     161    }
     162    /* map writer class */
    93163}
    94164
Note: See TracChangeset for help on using the changeset viewer.