MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / assertResult

Function assertResult

source/test/testCPU.cpp:280–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278}
279
280void assertResult(struct Data* data, CPU* cpu, int instruction, U32 resultvar1, U32 resultvar2, int r1, int r2, U32 address, int bits, bool ignoreFlags = false) {
281 if (data->useResultvar2 && data->resultvar2 != resultvar2) {
282 failed("instruction: %d var2: %d != %d", instruction, resultvar2, data->resultvar2);
283 }
284 if (!data->dontUseResultAndCheckSFZF && data->result != resultvar1) {
285 failed("instruction: %d var1: %d != %d", instruction, resultvar1, data->result);
286 }
287 if (!ignoreFlags) {
288 if (data->hasCF && (cpu->getCF() ? 1 : 0) != data->fCF) {
289 cpu->getCF();
290 failed("instruction: %d CF", instruction);
291 }
292 if (data->hasOF && (cpu->getOF() != 0) != data->fOF) {
293 cpu->getOF();
294 failed("instruction: %d OF", instruction);
295 }
296 if (data->hasAF && (cpu->getAF() != 0) != data->fAF) {
297 cpu->getAF();
298 failed("instruction: %d AF", instruction);
299 }
300 if (data->hasSF && (cpu->getSF() != 0) != data->fSF) {
301 cpu->getSF();
302 failed("instruction: %d SF", instruction);
303 }
304 if (data->hasZF && (cpu->getZF() != 0) != data->fZF) {
305 cpu->getZF();
306 failed("instruction: %d ZF", instruction);
307 }
308 if (data->dontUseResultAndCheckSFZF) {
309 if ((cpu->getSF() != 0) != data->fSF) {
310 failed("instruction: %d SF", instruction);
311 }
312 if ((cpu->getZF() != 0) != data->fZF) {
313 failed("instruction: %d ZF", instruction);
314 }
315 }
316 }
317 if (bits == 8 || bits == 16) {
318 if (r1 >= 0) {
319 if ((cpu->reg[r1].u32 & 0xFFFF0000) != (DEFAULT & 0xFFFF0000)) {
320 failed("instruction: %d reg overwrite %d", instruction, r1);
321 }
322 }
323 if (r2 >= 0) {
324 if ((cpu->reg[r2].u32 & 0xFFFF0000) != (DEFAULT & 0xFFFF0000)) {
325 failed("instruction: %d reg overwrite %d", instruction, r2);
326 }
327 }
328 }
329 if (bits == 8) {
330 if (address != 0) {
331 if ((memory->readd(address) & 0xFFFFFF00) != (DEFAULT & 0xFFFFFF00)) {
332 failed("instruction: %d memory overwrite %d", instruction, address);
333 }
334 }
335 }
336 if (bits == 16) {
337 if (address != 0) {

Callers 15

EbFunction · 0.85
EbAlAxFunction · 0.85
EwAxDxFunction · 0.85
EdEaxEdxFunction · 0.85
EbClFunction · 0.85
EbIbFunction · 0.85
EbRegIbFunction · 0.85
EbGbFunction · 0.85
GbEbFunction · 0.85
EwFunction · 0.85
EwClFunction · 0.85
EwIxFunction · 0.85

Calls 7

failedFunction · 0.85
getCFMethod · 0.45
getOFMethod · 0.45
getAFMethod · 0.45
getSFMethod · 0.45
getZFMethod · 0.45
readdMethod · 0.45

Tested by

no test coverage detected