mirror of
https://github.com/GaloisInc/macaw.git
synced 2024-11-30 14:37:55 +03:00
Minor fixes to tests
This commit is contained in:
parent
3e763cc7a1
commit
092cbc2e26
@ -8,6 +8,8 @@
|
||||
#include<stdlib.h>
|
||||
#include<stdarg.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
uint64_t btc64_addr_reg(uint64_t* addr, uint64_t idx);
|
||||
uint64_t btr64_addr_reg(uint64_t* addr, uint64_t idx);
|
||||
uint64_t bts64_addr_reg(uint64_t* addr, uint64_t idx);
|
||||
@ -15,17 +17,6 @@ uint64_t bts64_addr_imm4(uint64_t* addr);
|
||||
uint64_t bts64_addr_imm68(uint64_t* addr);
|
||||
|
||||
|
||||
|
||||
void my_assert(bool b, const char* fmt, ...) {
|
||||
if (!b) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vfprintf(stderr, fmt, args);
|
||||
va_end(args);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t btc_expected(uint64_t x, uint64_t v) {
|
||||
return x ^ v;
|
||||
}
|
||||
@ -49,9 +40,8 @@ void test_addr_reg(const char* nm, uint64_t f(uint64_t*, uint64_t), uint64_t g(u
|
||||
uint64_t expected = (i / 64 == j) ? g(a0, val) : a0;
|
||||
my_assert(a[j] == expected, "%s invalid %d %d %llx %llx\n", nm, i, j, a[j], expected);
|
||||
}
|
||||
uint64_t r_mask = 1;
|
||||
uint64_t expected_r = (a0 & val) ? 1 : 0;
|
||||
my_assert((r & r_mask) == expected_r, "Bad %lld %llx %llx\n", i, expected_r, r);
|
||||
bool expected_r = (a0 & val) != 0;
|
||||
my_assert(get_cf(r) == expected_r, "Bad %lld %llx %llx\n", i, expected_r, r);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ bool get_zf(uint64_t flags) {
|
||||
return (flags & 0x40) != 0;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Floating point maniuplation.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user