test-asmobs 2.9 KB

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