From ba5cdad6d084e841f56d7c42ef3b332b82da56e3 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 23 Jul 2019 08:10:55 +0100 Subject: [PATCH] add fpdiv 16/32 regression/coverage tests --- src/ieee754/fpdiv/test/div_data16.py | 3 +++ src/ieee754/fpdiv/test/test_fpdiv_pipe_16.py | 18 ++++++++++++++++++ src/ieee754/fpdiv/test/test_fpdiv_pipe_32.py | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/ieee754/fpdiv/test/div_data16.py create mode 100644 src/ieee754/fpdiv/test/test_fpdiv_pipe_16.py diff --git a/src/ieee754/fpdiv/test/div_data16.py b/src/ieee754/fpdiv/test/div_data16.py new file mode 100644 index 00000000..67056352 --- /dev/null +++ b/src/ieee754/fpdiv/test/div_data16.py @@ -0,0 +1,3 @@ +def regressions(): + yield 0x3c50, 0x3e00, + yield 0x3c00, 0x3e00, diff --git a/src/ieee754/fpdiv/test/test_fpdiv_pipe_16.py b/src/ieee754/fpdiv/test/test_fpdiv_pipe_16.py new file mode 100644 index 00000000..b6ba0e29 --- /dev/null +++ b/src/ieee754/fpdiv/test/test_fpdiv_pipe_16.py @@ -0,0 +1,18 @@ +""" test of FPDIVMuxInOut +""" + +from ieee754.fpdiv.pipeline import (FPDIVMuxInOut,) +from ieee754.fpcommon.test.case_gen import run_pipe_fp +from ieee754.fpcommon.test import unit_test_half +from ieee754.fpdiv.test.div_data16 import regressions + +from sfpy import Float16 +from operator import truediv as div + +def test_pipe_fp16(): + dut = FPDIVMuxInOut(16, 4) + run_pipe_fp(dut, 16, "div16", unit_test_half, Float16, + regressions, div, 10) + +if __name__ == '__main__': + test_pipe_fp16() diff --git a/src/ieee754/fpdiv/test/test_fpdiv_pipe_32.py b/src/ieee754/fpdiv/test/test_fpdiv_pipe_32.py index e07ffc43..ddebfbce 100644 --- a/src/ieee754/fpdiv/test/test_fpdiv_pipe_32.py +++ b/src/ieee754/fpdiv/test/test_fpdiv_pipe_32.py @@ -11,7 +11,7 @@ from operator import truediv as div def test_pipe_fp32(): dut = FPDIVMuxInOut(32, 4) - run_pipe_fp(dut, 32, "div", unit_test_single, Float32, + run_pipe_fp(dut, 32, "div32", unit_test_single, Float32, regressions, div, 10) if __name__ == '__main__': -- 2.30.2