Add test for string/concat
This adds a test for the `string/concat` instruction
This commit is contained in:
parent
e21ca24d9d
commit
d73b7c6117
@ -25,3 +25,19 @@
|
|||||||
(check-butlast s)))
|
(check-butlast s)))
|
||||||
|
|
||||||
|
|
||||||
|
;; string/concat
|
||||||
|
|
||||||
|
(defn check-concat
|
||||||
|
[value1 value2]
|
||||||
|
(let [start-state (-> state/empty-state
|
||||||
|
(state/push-to-stack :string value1)
|
||||||
|
(state/push-to-stack :string value2))
|
||||||
|
end-state ((:string_concat @core/instruction-table) start-state)
|
||||||
|
expected-result (str value1 value2)]
|
||||||
|
(= expected-result
|
||||||
|
(state/peek-stack end-state :string))))
|
||||||
|
|
||||||
|
(defspec concat-spec 100
|
||||||
|
(prop/for-all [s1 gen/string
|
||||||
|
s2 gen/string]
|
||||||
|
(check-concat s1 s2)))
|
Loading…
x
Reference in New Issue
Block a user