Add timing to fixed unit tests
This commit is contained in:
parent
924ea41518
commit
3c5cff206a
@ -24,7 +24,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool construction() {
|
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.
|
// All tests are placed in IWRAM in ARM mode.
|
||||||
|
|||||||
@ -11,7 +11,10 @@ namespace test{
|
|||||||
bool fixed_suite::addition() {
|
bool fixed_suite::addition() {
|
||||||
struct {
|
struct {
|
||||||
NOINLINE fixed operator()(fixed x, fixed y) {
|
NOINLINE fixed operator()(fixed x, fixed y) {
|
||||||
return x + y;
|
start_timer();
|
||||||
|
fixed r = x + y;
|
||||||
|
end_timer();
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
} f;
|
} f;
|
||||||
|
|
||||||
@ -21,7 +24,10 @@ bool fixed_suite::addition() {
|
|||||||
bool fixed_suite::subtraction() {
|
bool fixed_suite::subtraction() {
|
||||||
struct {
|
struct {
|
||||||
NOINLINE fixed operator()(fixed x, fixed y) {
|
NOINLINE fixed operator()(fixed x, fixed y) {
|
||||||
return x - y;
|
start_timer();
|
||||||
|
fixed r = x - y;
|
||||||
|
end_timer();
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
} f;
|
} f;
|
||||||
|
|
||||||
@ -31,7 +37,10 @@ bool fixed_suite::subtraction() {
|
|||||||
bool fixed_suite::multiplication() {
|
bool fixed_suite::multiplication() {
|
||||||
struct {
|
struct {
|
||||||
NOINLINE fixed operator()(fixed x, fixed y) {
|
NOINLINE fixed operator()(fixed x, fixed y) {
|
||||||
return x * y;
|
start_timer();
|
||||||
|
fixed r = x * y;
|
||||||
|
end_timer();
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
} f;
|
} f;
|
||||||
|
|
||||||
@ -44,7 +53,10 @@ bool fixed_suite::mult_overflow() {
|
|||||||
// is used internally)
|
// is used internally)
|
||||||
struct {
|
struct {
|
||||||
NOINLINE fixed operator()(fixed x, fixed y) {
|
NOINLINE fixed operator()(fixed x, fixed y) {
|
||||||
return x * y;
|
start_timer();
|
||||||
|
fixed r = x * y;
|
||||||
|
end_timer();
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
} f;
|
} f;
|
||||||
|
|
||||||
@ -54,7 +66,10 @@ bool fixed_suite::mult_overflow() {
|
|||||||
bool fixed_suite::division() {
|
bool fixed_suite::division() {
|
||||||
struct {
|
struct {
|
||||||
NOINLINE fixed operator()(fixed x, fixed y) {
|
NOINLINE fixed operator()(fixed x, fixed y) {
|
||||||
return x / y;
|
start_timer();
|
||||||
|
fixed r = x / y;
|
||||||
|
end_timer();
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
} f;
|
} f;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user