From 196f39ccb6f86870bff7cf2ee48c174cd7fe531a Mon Sep 17 00:00:00 2001 From: Erik Rauer Date: Thu, 18 Mar 2021 23:01:09 -0500 Subject: [PATCH] Add a test for `string/from-boolean` This adds a test for the `string/from-boolean` 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 e9e0f6a..1f29a4f 100644 --- a/test/propeller/push/instructions/string_spec.clj +++ b/test/propeller/push/instructions/string_spec.clj @@ -148,4 +148,19 @@ (defspec first-spec 100 (prop/for-all [str gen/string] - (check-first str))) \ No newline at end of file + (check-first str))) + + +;; string/from-boolean + +(defn check-from-boolean + [value] + (let [start-state (state/push-to-stack state/empty-state :boolean value) + end-state ((:string_from_boolean @core/instruction-table) start-state) + expected-result (str value)] + (= expected-result + (state/peek-stack end-state :string)))) + +(defspec from-boolean-spec 10 + (prop/for-all [bool gen/boolean] + (check-from-boolean bool))) \ No newline at end of file