Skip to content

Test fixture#303

Draft
LecrisUT wants to merge 2 commits intospglib:developfrom
LecrisUT:test-fixture
Draft

Test fixture#303
LecrisUT wants to merge 2 commits intospglib:developfrom
LecrisUT:test-fixture

Conversation

@LecrisUT
Copy link
Copy Markdown
Collaborator

This is an example of using googletest test parameterized test fixture. With this it should be easier to get the test data from the test files that are used in python.

See /test/functional/test_dataset_access.cpp for example usage.

TODO:
  • Dataset test fixture
    • spg_get_dataset
    • spg_get_layer_dataset
    • spgat_get_dataset
    • spg_get_dataset_with_hall_number
    • spgat_get_dataset_with_hall_number
    • from_file
  • MagneticDataset test fixture
    • spg_get_magnetic_dataset
    • spgms_get_magnetic_dataset
    • from_file?
  • SpglibSpacegroupType test fixture
  • SpglibMagneticSpacegroupType test fixture
  • Symmetry test fixture
  • MagneticSymmetry test fixture
  • Cell test fixture
  • MatINT test fixture
  • VecDBL test fixture
  • OverlapChecker test fixture
  • DataContainer test fixture
  • Primitive test fixture
  • ExtraStructure test fixture

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 18, 2023

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.64%. Comparing base (fdcaafc) to head (e134a61).
⚠️ Report is 565 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #303      +/-   ##
===========================================
+ Coverage    76.48%   83.64%   +7.15%     
===========================================
  Files           22       23       +1     
  Lines         5576     6274     +698     
===========================================
+ Hits          4265     5248     +983     
+ Misses        1311     1026     -285     
Flag Coverage Δ
c_api 74.01% <ø> (-2.48%) ⬇️
fortran_api 36.23% <ø> (-1.23%) ⬇️
python_api 80.42% <ø> (?)
unit_tests 74.01% <ø> (-2.48%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LecrisUT LecrisUT mentioned this pull request Jun 19, 2023
1 task
LecrisUT added 2 commits June 19, 2023 11:04
Signed-off-by: Cristian Le <git@lecris.dev>
Signed-off-by: Cristian Le <git@lecris.dev>
@LecrisUT LecrisUT closed this Jun 19, 2023
@LecrisUT LecrisUT deleted the test-fixture branch June 19, 2023 13:53
@LecrisUT LecrisUT mentioned this pull request Jun 20, 2023
1 task
@LecrisUT LecrisUT restored the test-fixture branch June 22, 2023 19:56
@LecrisUT LecrisUT reopened this Jun 22, 2023
@atztogo
Copy link
Copy Markdown
Collaborator

atztogo commented Sep 28, 2023

Is the goal of this fully replace pytest, or to have at least a set of tests for every API functions?

@LecrisUT
Copy link
Copy Markdown
Collaborator Author

Yes, the goal is to replace them for the main C interface. We can run more complete checks with specific compiler flags, while the other api tests should test only that, api specific stuff, including memory allocation/deallocation to the language native objects.

@atztogo
Copy link
Copy Markdown
Collaborator

atztogo commented Sep 30, 2023

If so, it will not be a small work.

@LecrisUT
Copy link
Copy Markdown
Collaborator Author

LecrisUT commented Sep 30, 2023

Well, no. These are all functional (regression tests), so the only missing part is getting input data and compared data which are already present in the python database. That is not so difficult, I just need to actually sit down and do it.

However, these are not appropriate tests to rely on for the long-run, since it is hard to pin down where things are breaking and they are vulnerable to numerical fluctuations. The difficult work is to do proper unit (+ integration) testing, which requires going into each component and writing minimal tests. The framework for that is already in place it's just time and work needed to go through each one. I am not tackling this issue for now, but if I have some time to do #301 (#262) that will be unit tested as it evolves.

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

Labels

None yet

Projects

Status: Issue and PR

Development

Successfully merging this pull request may close these issues.

3 participants