Fix test dates for gigasecond#602
Conversation
|
This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested. If this PR does not affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), please add the following to the merge-commit message which will stops student's tests from re-running. Please copy-paste to avoid typos. For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping |
|
Which operating system version are you using? Which Lua version? If we change the test, I think the adjustment should be by a multiple of 4 years, leaving the day and month unchanged: e.g. input 1999, expected output 2031 |
|
Our example handles this properly so I'm also curious what's different about your setup. |
|
I'm using windows 11 and my Lua version is 5.1.5 |
|
That's a very old Lua version (https://www.lua.org/versions.html). Can you upgrade? |
|
I tested this on macOS and Linux with version 5.1.5 and it worked. I don't have a Windows machine available to test, though. I also perused the docs and there's no mention of |
|
Hey @Biraru, were you able to resolve this on your side or did you learn more about what's happening on your machine? |
|
I tested this on the latest Lua release, but the issue persists — |
|
Confirmed. Running Lua 5.4 (from https://sourceforce.net/projects/luabinaries) in a Windows 11 VM. While natively on my mac, time can be represented as a negative number |
|
This issue can be resolved by setting the year to a value above |
|
Please adjust the years by a multiple of 4 years, leaving the day and month unchanged. e.g. becomes |
|
Okay |
|
Done |
This pull request updates the gigasecond exercise tests to use dates that are supported by Lua’s
os.time. Previously, test 3 used the date 1959-07-19, which causedos.timeto return nil and made theany_dateparameter ingigasecond.anniversarynil. The test has now been updated to use 2009-01-19, which allows the function to correctly calculate the gigasecond anniversary and ensures the test passes as intended.