VirtualBox

Ignore:
Timestamp:
Jun 14, 2012 5:58:39 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
78524
Message:

tstDisasm: Better checks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Disassembler/DisasmTest.cpp

    r41715 r41716  
    2121#include <VBox/dis.h>
    2222#include <iprt/test.h>
    23 #include <iprt/asm.h>
     23#include <iprt/ctype.h>
    2424#include <iprt/string.h>
    25 #include <VBox/err.h>
     25#include <iprt/err.h>
    2626
    2727
     
    4646        int rc = DISInstrToStr(&pabInstrs[off], enmDisCpuMode, &Cpu, &cb, szOutput, sizeof(szOutput));
    4747
    48 
    4948        RTTESTI_CHECK_RC(rc, VINF_SUCCESS);
    5049        RTTESTI_CHECK(cb == Cpu.opsize);
    5150        RTTESTI_CHECK(cb > 0);
    5251        RTTESTI_CHECK(cb <= 16);
     52        RTStrStripR(szOutput);
     53        RTTESTI_CHECK(szOutput[0]);
     54        if (szOutput[0])
     55        {
     56            char *pszBytes = strchr(szOutput, '[');
     57            RTTESTI_CHECK(pszBytes);
     58            if (pszBytes)
     59            {
     60                RTTESTI_CHECK(pszBytes[-1] == ' ');
     61                RTTESTI_CHECK(RT_C_IS_XDIGIT(pszBytes[1]));
     62                RTTESTI_CHECK(pszBytes[cb * 3] == ']');
     63                RTTESTI_CHECK(pszBytes[cb * 3 + 1] == ' ');
     64
     65                size_t cch = strlen(szOutput);
     66                RTTESTI_CHECK(szOutput[cch - 1] != ',');
     67            }
     68        }
    5369        if (cErrBefore != RTTestIErrorCount())
    54             RTTestIFailureDetails("rc=%Rrc, off=%#x (%u) cbInstr=%u enmDisCpuMode=%d",
     70            RTTestIFailureDetails("rc=%Rrc, off=%#x (%u) cbInstr=%u enmDisCpuMode=%d\n",
    5571                                  rc, off, Cpu.opsize, enmDisCpuMode);
    56         RTTestIPrintf(RTTESTLVL_ALWAYS, "%s", szOutput);
     72        RTTestIPrintf(RTTESTLVL_ALWAYS, "%s\n", szOutput);
    5773        off += cb;
    5874    }
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