pom.test 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. #!/bin/sh
  2. # pom.test - test functionality of pom.
  3. #
  4. # Copyright (c) 1999, 2004 Joseph Samuel Myers.
  5. # All rights reserved.
  6. #
  7. # Redistribution and use in source and binary forms, with or without
  8. # modification, are permitted provided that the following conditions
  9. # are met:
  10. # 1. Redistributions of source code must retain the above copyright
  11. # notice, this list of conditions and the following disclaimer.
  12. # 2. Redistributions in binary form must reproduce the above copyright
  13. # notice, this list of conditions and the following disclaimer in the
  14. # documentation and/or other materials provided with the distribution.
  15. # 3. The name of the author may not be used to endorse or promote products
  16. # derived from this software without specific prior written permission.
  17. #
  18. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  19. # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  20. # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  21. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  22. # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  23. # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  24. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  25. # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  26. # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  27. # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28. # SUCH DAMAGE.
  29. set -e
  30. . tests/common
  31. testexec pom pom/pom
  32. export TZ=UTC0
  33. # Should add dates from years before 1998.
  34. # Test dates from Astronomical Almanac 1998, rounded to nearest hour.
  35. # We should also test the fraction illuminated given by the program,
  36. # but the Astronomical Almanac 1998 only gives these figures to 2
  37. # decimal places (like pom) so I don't know which are border cases and
  38. # which are good tests.
  39. testno 1
  40. pom/pom 1998010514 >test.out 2>&1 || failtest
  41. compare test.out tests/pom.1998fq1
  42. rm -f test.out
  43. testno 2
  44. pom/pom 1998011217 >test.out 2>&1 || failtest
  45. compare test.out tests/pom.1998fm1
  46. rm -f test.out
  47. testno 3
  48. pom/pom 1998012020 >test.out 2>&1 || failtest
  49. compare test.out tests/pom.1998lq1
  50. rm -f test.out
  51. testno 4
  52. pom/pom 1998012806 >test.out 2>&1 || failtest
  53. compare test.out tests/pom.1998nm1
  54. rm -f test.out
  55. testno 5
  56. pom/pom 1998102010 >test.out 2>&1 || failtest
  57. compare test.out tests/pom.1998nm2
  58. rm -f test.out
  59. testno 6
  60. pom/pom 1998102812 >test.out 2>&1 || failtest
  61. compare test.out tests/pom.1998fq2
  62. rm -f test.out
  63. testno 7
  64. pom/pom 1998110405 >test.out 2>&1 || failtest
  65. compare test.out tests/pom.1998fm2
  66. rm -f test.out
  67. testno 8
  68. pom/pom 1998111100 >test.out 2>&1 || failtest
  69. compare test.out tests/pom.1998lq2
  70. rm -f test.out
  71. # Test dates from Astronomical Almanac 2003, rounded to nearest hour,
  72. # and fractions of illumination at the start of the day.
  73. testno 9
  74. pom/pom 2003010220 >test.out 2>&1 || failtest
  75. compare test.out tests/pom.2003nm1
  76. rm -f test.out
  77. testno 10
  78. pom/pom 2003011013 >test.out 2>&1 || failtest
  79. compare test.out tests/pom.2003fq1
  80. rm -f test.out
  81. testno 11
  82. pom/pom 2003011811 >test.out 2>&1 || failtest
  83. compare test.out tests/pom.2003fm1
  84. rm -f test.out
  85. testno 12
  86. pom/pom 2003012509 >test.out 2>&1 || failtest
  87. compare test.out tests/pom.2003lq1
  88. rm -f test.out
  89. testno 13
  90. pom/pom 2003112323 >test.out 2>&1 || failtest
  91. compare test.out tests/pom.2003nm2
  92. rm -f test.out
  93. testno 14
  94. pom/pom 2003113017 >test.out 2>&1 || failtest
  95. compare test.out tests/pom.2003fq2
  96. rm -f test.out
  97. testno 15
  98. pom/pom 2003120821 >test.out 2>&1 || failtest
  99. compare test.out tests/pom.2003fm2
  100. rm -f test.out
  101. testno 16
  102. pom/pom 2003121618 >test.out 2>&1 || failtest
  103. compare test.out tests/pom.2003lq2
  104. rm -f test.out
  105. testno 17
  106. pom/pom 2003010200 >test.out 2>&1 || failtest
  107. compare test.out tests/pom.2003ph1
  108. rm -f test.out
  109. testno 18
  110. pom/pom 2003010600 >test.out 2>&1 || failtest
  111. compare test.out tests/pom.2003ph2
  112. rm -f test.out
  113. testno 19
  114. pom/pom 2003011100 >test.out 2>&1 || failtest
  115. compare test.out tests/pom.2003ph3
  116. rm -f test.out
  117. testno 20
  118. pom/pom 2003012200 >test.out 2>&1 || failtest
  119. compare test.out tests/pom.2003ph4
  120. rm -f test.out
  121. testno 21
  122. pom/pom 2003090100 >test.out 2>&1 || failtest
  123. compare test.out tests/pom.2003ph5
  124. rm -f test.out
  125. testno 22
  126. pom/pom 2003090700 >test.out 2>&1 || failtest
  127. compare test.out tests/pom.2003ph6
  128. rm -f test.out
  129. testno 23
  130. pom/pom 2003091500 >test.out 2>&1 || failtest
  131. compare test.out tests/pom.2003ph7
  132. rm -f test.out
  133. testno 24
  134. pom/pom 2003092200 >test.out 2>&1 || failtest
  135. compare test.out tests/pom.2003ph8
  136. rm -f test.out
  137. # Note that the output of pom differs for dates in the past and the
  138. # future, so future dates are not good tests.