From b8a011c385ebabb1afe677a422fea426005395e6 Mon Sep 17 00:00:00 2001 From: Erik Rauer Date: Thu, 18 Mar 2021 23:16:41 -0500 Subject: [PATCH] Add a test for `string/from-float` This adds a test for the `string/from-float` 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 4349e8f..c32ae2c 100644 --- a/test/propeller/push/instructions/string_spec.clj +++ b/test/propeller/push/instructions/string_spec.clj @@ -193,4 +193,19 @@ (defspec from-float-spec 100 (prop/for-all [float gen/double] - (check-from-boolean float))) \ No newline at end of file + (check-from-float float))) + + +;; string/from-integer + +(defn check-from-integer + [value] + (let [start-state (state/push-to-stack state/empty-state :integer value) + end-state ((:string_from_integer @core/instruction-table) start-state) + expected-result (str value)] + (= expected-result + (state/peek-stack end-state :string)))) + +(defspec from-integer-spec 100 + (prop/for-all [int gen/small-integer] + (check-from-integer int))) \ No newline at end of file