diff --git a/test/propeller/push/instructions/string_spec.clj b/test/propeller/push/instructions/string_spec.clj index 07c9f48..0a52ecf 100644 --- a/test/propeller/push/instructions/string_spec.clj +++ b/test/propeller/push/instructions/string_spec.clj @@ -246,4 +246,19 @@ (defspec last-spec 100 (prop/for-all [str gen/string] - (check-last str))) \ No newline at end of file + (check-last str))) + + +;; string/length + +(defn check-length + [value] + (let [start-state (state/push-to-stack state/empty-state :string value) + end-state ((:string_length @core/instruction-table) start-state) + expected-result (count value)] + (= expected-result + (state/peek-stack end-state :integer)))) + +(defspec length-spec 100 + (prop/for-all [str gen/string] + (check-length str))) \ No newline at end of file