From 2da8ef6de52c3a2b76f898bda0b82b40649f6c79 Mon Sep 17 00:00:00 2001 From: Erik Rauer Date: Thu, 18 Mar 2021 23:11:31 -0500 Subject: [PATCH] Add a test for `string/from-char` This adds a test for the `string/from-char` instruction --- .../push/instructions/string_spec.clj | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/test/propeller/push/instructions/string_spec.clj b/test/propeller/push/instructions/string_spec.clj index 6c2b571..4349e8f 100644 --- a/test/propeller/push/instructions/string_spec.clj +++ b/test/propeller/push/instructions/string_spec.clj @@ -176,6 +176,21 @@ (= expected-result (state/peek-stack end-state :string)))) -(defspec from-char-spec 10 +(defspec from-char-spec 100 (prop/for-all [char gen/char] - (check-from-char char))) \ No newline at end of file + (check-from-char char))) + + +;; string/from-float + +(defn check-from-float + [value] + (let [start-state (state/push-to-stack state/empty-state :float value) + end-state ((:string_from_float @core/instruction-table) start-state) + expected-result (str value)] + (= expected-result + (state/peek-stack end-state :string)))) + +(defspec from-float-spec 100 + (prop/for-all [float gen/double] + (check-from-boolean float))) \ No newline at end of file