Add timing to fixed unit tests

This commit is contained in:
Myles Busig 2024-09-17 09:04:42 -07:00
parent 924ea41518
commit 3c5cff206a
2 changed files with 24 additions and 6 deletions

View File

@ -24,7 +24,10 @@ public:
}
static bool construction() {
return fixed(7).raw() == 7 * 64;
start_timer();
bool r = fixed(7).raw() == 7 * 64;
end_timer();
return r;
}
// All tests are placed in IWRAM in ARM mode.

View File

@ -11,7 +11,10 @@ namespace test{
bool fixed_suite::addition() {
struct {
NOINLINE fixed operator()(fixed x, fixed y) {
return x + y;
start_timer();
fixed r = x + y;
end_timer();
return r;
}
} f;
@ -21,7 +24,10 @@ bool fixed_suite::addition() {
bool fixed_suite::subtraction() {
struct {
NOINLINE fixed operator()(fixed x, fixed y) {
return x - y;
start_timer();
fixed r = x - y;
end_timer();
return r;
}
} f;
@ -31,7 +37,10 @@ bool fixed_suite::subtraction() {
bool fixed_suite::multiplication() {
struct {
NOINLINE fixed operator()(fixed x, fixed y) {
return x * y;
start_timer();
fixed r = x * y;
end_timer();
return r;
}
} f;
@ -44,7 +53,10 @@ bool fixed_suite::mult_overflow() {
// is used internally)
struct {
NOINLINE fixed operator()(fixed x, fixed y) {
return x * y;
start_timer();
fixed r = x * y;
end_timer();
return r;
}
} f;
@ -54,7 +66,10 @@ bool fixed_suite::mult_overflow() {
bool fixed_suite::division() {
struct {
NOINLINE fixed operator()(fixed x, fixed y) {
return x / y;
start_timer();
fixed r = x / y;
end_timer();
return r;
}
} f;