exercism / fortran

Exercism exercises in Fortran.
https://exercism.org/tracks/fortran
MIT License
23 stars 30 forks source link

Add exercise: saddle-points #223

Closed simisc closed 1 year ago

simisc commented 1 year ago

I've marked this as a draft because I had to add some test procedures for type(point_t) arrays, and I'm not sure where best to put them.

They're too exercise-specific to be added to testlib/TesterMain.f90 at the track level. If they're in a separate file, how do I make them available both in the editor and via CLI? I currently have a saddle_points_helper module in saddle_points_test.f90, but that would be too visible to students (e.g., in the editor's test tab).

glennj commented 1 year ago

I'd suggest you don't want to hide the code from the student. List the helper file in .meta/config.json in the .files.editor array. The CLI will download it as a separate file, and the web editor will display it as a source file but readonly.

glennj commented 1 year ago

How does that look to you? A satisfactory solution?

I would suggest adding a brief comment to the helper file indicating that it's used by the test suite, and the student should not worry about not understanding all of it. Or something to that effect.

simisc commented 1 year ago

Thanks for your help @glennj! Yes, looks good — I wasn't concerned about hiding the code, just didn't want it to be confusing, so I'll add a comment like you suggested.

But using a separate file meant I had to change CMakeLists.txt, so this now fails one of the checks. I haven't been able to find a way around this yet. Do you have any more tips?

[One option would be to put the helper code back into saddle_points_test.f90, but in a contains section of program saddle_points_test_main instead of in its own module. That way, students would at least see the tests without having to scroll past a lot of implementation details. What do you think?]

glennj commented 1 year ago

Sorry, I don't know cmake.

simisc commented 1 year ago

Okay, thanks again. Neither do I, so I don't want to risk breaking anything at the track level. I think it works like this, with an explanatory comment in the test file.