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