Changeset 4901 in CLRX


Ignore:
Timestamp:
Aug 16, 2019, 2:41:06 PM (5 weeks ago)
Author:
matszpk
Message:

CLRadeonExtender: ROCm: Add next testcases for ROCm MsgPack? parser - floats.

File:
1 edited

Legend:

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

    r4900 r4901  
    351351        assertValue("MsgPack0", "tc14_2.DataPtr", dataPtr, tc14_1 + 2);
    352352    }
     353   
     354    // parseFloat
     355    const cxbyte tc15[6] = { 0x91, 0xca, 0xf3, 0x9c, 0x76, 0x42 };
     356    dataPtr = tc15;
     357    {
     358        MsgPackArrayParser arrParser(dataPtr, dataPtr + sizeof(tc15));
     359        assertValue("MsgPack0", "tc15.value0", double(61.653271f), arrParser.parseFloat());
     360        assertValue("MsgPack0", "tc15.DataPtr", dataPtr, tc15 + sizeof(tc15));
     361    }
     362    for (cxuint i = 1; i <= 3; i++)
     363    {
     364        dataPtr = tc15;
     365        MsgPackArrayParser arrParser(dataPtr, dataPtr + sizeof(tc15)-i);
     366        assertCLRXException("MsgPack0", "tc15_1.Ex", "MsgPack: Can't parse float value",
     367                    [&arrParser]() { arrParser.parseFloat(); });
     368        assertValue("MsgPack0", "tc15_1.DataPtr", dataPtr, tc15 + 2);
     369    }
     370    const cxbyte tc15_2[6] = { 0x91, 0xca, 0xf3, 0x9c, 0x76, 0xc2 };
     371    dataPtr = tc15_2;
     372    {
     373        MsgPackArrayParser arrParser(dataPtr, dataPtr + sizeof(tc15_2));
     374        assertValue("MsgPack0", "tc15_2.value0", double(-61.653271f),
     375                            arrParser.parseFloat());
     376        assertValue("MsgPack0", "tc15_2.DataPtr", dataPtr, tc15_2 + sizeof(tc15_2));
     377    }
     378    const cxbyte tc16[10] = { 0x91, 0xcb, 0xa3, 0x0b, 0x43, 0x99, 0x3c, 0xd1, 0x8d, 0x40 };
     379    dataPtr = tc16;
     380    {
     381        MsgPackArrayParser arrParser(dataPtr, dataPtr + sizeof(tc16));
     382        assertValue("MsgPack0", "tc16.value0", double(954.1545891988683663),
     383                    arrParser.parseFloat());
     384        assertValue("MsgPack0", "tc16.DataPtr", dataPtr, tc16 + sizeof(tc16));
     385    }
     386    for (cxuint i = 1; i <= 7; i++)
     387    {
     388        dataPtr = tc16;
     389        MsgPackArrayParser arrParser(dataPtr, dataPtr + sizeof(tc16)-i);
     390        assertCLRXException("MsgPack0", "tc16_1.Ex", "MsgPack: Can't parse float value",
     391                    [&arrParser]() { arrParser.parseFloat(); });
     392        assertValue("MsgPack0", "tc16_1.DataPtr", dataPtr, tc16 + 2);
     393    }
     394    const cxbyte tc16_1[10] = { 0x91, 0xcb, 0xa3, 0x0b, 0x43, 0x99,
     395                0x3c, 0xd1, 0x8d, 0xc0 };
     396    dataPtr = tc16_1;
     397    {
     398        MsgPackArrayParser arrParser(dataPtr, dataPtr + sizeof(tc16_1));
     399        assertValue("MsgPack0", "tc16_1.value0", double(-954.1545891988683663),
     400                    arrParser.parseFloat());
     401        assertValue("MsgPack0", "tc16_1.DataPtr", dataPtr, tc16_1 + sizeof(tc16_1));
     402    }
    353403}
    354404
Note: See TracChangeset for help on using the changeset viewer.