Add test for string/empty-string
This adds a test for the `string/empty-string` instruction
This commit is contained in:
parent
278fe26aab
commit
50804b7cb8
@ -114,3 +114,18 @@
|
|||||||
(prop/for-all [str gen/string
|
(prop/for-all [str gen/string
|
||||||
int gen/small-integer]
|
int gen/small-integer]
|
||||||
(check-drop str int)))
|
(check-drop str int)))
|
||||||
|
|
||||||
|
|
||||||
|
;; string/empty-string
|
||||||
|
|
||||||
|
(defn check-empty-string
|
||||||
|
[value]
|
||||||
|
(let [start-state (state/push-to-stack state/empty-state :string value)
|
||||||
|
end-state ((:string_empty_string @core/instruction-table) start-state)
|
||||||
|
expected-result (empty? value)]
|
||||||
|
(= expected-result
|
||||||
|
(state/peek-stack end-state :boolean))))
|
||||||
|
|
||||||
|
(defspec empty-string-spec 100
|
||||||
|
(prop/for-all [str gen/string]
|
||||||
|
(check-empty-string str)))
|
Loading…
x
Reference in New Issue
Block a user