Skip to content
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

155 fix dependency loop between models and minimizer #183

Merged
merged 14 commits into from
Dec 25, 2024

Conversation

vollous
Copy link
Collaborator

@vollous vollous commented Dec 3, 2024

Moved CheckImplementation into src/prog/Test.cpp. Now we the library Models does not depend on Minimizer.

It seemed like an overkill to create a library just for this.

@vollous vollous linked an issue Dec 3, 2024 that may be closed by this pull request
@phbasler
Copy link
Owner

phbasler commented Dec 3, 2024

Strictly speaking this is a breaking change as we remove a public function.
The idea behind moving it to a new library as a free function was offering this to users as a small change. Moving it purely to Test.cpp removes it from all other custom implementations.

We can however accept this possibility and make this new library once someone raises an issue

@vollous vollous closed this Dec 4, 2024
@vollous vollous force-pushed the 155-fix-dependency-loop-between-models-and-minimizer branch from 8d5b61f to 6bf4a3e Compare December 4, 2024 09:28
@vollous vollous reopened this Dec 4, 2024
@vollous vollous marked this pull request as ready for review December 4, 2024 13:01
@vollous
Copy link
Collaborator Author

vollous commented Dec 4, 2024

Strictly speaking this is a breaking change as we remove a public function. The idea behind moving it to a new library as a free function was offering this to users as a small change. Moving it purely to Test.cpp removes it from all other custom implementations.

We can however accept this possibility and make this new library once someone raises an issue

Okay, I redid the implementation. For some reason, the checks are not appearing on the PR page but are being done anyway...

@phbasler
Copy link
Owner

phbasler commented Dec 4, 2024

Strictly speaking this is a breaking change as we remove a public function. The idea behind moving it to a new library as a free function was offering this to users as a small change. Moving it purely to Test.cpp removes it from all other custom implementations.
We can however accept this possibility and make this new library once someone raises an issue

Okay, I redid the implementation. For some reason, the checks are not appearing on the PR page but are being done anyway...

It seems the automatic cmake formatter does not trigger the workflows. I will have a look at it

Copy link

codecov bot commented Dec 9, 2024

Codecov Report

Attention: Patch coverage is 88.99083% with 12 lines in your changes missing coverage. Please review.

Project coverage is 83.42%. Comparing base (8f5d454) to head (6756265).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
src/models/modeltests/ModelTestfunctions.cpp 88.99% 12 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #183      +/-   ##
===========================================
+ Coverage    82.81%   83.42%   +0.60%     
===========================================
  Files           54       54              
  Lines        19384    19385       +1     
  Branches      1852     1852              
===========================================
+ Hits         16053    16172     +119     
+ Misses        3331     3213     -118     
Flag Coverage Δ
unittests 83.42% <88.99%> (+0.60%) ⬆️

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.

Copy link
Owner

@phbasler phbasler left a comment

Choose a reason for hiding this comment

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

Looks good so far. But maybe we could add a unit test for the missing code coverage?
As this is now a free function we could even use gmock for that

include/BSMPT/models/modeltests/ModelTestfunctions.h Outdated Show resolved Hide resolved
@vollous
Copy link
Collaborator Author

vollous commented Dec 20, 2024

Looks good so far. But maybe we could add a unit test for the missing code coverage? As this is now a free function we could even use gmock for that

Free functions are not "mockable" out of the box. Should I use an interface or convert everything into an actual class?

@phbasler
Copy link
Owner

No, I meant you could implement a mock of the Class_Potential_Origin class and pass this mock to the CheckImplementation

Or you can use an existing class like the CH2DM or so

@vollous
Copy link
Collaborator Author

vollous commented Dec 23, 2024

No, I meant you could implement a mock of the Class_Potential_Origin class and pass this mock to the CheckImplementation

Or you can use an existing class like the CH2DM or so

Okay, I used the C2HDM for the CheckImplementation coverage.

I am not understanding how to use gmock for this tho. I managed to link gmock and create a mock class of Class_Potential_Origin but then what? I basically have to implement a model so that the tests are able to run. I create a PR with my progress.

@phbasler
Copy link
Owner

phbasler commented Dec 23, 2024

It's basically two different points:

If we want to ensure that the c2hdm model passes the check implementation function, then we use the c2hdm directly.

If we want to ensure that the CheckImplementation fails when it should fail and pass when it should pass, gmock is an easy option as we can change just one ON_CALL for the test

I think for now you can drop the other PR, but sometime in the future it would be nice to ensure that these functions, which should be used by users implementing their own model, work in general and not only in our models.

ModelID::FChoose(ModelID::ModelIDs::C2HDM, SMConstants);
modelPointer->initModel(example_point_C2HDM);

ModelTests::CheckImplementation(*modelPointer,
Copy link
Owner

Choose a reason for hiding this comment

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

This does not check if the checks passed or failed. I added a given check

@phbasler phbasler enabled auto-merge (squash) December 25, 2024 07:23
@phbasler phbasler merged commit 26500e5 into develop Dec 25, 2024
7 checks passed
@phbasler phbasler deleted the 155-fix-dependency-loop-between-models-and-minimizer branch December 25, 2024 07:49
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.

Fix dependency loop between Models and Minimizer
2 participants