Skip to content

Conversation

@wyphan
Copy link
Owner

@wyphan wyphan commented Oct 26, 2021

No description provided.

@wyphan wyphan reopened this Oct 27, 2021
@wyphan
Copy link
Owner Author

wyphan commented Oct 27, 2021

@jvdp1 At the moment fypp still can't parse the mod_testing.fypp file, so I can't compile the new test for Gamma function... This file was introduced in commit 33d3aac.


#! Macro to register golden value
#:def save_gold( lbl, val )
$:tstlbl[ntst] = lbl
Copy link
Owner Author

Choose a reason for hiding this comment

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

Specifically, this line trips fypp, at the moment.

Copy link
Collaborator

Choose a reason for hiding this comment

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

As I understand your code, you would like to store some stuff inside fypp to check against it after running a function. fypp is a preprocessor and is used to generate code, not as test unit framework. You could use fypp as described in its doc (see assert here. However, I think that, you should use e.g., test-drive

Copy link
Owner Author

Choose a reason for hiding this comment

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

If I understand it correctly, the assert statement will immediately halt execution on a failure, which I don't think is desirable for testing. I read somewhere in the fypp docs that certain commands are executed on a Python sandbox, hence why I thought it is possible to access (write and read) Python dictionaries. The "golden" data to compare to and the check macros get hardcoded into the testing subroutine at preprocessing time.

On the other hand, test-drive looks interesting. Do you know if it supports checking arrays too (which might be needed for other operations, but not for Gamma)?

@jvdp1
Copy link
Collaborator

jvdp1 commented Oct 27, 2021 via email

@arjenmarkus
Copy link
Collaborator

Looks good to me. If the error code does not necessarily contain the offending dimension, you might move the check on the bounds out of the loop:
if ( any (idx > shp) .or. any(idx < 1) ) then ...

@arjenmarkus
Copy link
Collaborator

My ftnunit package does allow checking arrays, but that would mean quite a change, I'd say ;)

@wyphan
Copy link
Owner Author

wyphan commented Nov 2, 2021

My ftnunit package does allow checking arrays

Interesting. Would you mind posting a repo link?

@arjenmarkus
Copy link
Collaborator

arjenmarkus commented Nov 3, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants