VirtualBox

Changeset 892 in vbox


Ignore:
Timestamp:
Feb 14, 2007 9:35:48 AM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
18609
Message:

Test binary representation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/testcase/tstUuid.cpp

    r129 r892  
    2727#include <iprt/stream.h>
    2828#include <iprt/err.h>
     29#include <iprt/string.h>
    2930
    3031
     
    5758    CHECK_EXPR(RTUuidCompare(&Uuid, &Uuid2) == 0);
    5859
     60    /*
     61     * Check the binary representation.
     62     */
     63    RTUUID Uuid3;
     64    Uuid3.au8[0]  = 0x01;
     65    Uuid3.au8[1]  = 0x23;
     66    Uuid3.au8[2]  = 0x45;
     67    Uuid3.au8[3]  = 0x67;
     68    Uuid3.au8[4]  = 0x89;
     69    Uuid3.au8[5]  = 0xab;
     70    Uuid3.au8[6]  = 0xcd;
     71    Uuid3.au8[7]  = 0x4f;
     72    Uuid3.au8[8]  = 0x10;
     73    Uuid3.au8[9]  = 0xb2;
     74    Uuid3.au8[10] = 0x54;
     75    Uuid3.au8[11] = 0x76;
     76    Uuid3.au8[12] = 0x98;
     77    Uuid3.au8[13] = 0xba;
     78    Uuid3.au8[14] = 0xdc;
     79    Uuid3.au8[15] = 0xfe;
     80    Uuid3.Gen.u16ClockSeq = (Uuid3.Gen.u16ClockSeq & 0x3fff) | 0x8000;
     81    Uuid3.Gen.u16TimeHiAndVersion = (Uuid3.Gen.u16TimeHiAndVersion & 0x0fff) | 0x4000;
     82    const char *pszUuid3 = "67452301-ab89-4fcd-10b2-547698badcfe";
     83    rc = RTUuidToStr(&Uuid3, sz, sizeof(sz)); CHECK_RC();
     84    CHECK_EXPR(strcmp(sz, pszUuid3) == 0);
     85    rc = RTUuidFromStr(&Uuid, pszUuid3); CHECK_RC();
     86    CHECK_EXPR(RTUuidCompare(&Uuid, &Uuid3) == 0);
     87    CHECK_EXPR(memcmp(&Uuid3, &Uuid, sizeof(Uuid)) == 0);
     88
    5989    /*
    6090     * Summary.
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette