Add a test for string/from-boolean
This adds a test for the `string/from-boolean` instruction
This commit is contained in:
parent
39a25fa7e3
commit
196f39ccb6
@ -148,4 +148,19 @@
|
|||||||
|
|
||||||
(defspec first-spec 100
|
(defspec first-spec 100
|
||||||
(prop/for-all [str gen/string]
|
(prop/for-all [str gen/string]
|
||||||
(check-first str)))
|
(check-first str)))
|
||||||
|
|
||||||
|
|
||||||
|
;; string/from-boolean
|
||||||
|
|
||||||
|
(defn check-from-boolean
|
||||||
|
[value]
|
||||||
|
(let [start-state (state/push-to-stack state/empty-state :boolean value)
|
||||||
|
end-state ((:string_from_boolean @core/instruction-table) start-state)
|
||||||
|
expected-result (str value)]
|
||||||
|
(= expected-result
|
||||||
|
(state/peek-stack end-state :string))))
|
||||||
|
|
||||||
|
(defspec from-boolean-spec 10
|
||||||
|
(prop/for-all [bool gen/boolean]
|
||||||
|
(check-from-boolean bool)))
|
Loading…
x
Reference in New Issue
Block a user