wavebitscientific / datetime-fortran

Date and time manipulation for modern Fortran
MIT License
137 stars 51 forks source link

Tests for num2date date2num #14

Closed guziy closed 10 years ago

guziy commented 10 years ago

To test date2num num2date for the last day of a month and do not initialize date time with now for the date2num-num2date tests...

milancurcic commented 10 years ago

Did you try this with the latest commit?

datetime == num2date(date2num(datetime)) not passing today had to do with 2 bugs in num2date that were fixed since.

The above test passes for me now. Though the date2num ignoring the timezone may be a problem as you pointed out in a previous issue. I will think about this when I get a bit more time and get back to you.

Thanks.

guziy commented 10 years ago

Everything seems to work, thanks. (I only replaced the test with now initialization)

Thanks

milancurcic commented 10 years ago

Hi guziy,

Thank you for your commits. I ended up having to make my own commits due to the following:

1) 4 routines had to be fixed - addMilliseconds, addSeconds, addMinutes, addHours;

2) Just DO, EXIT is favorable to DO WHILE(condition), because in the latter case, the conditions are evaluated at the beginning of the loop. Given that it is likely that most applications will increment datetime forward, and only some will decrement time, doing 1 condition test when branching is more desirable than 3.

3) Conflicts in datetime_tests.f90. I think we should keep the num2date(date2num()) test initialized with datetime % now, as this test proved that it fails on last days of the month, revealing an important bug.

4) Having the filename to match the name of the module sounds like quite a restriction. Keeping datetime.f90 as it is for now. Can't you just trick Eclipse by doing ln -s datetime.f90 datetime_module.f90?

Thanks for your help! milan