summaryrefslogtreecommitdiff
path: root/digital/avr/modules/math/fixed/test
diff options
context:
space:
mode:
Diffstat (limited to 'digital/avr/modules/math/fixed/test')
-rw-r--r--digital/avr/modules/math/fixed/test/Makefile3
-rw-r--r--digital/avr/modules/math/fixed/test/test_fixed.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/digital/avr/modules/math/fixed/test/Makefile b/digital/avr/modules/math/fixed/test/Makefile
index 04aa4cff..17412941 100644
--- a/digital/avr/modules/math/fixed/test/Makefile
+++ b/digital/avr/modules/math/fixed/test/Makefile
@@ -28,6 +28,7 @@ clean.test:
rm -f $(TEST_FILES)
SIMULAVR = simulavr -d $(AVR_MCU) -W 0x22,- -R 0x20,- -T uart0_exit
+CR2NL = tr '\r' '\n'
.PRECIOUS: $(TEST_FILES)
@@ -35,4 +36,4 @@ test.%.host: test_fixed.host
echo '!$(call code,$@,host)' | ./$< > $@
test.%.simu: test_fixed.avr.simu.elf
- echo '!$(call code,$@,simu)\r' | $(SIMULAVR) -f $< > $@
+ echo -e '!$(call code,$@,simu)\r' | $(SIMULAVR) -f $< | $(CR2NL) > $@
diff --git a/digital/avr/modules/math/fixed/test/test_fixed.c b/digital/avr/modules/math/fixed/test/test_fixed.c
index 875aad4f..cc9a6045 100644
--- a/digital/avr/modules/math/fixed/test/test_fixed.c
+++ b/digital/avr/modules/math/fixed/test/test_fixed.c
@@ -53,7 +53,7 @@ check_div (int32_t a, int32_t b, int32_t r)
feclearexcept (FE_ALL_EXCEPT);
double af = (double) a / (1 << 24);
double bf = (double) b / (1 << 24);
- int32_t ri = af / bf * (1 << 24);
+ int32_t ri = rint (af / bf * (1 << 24));
if (r != ri && !fetestexcept (FE_INVALID))
printf ("error: %08x / %08x != %08x (%08x)\n", a, b, r, ri);
}