Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enh: make lcompilers_test_module default in tests #3940

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Pranavchiku
Copy link
Contributor

No description provided.

@Pranavchiku
Copy link
Contributor Author

@parth121101 once this PR gets merged, if you wish you can remove if(....) error stop from test suite, like this is not necessary but good to have.

@certik certik mentioned this pull request Apr 26, 2024
a = 4._dp
if (abs(sqrt(a)-2._dp) > 1e-12_dp) error stop
call lcompilers_test(sqrt(a), 2._dp)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #3941 for the options here.

@certik
Copy link
Contributor

certik commented Apr 26, 2024

Let's name it assert_*, and follow NumPy convention: https://numpy.org/doc/stable/reference/generated/numpy.testing.assert_approx_equal.html if we can.

@@ -1,26 +1,26 @@
program intrinsics_01
use lcompilers_test_module, only: lcompilers_test
Copy link
Contributor

@certik certik Apr 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the module can be called lfortran_assert

@certik
Copy link
Contributor

certik commented Apr 26, 2024

In cmake, let's compile this support module once, and then make sure it is available for each test to use it. If some tests do not use it, then they don't need to use it. I think we need to have both modes (compile this file and do not compile it).

@@ -740,7 +748,7 @@ RUN(NAME intrinsics_206 LABELS gfortran llvm llvm_wasm fortran) # poppar
RUN(NAME intrinsics_207 LABELS gfortran llvm llvm_wasm) # double precision intrinsics
RUN(NAME intrinsics_208 LABELS gfortran llvm llvm_wasm) # bit_size
RUN(NAME intrinsics_209 LABELS gfortran llvm llvm_wasm) # atand
RUN(NAME intrinsics_210 LABELS gfortran llvm llvm_wasm EXTRAFILES lcompilers_test_module.f90) # bessel_jn
RUN(NAME intrinsics_210 LABELS gfortran llvm llvm_wasm) # bessel_jn
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a flag ASSERT, that if present, then cmake will link in the extra module for asserts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants