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:
Any other ideas or pointers to existing practice?
I use the time on the server to get the current Date/Year and unit-test my unit that it returns the same year (which I got from the System Time)
You should keep in mind the TimeZone difference when testing the returned value against the current Server DateTime.
This works for my testing, and hope it helps you too.