From d73b7c6117c3eabf4bdaf0dfcf3cab113f979943 Mon Sep 17 00:00:00 2001 From: Erik Rauer Date: Tue, 16 Mar 2021 22:18:37 -0500 Subject: [PATCH] Add test for `string/concat` This adds a test for the `string/concat` instruction --- test/propeller/push/instructions/string_spec.clj | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/propeller/push/instructions/string_spec.clj b/test/propeller/push/instructions/string_spec.clj index 7f5b76d..dd4c803 100644 --- a/test/propeller/push/instructions/string_spec.clj +++ b/test/propeller/push/instructions/string_spec.clj @@ -25,3 +25,19 @@ (check-butlast s))) +;; string/concat + +(defn check-concat + [value1 value2] + (let [start-state (-> state/empty-state + (state/push-to-stack :string value1) + (state/push-to-stack :string value2)) + end-state ((:string_concat @core/instruction-table) start-state) + expected-result (str value1 value2)] + (= expected-result + (state/peek-stack end-state :string)))) + +(defspec concat-spec 100 + (prop/for-all [s1 gen/string + s2 gen/string] + (check-concat s1 s2))) \ No newline at end of file