diff options
Diffstat (limited to 'tests/absr_f.c')
-rw-r--r-- | tests/absr_f.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/absr_f.c b/tests/absr_f.c new file mode 100644 index 0000000..cc070b6 --- /dev/null +++ b/tests/absr_f.c @@ -0,0 +1,19 @@ +#include <ejit/ejit.h> +#include <assert.h> +#include "do_jit.h" + +int main() +{ + struct ejit_operand operands[1] = { + EJIT_OPERAND_FPR(0, EJIT_DOUBLE) + }; + struct ejit_func *f = ejit_create_func(EJIT_DOUBLE, 1, operands); + ejit_absr_f(f, EJIT_FPR(0), EJIT_FPR(0)); + ejit_retr_f(f, EJIT_FPR(0)); + ejit_select_compile_func(f, 0, 1, do_jit); + + assert(ejit_run_func_f_1(f, ejit_double(0.0)) == 0.0); + assert(ejit_run_func_f_1(f, ejit_double(-0.0)) == 0.0); + assert(ejit_run_func_f_1(f, ejit_double(0.5)) == 0.5); + assert(ejit_run_func_f_1(f, ejit_double(-0.5)) == 0.5); +} |