129 lines
2.7 KiB
Text
129 lines
2.7 KiB
Text
|
|
TESTING "Time functions" ./test-time
|
|
|
|
TEST "time init" init 15 500000 <<END
|
|
out: 15 500000
|
|
END
|
|
|
|
TEST "time normalize" init 0 1500000 <<END
|
|
out: 1 500000
|
|
END
|
|
|
|
TEST "time to float" todouble 15 500000 <<END
|
|
out: 15.5
|
|
END
|
|
|
|
TEST "time to float, NULL gives a NaN" todoublenull <<END
|
|
out: nan
|
|
END
|
|
|
|
TEST "float to time" fromdouble 33.6666666661 <<END
|
|
out: 33 666667
|
|
END
|
|
|
|
TEST "float to time, round down" fromdouble 0.00000049 <<END
|
|
out: 0 0
|
|
END
|
|
|
|
TEST "float to time, round up" fromdouble 0.0000005 <<END
|
|
out: 0 1
|
|
END
|
|
|
|
TEST "current time" currenttime <<END
|
|
return: 0
|
|
END
|
|
|
|
TEST "add time, normalized" add 1000001 2000002 <<END
|
|
out: 3 3
|
|
END
|
|
|
|
TEST "substract time, normalized" sub 3000003 2000002 <<END
|
|
out: 1 1
|
|
END
|
|
|
|
PLANNED "overflow"
|
|
PLANNED "underflow"
|
|
|
|
# frame 1 begins at time 0
|
|
TEST "time to frame NTSC frame 1 begin" ntscframefromtime 0 0 <<END
|
|
out: 1
|
|
END
|
|
|
|
# and ends at 33365
|
|
TEST "time to frame NTSC frame 1 end" ntscframefromtime 0 33365 <<END
|
|
out: 1
|
|
END
|
|
|
|
# thus 33366 is start of frame 2
|
|
TEST "time to frame NTSC frame 2 begin" ntscframefromtime 0 33366 <<END
|
|
out: 2
|
|
END
|
|
|
|
# and 66732 is the end of frame 2
|
|
TEST "time to frame NTSC frame 2 end" ntscframefromtime 0 66732 <<END
|
|
out: 2
|
|
END
|
|
|
|
# this makes 66733 the start of frame 3
|
|
TEST "time to frame NTSC frame 3 begin" ntscframefromtime 0 66733 <<END
|
|
out: 3
|
|
END
|
|
|
|
# after 1 hour we are at frame 107893
|
|
TEST "time to frame NTSC after 1hour" ntscframefromtime 3600 0 <<END
|
|
out: 107893
|
|
END
|
|
|
|
# after 200 days we are at frame 517881601
|
|
TEST "time to frame NTSC after 200 days" ntscframefromtime 17280000 0 <<END
|
|
out: 517882118
|
|
END
|
|
|
|
|
|
TEST "frame to time NTSC frame 1" ntscframestart 1 <<END
|
|
out: 0 0
|
|
END
|
|
|
|
TEST "frame to time NTSC frame 2" ntscframestart 2 <<END
|
|
out: 0 33366
|
|
END
|
|
|
|
TEST "frame->time->frame conversion 2" ntscframecheck 2 <<END
|
|
out: frame 2 1
|
|
END
|
|
|
|
TEST "frame->time->frame conversion 3" ntscframecheck 3 <<END
|
|
out: frame 3 2
|
|
END
|
|
TEST "frame->time->frame conversion 4" ntscframecheck 4 <<END
|
|
out: frame 4 3
|
|
END
|
|
TEST "frame->time->frame conversion 5" ntscframecheck 5 <<END
|
|
out: frame 5 4
|
|
END
|
|
TEST "frame->time->frame conversion 6" ntscframecheck 6 <<END
|
|
out: frame 6 5
|
|
END
|
|
TEST "frame->time->frame conversion 7" ntscframecheck 7 <<END
|
|
out: frame 7 6
|
|
END
|
|
TEST "frame->time->frame conversion 8" ntscframecheck 8 <<END
|
|
out: frame 8 7
|
|
END
|
|
TEST "frame->time->frame conversion 9" ntscframecheck 9 <<END
|
|
out: frame 9 8
|
|
END
|
|
|
|
TEST "frame->time->frame conversion 100000" ntscframecheck 100000 <<END
|
|
out: frame 100000 99999
|
|
END
|
|
|
|
TEST "frame->time->frame conversion 999999" ntscframecheck 999999 <<END
|
|
out: frame 999999 999998
|
|
END
|
|
|
|
# how long are N frames on average (beware of precision!)
|
|
PLANNED "frame duration"
|
|
|
|
# how much frames fall in a certain timerange
|
|
PLANNED "frames in range"
|