-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fortran serialization codegen tests #198
Fortran serialization codegen tests #198
Conversation
source='\n!$ser savepoint no_deps_run_out\n\n!$ser data c=c\n\n!$ser data b=b')] | ||
return serialization_directives | ||
|
||
def test_deserialiser_no_deps_codegen(no_deps_source_file, diffusion_granule_deps, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you declared the no_deps_source_file
fixture anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I forgot to push the conftest.py file
@@ -24,3 +26,26 @@ def test_deserialiser_diffusion_codegen(diffusion_granule, diffusion_granule_dep | |||
generator = SerialisationGenerator(interface) | |||
generated = generator() | |||
assert len(generated) == 3 | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add one test case for a fortran file which does have dependencies and where the dependencies include derived types so we can test they are being generated correctly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a test_deserialiser_directives_diffusion_codegen test where I check if the serialization directives are correctly generated for the diffusion case, so the derived types serialization are included. I'm not sure this is what you expected, maybe I can create a smaller more specific test...
I have a question concerning the reference code fixtures: in the shorter case of the test_deserialiser_directives_no_deps_codegen test, where I check the generation of the serialization directives for a no-deps small source code, I create the GeneratedCode items and save them in a list, exactly as we do in the serialization code. In the diffusion case, instead, I saved the reference code in a file and then compare the file content to the generated code, after a conversion into a string of the GeneratedCode list (because creating the GeneratedCode instances is a bit complex giving the source code size). Should I unify the two approaches?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the small reference case it makes sense to define the generated code fixture like you did it. I agree that for more complex cases such as when defining the expected code for the diffusion granule, a better approach would be to define the expected code in an external file. Here a compromise would be to for example only check the first savepoint since otherwise the file would be quite large. I've modified the test to check for only the first savepoint, since anyhow that includes all the parts we want to test.
…C2SM/icon4py into fortran-serialisation-cli-tests
…tion-codegen-tests
No description provided.