What is the best practice for automatically testing the correct behavior of a function that depends on the current year? Specifically, I would like to add a test to the function DateList
in Mathics (a Mathematica-like CAS) that ensures that the current year is returned when no year is given as an argument.
Two possible solutions come to my mind:
- Hard-code the current year in the test. So this test has to be updated every year with the potential of some failing integration tests after New Year.
- Create another function that is supposed to return the current year and ensure they return the same. This reduces the probability of errors but, of course, still both functions could be wrong.
Any other ideas or pointers to existing practice?