diff --git a/test/propeller/push/instructions/string_spec.clj b/test/propeller/push/instructions/string_spec.clj index 18af4b2..e9e0f6a 100644 --- a/test/propeller/push/instructions/string_spec.clj +++ b/test/propeller/push/instructions/string_spec.clj @@ -128,4 +128,24 @@ (defspec empty-string-spec 100 (prop/for-all [str gen/string] - (check-empty-string str))) \ No newline at end of file + (check-empty-string str))) + + +;; string/first + +(defn check-first + [value] + (let [start-state (state/push-to-stack state/empty-state :string value) + end-state ((:string_first @core/instruction-table) start-state) + expected-result (first value)] + (or + (and (empty? value) + (= (state/peek-stack end-state :string) value) + (state/empty-stack? end-state :char)) + (and (= expected-result + (state/peek-stack end-state :char)) + (state/empty-stack? end-state :string))))) + +(defspec first-spec 100 + (prop/for-all [str gen/string] + (check-first str))) \ No newline at end of file