diff --git a/ci_tools/coverage_analysis_tools.py b/ci_tools/coverage_analysis_tools.py index 693c41a4a2..236987300a 100644 --- a/ci_tools/coverage_analysis_tools.py +++ b/ci_tools/coverage_analysis_tools.py @@ -104,7 +104,8 @@ def allow_untested_error_calls(untested): for f,line_nums in untested.items(): with open(f, encoding="utf-8") as filename: f_lines = filename.readlines() - lines = [i for i in line_nums if not f_lines[i-1].strip().startswith('raise ')] + untested_lines = [f_lines[i-1].strip() for i in line_nums] + lines = [l for l in untested_lines if not (l.startswith('raise ') or l.startswith('errors.report(') or l.startswith('return errors.report('))] if len(lines): reduced_untested[f] = lines diff --git a/pyccel/codegen/printing/ccode.py b/pyccel/codegen/printing/ccode.py index e72b85aceb..c299980981 100644 --- a/pyccel/codegen/printing/ccode.py +++ b/pyccel/codegen/printing/ccode.py @@ -498,8 +498,16 @@ def _print_PythonMin(self, expr): self.add_import(c_imports['math']) return "fmin({}, {})".format(self._print(arg[0]), self._print(arg[1])) + elif arg.dtype is NativeInteger() and len(arg) == 2: + arg1 = self.scope.get_temporary_variable(NativeInteger()) + arg2 = self.scope.get_temporary_variable(NativeInteger()) + assign1 = Assign(arg1, arg[0]) + assign2 = Assign(arg2, arg[1]) + self._additional_code += self._print(assign1) + self._additional_code += self._print(assign2) + return f"({arg1} < {arg2} ? {arg1} : {arg2})" else: - return errors.report("min in C is only supported for 2 float arguments", symbol=expr, + return errors.report("min in C is only supported for 2 scalar arguments", symbol=expr, severity='fatal') def _print_PythonMax(self, expr): @@ -508,8 +516,16 @@ def _print_PythonMax(self, expr): self.add_import(c_imports['math']) return "fmax({}, {})".format(self._print(arg[0]), self._print(arg[1])) + elif arg.dtype is NativeInteger() and len(arg) == 2: + arg1 = self.scope.get_temporary_variable(NativeInteger()) + arg2 = self.scope.get_temporary_variable(NativeInteger()) + assign1 = Assign(arg1, arg[0]) + assign2 = Assign(arg2, arg[1]) + self._additional_code += self._print(assign1) + self._additional_code += self._print(assign2) + return f"({arg1} > {arg2} ? {arg1} : {arg2})" else: - return errors.report("max in C is only supported for 2 float arguments", symbol=expr, + return errors.report("max in C is only supported for 2 scalar arguments", symbol=expr, severity='fatal') def _print_SysExit(self, expr): diff --git a/pyccel/version.py b/pyccel/version.py index 641abdbc4a..fea6104e13 100644 --- a/pyccel/version.py +++ b/pyccel/version.py @@ -1,4 +1,4 @@ """ Module specifying the current version string for pyccel """ -__version__ = "1.6.1" +__version__ = "1.7.0" diff --git a/tests/epyccel/test_builtins.py b/tests/epyccel/test_builtins.py index cdc4419e2c..62fe0da0b9 100644 --- a/tests/epyccel/test_builtins.py +++ b/tests/epyccel/test_builtins.py @@ -68,15 +68,6 @@ def f1(x): assert f1(rand_zero) == f2(rand_zero) assert f1(0j + 0) == f2(0j + 0) -@pytest.mark.parametrize( 'language', ( - pytest.param("fortran", marks = pytest.mark.fortran), - pytest.param("c", marks = [ - pytest.mark.skip(reason="min not implemented in C for integers"), - pytest.mark.c] - ), - pytest.param("python", marks = pytest.mark.python) - ) -) def test_min_2_args_i(language): @types('int','int') def f(x, y): @@ -88,15 +79,6 @@ def f(x, y): assert epyc_f(*int_args) == f(*int_args) -@pytest.mark.parametrize( 'language', ( - pytest.param("fortran", marks = pytest.mark.fortran), - pytest.param("c", marks = [ - pytest.mark.skip(reason="min not implemented in C for integers"), - pytest.mark.c] - ), - pytest.param("python", marks = pytest.mark.python) - ) -) def test_min_2_args_i_adhoc(language): def f(x:int): return min(x, 0) @@ -197,15 +179,6 @@ def f(x, y, z): assert epyc_f(*int_args) == f(*int_args) assert epyc_f(*float_args) == f(*float_args) -@pytest.mark.parametrize( 'language', ( - pytest.param("fortran", marks = pytest.mark.fortran), - pytest.param("c", marks = [ - pytest.mark.skip(reason="max not implemented in C for integers"), - pytest.mark.c] - ), - pytest.param("python", marks = pytest.mark.python) - ) -) def test_max_2_args_i(language): @types('int','int') def f(x, y):