test-asmobs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #!/bin/sh
  2. exec guile -q -s "$0" "$@"
  3. !#
  4. (load-extension "libtest-asmobs" "libtest_asmobs_init")
  5. (define (test x v)
  6. (if v
  7. (if (not (equal? (eval x (current-module)) v))
  8. (error "Wrong return value" x))
  9. (catch #t
  10. (lambda ()
  11. (begin (eval x (current-module))
  12. (throw 'should-be-error)))
  13. (lambda (key . args)
  14. (if (eq? key 'should-be-error)
  15. (error "Should be error" x))))))
  16. (define asmob000 (make-asmob000))
  17. (test '(asmob000) '())
  18. (test '(asmob000 1) #f)
  19. (test '(asmob000 1 2) #f)
  20. (test '(asmob000 1 2 3) #f)
  21. (define asmob100 (make-asmob100))
  22. (test '(asmob100) #f)
  23. (test '(asmob100 1) '(1))
  24. (test '(asmob100 1 2) #f)
  25. (test '(asmob100 1 2 3) #f)
  26. (define asmob010 (make-asmob010))
  27. (test '(asmob010) '(#f))
  28. (test '(asmob010 1) '(1))
  29. (test '(asmob010 1 2) #f)
  30. (test '(asmob010 1 2 3) #f)
  31. (define asmob001 (make-asmob001))
  32. (test '(asmob001) '(()))
  33. (test '(asmob001 1) '((1)))
  34. (test '(asmob001 1 2) '((1 2)))
  35. (test '(asmob001 1 2 3) '((1 2 3)))
  36. (define asmob200 (make-asmob200))
  37. (test '(asmob200) #f)
  38. (test '(asmob200 1) #f)
  39. (test '(asmob200 1 2) '(1 2))
  40. (test '(asmob200 1 2 3) #f)
  41. (define asmob110 (make-asmob110))
  42. (test '(asmob110) #f)
  43. (test '(asmob110 1) '(1 #f))
  44. (test '(asmob110 1 2) '(1 2))
  45. (test '(asmob110 1 2 3) #f)
  46. (define asmob020 (make-asmob020))
  47. (test '(asmob020) '(#f #f))
  48. (test '(asmob020 1) '(1 #f))
  49. (test '(asmob020 1 2) '(1 2))
  50. (test '(asmob020 1 2 3) #f)
  51. (define asmob101 (make-asmob101))
  52. (test '(asmob101) #f)
  53. (test '(asmob101 1) '(1 ()))
  54. (test '(asmob101 1 2) '(1 (2)))
  55. (test '(asmob101 1 2 3) '(1 (2 3)))
  56. (define asmob011 (make-asmob011))
  57. (test '(asmob011) '(#f ()))
  58. (test '(asmob011 1) '(1 ()))
  59. (test '(asmob011 1 2) '(1 (2)))
  60. (test '(asmob011 1 2 3) '(1 (2 3)))
  61. (define asmob300 (make-asmob300))
  62. (test '(asmob300) #f)
  63. (test '(asmob300 1) #f)
  64. (test '(asmob300 1 2) #f)
  65. (test '(asmob300 1 2 3) '(1 2 3))
  66. (define asmob210 (make-asmob210))
  67. (test '(asmob210) #f)
  68. (test '(asmob210 1) #f)
  69. (test '(asmob210 1 2) '(1 2 #f))
  70. (test '(asmob210 1 2 3) '(1 2 3))
  71. (define asmob120 (make-asmob120))
  72. (test '(asmob120) #f)
  73. (test '(asmob120 1) '(1 #f #f))
  74. (test '(asmob120 1 2) '(1 2 #f))
  75. (test '(asmob120 1 2 3) '(1 2 3))
  76. (define asmob030 (make-asmob030))
  77. (test '(asmob030) '(#f #f #f))
  78. (test '(asmob030 1) '(1 #f #f))
  79. (test '(asmob030 1 2) '(1 2 #f))
  80. (test '(asmob030 1 2 3) '(1 2 3))
  81. (define asmob201 (make-asmob201))
  82. (test '(asmob201) #f)
  83. (test '(asmob201 1) #f)
  84. (test '(asmob201 1 2) '(1 2 ()))
  85. (test '(asmob201 1 2 3) '(1 2 (3)))
  86. (define asmob021 (make-asmob021))
  87. (test '(asmob021) '(#f #f ()))
  88. (test '(asmob021 1) '(1 #f ()))
  89. (test '(asmob021 1 2) '(1 2 ()))
  90. (test '(asmob021 1 2 3) '(1 2 (3)))
  91. (define asmob111 (make-asmob111))
  92. (test '(asmob111) #f)
  93. (test '(asmob111 1) '(1 #f ()))
  94. (test '(asmob111 1 2) '(1 2 ()))
  95. (test '(asmob111 1 2 3) '(1 2 (3)))
  96. ;; Local Variables:
  97. ;; mode: scheme
  98. ;; End: