From 50804b7cb879aee2b513f0d613908e361da3609f Mon Sep 17 00:00:00 2001 From: Erik Rauer Date: Thu, 18 Mar 2021 22:32:11 -0500 Subject: [PATCH] Add test for `string/empty-string` This adds a test for the `string/empty-string` instruction --- .../propeller/push/instructions/string_spec.clj | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/propeller/push/instructions/string_spec.clj b/test/propeller/push/instructions/string_spec.clj index 50ea2de..18af4b2 100644 --- a/test/propeller/push/instructions/string_spec.clj +++ b/test/propeller/push/instructions/string_spec.clj @@ -113,4 +113,19 @@ (defspec drop-spec 100 (prop/for-all [str gen/string int gen/small-integer] - (check-drop str int))) \ No newline at end of file + (check-drop str int))) + + +;; string/empty-string + +(defn check-empty-string + [value] + (let [start-state (state/push-to-stack state/empty-state :string value) + end-state ((:string_empty_string @core/instruction-table) start-state) + expected-result (empty? value)] + (= expected-result + (state/peek-stack end-state :boolean)))) + +(defspec empty-string-spec 100 + (prop/for-all [str gen/string] + (check-empty-string str))) \ No newline at end of file