Add a test for string/reverse
This adds a test for the `string/reverse` instruction
This commit is contained in:
parent
7e780567ec
commit
711fc20f01
@ -444,3 +444,18 @@
|
||||
(defspec rest-spec 100
|
||||
(prop/for-all [str gen/string]
|
||||
(check-rest str)))
|
||||
|
||||
|
||||
;; string/reverse
|
||||
|
||||
(defn check-reverse
|
||||
[value]
|
||||
(let [start-state (state/push-to-stack state/empty-state :string value)
|
||||
end-state ((:string_reverse @core/instruction-table) start-state)
|
||||
expected-result (apply str (reverse value))]
|
||||
(= expected-result
|
||||
(state/peek-stack end-state :string))))
|
||||
|
||||
(defspec reverse-spec 100
|
||||
(prop/for-all [str gen/string]
|
||||
(check-reverse str)))
|
Loading…
x
Reference in New Issue
Block a user