Compare commits

..

5 Commits

  1. 6
      src/rustint/core.clj
  2. 18
      test/rustint/core_test.clj

@ -2163,6 +2163,10 @@
; user=> (compatibles? 'char ['a])
; true
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn usize? [arg]
(and (> arg 0) (integer? arg))
)
(defn compatibles? [rtype arg]
(let [rtypes (
hash-map
@ -2170,6 +2174,8 @@
'f64 float?,
'String string?,
'bool boolean?
'usize usize?,
'char char?
), func (get rtypes rtype)]
(or (vector? arg) (func arg))
)

@ -109,3 +109,21 @@
(is (= (compatibles? 'usize 1) true))
)
)
(deftest compatibles-test09
(testing "Test 09 compatibles?"
(is (= (compatibles? 'char \a) true))
)
)
(deftest compatibles-test10
(testing "Test 10 compatibles?"
(is (= (compatibles? 'char 'a) false))
)
)
(deftest compatibles-test11
(testing "Test 11 compatibles?"
(is (= (compatibles? 'char ['a]) true))
)
)

Loading…
Cancel
Save