defined.scm 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. ;;; GNU Mes --- Maxwell Equations of Software
  2. ;;; Copyright © 2016,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  3. ;;;
  4. ;;; This file is part of GNU Mes.
  5. ;;;
  6. ;;; GNU Mes is free software; you can redistribute it and/or modify it
  7. ;;; under the terms of the GNU General Public License as published by
  8. ;;; the Free Software Foundation; either version 3 of the License, or (at
  9. ;;; your option) any later version.
  10. ;;;
  11. ;;; GNU Mes is distributed in the hope that it will be useful, but
  12. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;;; GNU General Public License for more details.
  15. ;;;
  16. ;;; You should have received a copy of the GNU General Public License
  17. ;;; along with GNU Mes. If not, see <http://www.gnu.org/licenses/>
  18. ;; Setup output file
  19. (set-current-output-port (open-output-file "test/results/test021.answer"))
  20. (define (newline) (display #\newline))
  21. ;; Testing char?
  22. (display "Testing char?\n")
  23. (display (char? #\newline))
  24. (newline)
  25. (display (char? (list 1 2 3)))
  26. (newline)
  27. (display (char? 42))
  28. (newline)
  29. (display (char? '()))
  30. (newline)
  31. (display (char? (cons 1 2)))
  32. (newline)
  33. (display (char? '+))
  34. (newline)
  35. (display (char? 'newline))
  36. (newline)
  37. (display (char? "string"))
  38. (newline)
  39. (display (char? 'foo))
  40. (newline)
  41. (display (char? #(1 2 3)))
  42. (newline)
  43. ;; Testing list?
  44. (display "Testing list?\n")
  45. (display (list? #\newline))
  46. (newline)
  47. (display (list? (list 1 2 3)))
  48. (newline)
  49. (display (list? 42))
  50. (newline)
  51. (display (list? '()))
  52. (newline)
  53. (display (list? (cons 1 2)))
  54. (newline)
  55. (display (list? '+))
  56. (newline)
  57. (display (list? 'newline))
  58. (newline)
  59. (display (list? "string"))
  60. (newline)
  61. (display (list? 'foo))
  62. (newline)
  63. (display (list? #(1 2 3)))
  64. (newline)
  65. ;; Testing number?
  66. (display "Testing number?\n")
  67. (display (number? #\newline))
  68. (newline)
  69. (display (number? (list 1 2 3)))
  70. (newline)
  71. (display (number? 42))
  72. (newline)
  73. (display (number? '()))
  74. (newline)
  75. (display (number? (cons 1 2)))
  76. (newline)
  77. (display (number? '+))
  78. (newline)
  79. (display (number? 'newline))
  80. (newline)
  81. (display (number? "string"))
  82. (newline)
  83. (display (number? 'foo))
  84. (newline)
  85. (display (number? #(1 2 3)))
  86. (newline)
  87. ;; Testing null?
  88. (display "Testing null?\n")
  89. (display (null? #\newline))
  90. (newline)
  91. (display (null? (list 1 2 3)))
  92. (newline)
  93. (display (null? 42))
  94. (newline)
  95. (display (null? '()))
  96. (newline)
  97. (display (null? (cons 1 2)))
  98. (newline)
  99. (display (null? '+))
  100. (newline)
  101. (display (null? 'newline))
  102. (newline)
  103. (display (null? "string"))
  104. (newline)
  105. (display (null? 'foo))
  106. (newline)
  107. (display (null? #(1 2 3)))
  108. (newline)
  109. ;; Testing pair?
  110. (display "Testing pair?\n")
  111. (display (pair? #\newline))
  112. (newline)
  113. (display (pair? (list 1 2 3)))
  114. (newline)
  115. (display (pair? 42))
  116. (newline)
  117. (display (pair? '()))
  118. (newline)
  119. (display (pair? (cons 1 2)))
  120. (newline)
  121. (display (pair? '+))
  122. (newline)
  123. (display (pair? 'newline))
  124. (newline)
  125. (display (pair? "string"))
  126. (newline)
  127. (display (pair? 'foo))
  128. (newline)
  129. (display (pair? #(1 2 3)))
  130. (newline)
  131. ;; Testing procedure?
  132. (display "Testing procedure?\n")
  133. (display (procedure? #\newline))
  134. (newline)
  135. (display (procedure? (list 1 2 3)))
  136. (newline)
  137. (display (procedure? 42))
  138. (newline)
  139. (display (procedure? '()))
  140. (newline)
  141. (display (procedure? (cons 1 2)))
  142. (newline)
  143. (display (procedure? '+))
  144. (newline)
  145. (display (procedure? 'newline))
  146. (newline)
  147. (display (procedure? "string"))
  148. (newline)
  149. (display (procedure? 'foo))
  150. (newline)
  151. (display (procedure? #(1 2 3)))
  152. (newline)
  153. ;; Testing string?
  154. (display "Testing string?\n")
  155. (display (string? #\newline))
  156. (newline)
  157. (display (string? (list 1 2 3)))
  158. (newline)
  159. (display (string? 42))
  160. (newline)
  161. (display (string? '()))
  162. (newline)
  163. (display (string? (cons 1 2)))
  164. (newline)
  165. (display (string? '+))
  166. (newline)
  167. (display (string? 'newline))
  168. (newline)
  169. (display (string? "string"))
  170. (newline)
  171. (display (string? 'foo))
  172. (newline)
  173. (display (string? #(1 2 3)))
  174. (newline)
  175. ;; Testing symbol?
  176. (display "Testing symbol?\n")
  177. (display (symbol? #\newline))
  178. (newline)
  179. (display (symbol? (list 1 2 3)))
  180. (newline)
  181. (display (symbol? 42))
  182. (newline)
  183. (display (symbol? '()))
  184. (newline)
  185. (display (symbol? (cons 1 2)))
  186. (newline)
  187. (display (symbol? '+))
  188. (newline)
  189. (display (symbol? 'newline))
  190. (newline)
  191. (display (symbol? "string"))
  192. (newline)
  193. (display (symbol? 'foo))
  194. (newline)
  195. (display (symbol? #(1 2 3)))
  196. (newline)
  197. ;; Testing vector?
  198. (display "Testing vector?\n")
  199. (display (vector? #\newline))
  200. (newline)
  201. (display (vector? (list 1 2 3)))
  202. (newline)
  203. (display (vector? 42))
  204. (newline)
  205. (display (vector? '()))
  206. (newline)
  207. (display (vector? (cons 1 2)))
  208. (newline)
  209. (display (vector? '+))
  210. (newline)
  211. (display (vector? 'newline))
  212. (newline)
  213. (display (vector? "string"))
  214. (newline)
  215. (display (vector? 'foo))
  216. (newline)
  217. (display (vector? #(1 2 3)))
  218. (newline)
  219. ;; Testing defined?
  220. (display "Testing defined?\n")
  221. (display (defined? 'foo))
  222. (newline)
  223. (define foo 42)
  224. (display (defined? 'foo))
  225. (newline)
  226. (display (defined? 'bar))
  227. (newline)
  228. (define (bar a b) (+ a b))
  229. (display (defined? 'bar))
  230. (newline)
  231. (exit 0)