How to check if a function was called anywhere in the execution process?

Is there any way to check that a function is called that includes all functions that may call that function?
For example, I want to check that a certain state change only occurs if _castVote is called, but _castVote is also called by castVote , castVoteSig , castVoteWithReason , etc. and also in a specific case of propose .
I can think of a lengthy way of doing this (check f.selector == function.selector for every function) but was wondering if cleaner methods exist.

I got some answers and will share here for others.

One way to do this is by overriding the function and setting a flag when it is called. This requires the function to be virtual.
In this specific case you can create a boolean castVoteCalled and update _castVote to chage this boolean when it is called.

_castVote(...) override {
castVoteCalled = true;
return super._castVote(...);
}

In the rule add require(!castVoteCalled()); to ensure flag is initially not set.

Another way to do this is to summarize _castVote with a function that updates a ghost, and then check the ghost. I did not implement this option but it is a possibility.