Add tests for astronomical functions.

This commit is contained in:
Dianne Skoll
2025-03-20 11:38:18 -04:00
parent 6ac5e96260
commit 2c8fa39af0
4 changed files with 74 additions and 16 deletions

View File

@@ -1,13 +0,0 @@
SET $LatDeg 45
SET $LatMin 24
SET $LatSec 0
SET $LongDeg 75
SET $LongMin 39
SET $LongSec 0
SET $MinsFromUTC -300
SET $CalcUTC 0
MSG Dawn: [dawn()]
MSG Sunrise: [sunrise()]
MSG Sunset: [sunset()]
MSG Dusk: [dusk()]

72
tests/sunmoon.rem Normal file
View File

@@ -0,0 +1,72 @@
set $AddBlankLines 0
banner %
set x adawn()
if x < 5:53 || x > 5:57
REM MSG adawn() is inaccurate! - [x]
endif
set x dawn()
if x < 7:06 || x > 7:10
REM MSG dawn() is inaccurate! - [x]
endif
set x sunrise()
if x < 7:40 || x > 7:44
REM MSG sunrise() is inaccurate! - [x]
endif
set x sunset()
if x < 16:28 || x > 16:32
REM MSG sunset() is inaccurate! - [x]
endif
set x dusk()
if x < 17:02 || x > 17:06
REM MSG dusk() is inaccurate! - [x]
endif
set x adusk()
if x < 18:15 || x > 18:19
REM MSG adusk() is inaccurate! - [x]
endif
set x moonrise()
if x < '2011-01-01@5:14' || x > '2011-01-01@5:18'
REM MSG moonrise() is inaccurate! - [x]
endif
set x moonset()
if x < '2011-01-01@13:59' || x > '2011-01-01@14:03'
REM MSG moonset() is inaccurate! - [x]
endif
set x moonphase()
if x < 319 || x > 323
REM MSG moonphase() is inaccurate! - [x]
endif
set x moondatetime(0)
if x < '2011-01-04@04:02' || x > '2011-01-04@04:06'
REM MSG moondatetime(0) is inaccurate! - [x]
endif
set x moondatetime(1)
if x < '2011-01-12@06:31' || x > '2011-01-12@06:35'
REM MSG moondatetime(1) is inaccurate! - [x]
endif
set x moondatetime(2)
if x < '2011-01-19@16:20' || x > '2011-01-19@16:24'
REM MSG moondatetime(2) is inaccurate! - [x]
endif
set x moondatetime(3)
if x < '2011-01-26@07:57' || x > '2011-01-26@08:01'
REM MSG moondatetime(3) is inaccurate! - [x]
endif
if $NumTrig == 0
REM MSG All astronomical functions look OK
endif

View File

@@ -153,9 +153,7 @@ rm -f ../tests/purge_dir/*.rem.purged >> ../tests/test.out 2>&1
../src/remind -p ../tests/shade.rem 1 August 2009 | ../src/rem2ps -e -l -c3 >> ../tests/test.out 2>&1
../src/remind -pp ../tests/shade.rem 1 August 2009 | ../src/rem2ps -e -l -c3 >> ../tests/test.out 2>&1
# The sun tests can fail due to math roundoff error changing the times
# by a minute...
# ../src/remind -p12 ../tests/sun.rem 1 Jan 2011 >> ../tests/test.out 2>&1
TZ=America/Toronto ../src/remind ../tests/sunmoon.rem 1 Jan 2011 >> ../tests/test.out 2>&1
# Test -a vs -aa
../src/remind -q -a - 1 Jan 2012 9:00 <<'EOF' >> ../tests/test.out 2>&1

View File

@@ -22332,6 +22332,7 @@ grestore
showpage
%%Trailer
%%Pages: 1
All astronomical functions look OK
Reminders for Sunday, 1st January, 2012:
1