Add a test for string/replace-char
This adds a test for the `string/replace-char` instruction
This commit is contained in:
parent
95cad31e7b
commit
3fb35d7d47
@ -369,3 +369,23 @@
|
||||
str2 gen/string
|
||||
str3 gen/string]
|
||||
(check-replace str1 str2 str3)))
|
||||
|
||||
|
||||
;; string/replace-char
|
||||
|
||||
(defn check-replace-char
|
||||
[value char1 char2]
|
||||
(let [start-state (-> state/empty-state
|
||||
(state/push-to-stack :string value)
|
||||
(state/push-to-stack :char char1)
|
||||
(state/push-to-stack :char char2))
|
||||
end-state ((:string_replace_char @core/instruction-table) start-state)
|
||||
expected-result (string/replace value char1 char2)]
|
||||
(= expected-result
|
||||
(state/peek-stack end-state :string))))
|
||||
|
||||
(defspec replace-char-spec 100
|
||||
(prop/for-all [str gen/string
|
||||
char1 gen/char
|
||||
char2 gen/char]
|
||||
(check-replace str char1 char2)))
|
Loading…
x
Reference in New Issue
Block a user