Update the test for string/length
Changes the test for the `string/length` instruction to check for an `:ignore-instruction` when the string is empty.
This commit is contained in:
parent
7aad934b96
commit
da117c2f08
@ -241,8 +241,13 @@
|
|||||||
(let [start-state (state/push-to-stack state/empty-state :string value)
|
(let [start-state (state/push-to-stack state/empty-state :string value)
|
||||||
end-state ((:string_last @core/instruction-table) start-state)
|
end-state ((:string_last @core/instruction-table) start-state)
|
||||||
expected-result (last value)]
|
expected-result (last value)]
|
||||||
|
(or
|
||||||
|
(and (empty? value)
|
||||||
|
(state/empty-stack? end-state :char)
|
||||||
|
(= value (state/peek-stack end-state :string)))
|
||||||
|
(and (state/empty-stack? end-state :string)
|
||||||
(= expected-result
|
(= expected-result
|
||||||
(state/peek-stack end-state :char))))
|
(state/peek-stack end-state :char))))))
|
||||||
|
|
||||||
(defspec last-spec 100
|
(defspec last-spec 100
|
||||||
(prop/for-all [str gen/string]
|
(prop/for-all [str gen/string]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user