-
Notifications
You must be signed in to change notification settings - Fork 4
Mock IOobject
Elwardi edited this page Nov 6, 2022
·
1 revision
It would be awesome to produce a mock for IOobjects-based were Read-Write are disabled. This prevents test writers from reading-from or writing-to case dictionaries, which could potentially result in better code.
- Restricting writing is relatively easy (even through file/directory permissions).
- But restricting readings proves to be difficult.
- It's not obvious which class exactly to mock.
- Avoiding the use of original IOobject functionality is not always avoidable (Eg. Creating time and mesh objects)
- None of IOobject's methods are virtual, many are inline. It might prove extremely hard to mock such classes.
- If mocking is not the way to go, would shipping a modified core OpenFOAM lib solve this issue?
- Still need to read the mesh through regular IOobject functionality; so its implementation must be kept.
- Maybe add a mocked version - compile the mesh (
finiteVolume
?) with the original thing, and all other stuff with the mock?
At this point, messing the tests by reading from disk then fixing it seems far more feasible
“This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM® and OpenCFD® trade marks.”
This is foamUT Wiki, here is a link back to Home