mach3-software / MaCh3

The official repository for MaCh3
https://mach3-software.github.io/MaCh3/
BSD 3-Clause "New" or "Revised" License
7 stars 5 forks source link

Add Automated Code Testing #95

Closed ewanwm closed 1 month ago

ewanwm commented 2 months ago

Would be very nice to have automated code testing which can be integrated into existing continuous integration pipeline. I think the best place to start with this would be some very basic unit tests for e.g. the spline code. For us I think what this would look like would be something along the lines of:

Once these are added for the basic components (which might take a while) we could also think about some higher level integration tests. For us I think that might look like actually running some LLH scans, sigma vars etc. and eventually MCMC using the super basic dummy splines and some vv simple samples and checking that the outcome is as expected.

There are a bunch of tools for doing these tests automatically. One of the simplest is maybe CTest which is super easy to use and even comes packaged in CMake.

This kind of testing has a bunch of advantages, mainly:

If we're feeling extra fancy there are even tools for tracking the test coverage of the code such as codecov so that we can check how much and how well the code is tested.

I'm mainly just throwing this issue out there to get peoples thoughts on this and see if anyone has thought about this already/ has already started looking into it

KSkwarczynski commented 2 months ago

Fully agree,

For covariance it is also quite easy to run CI within core.

If we want Fitting Algorithms we can test them using only covariance objects.

SamplePDF have to many experiemnt sepcyfic bits.

ewanwm commented 2 months ago

For samplePDF i was wondering if it makes sense to have some very minimal "dummy experiment" implementation thats used just for testing. Maybe in some kind of testing specific library so it doesn't get included in MaCh3::All. But you definitely know the code much better than me so I will defer to you on whether or not that is sensible 😅

KSkwarczynski commented 2 months ago

Indeed there are such plans :) https://github.com/mach3-software/MaCh3/issues/44

Plan is to implement "Tutorial". Which would be sort of dummy samplePDF using Nuisance Tree (or other formats). This would both be hepfull for learning but also CI.

You can imagine as new "repo" which CPM MaCh3 and proceed with tests.

These are only plans right now :(