From f71760c08f89dfe8e76631b2b0a50abb58a053b6 Mon Sep 17 00:00:00 2001 From: Erik Rauer Date: Wed, 30 Dec 2020 14:47:29 -0600 Subject: [PATCH] Add tests for `vector/_pushall` This adds tests for `vector/_pushall`. --- .../push/instructions/vector_spec.clj | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/propeller/push/instructions/vector_spec.clj b/test/propeller/push/instructions/vector_spec.clj index 59c6a57..6e6bad5 100644 --- a/test/propeller/push/instructions/vector_spec.clj +++ b/test/propeller/push/instructions/vector_spec.clj @@ -251,6 +251,27 @@ (gen-specs "occurrencesof" check-occurrencesof :vector :item) +;;; vector/_pushall + +(defn check-pushall + [value-type vect] + (let [stack-type (keyword (str "vector_" value-type)) + start-state (state/push-to-stack state/empty-state + stack-type + vect) + end-state (vector/_pushall stack-type start-state) + value-stack (keyword value-type) + vect-length (count vect)] + (and + (= + (vec (state/peek-stack-many end-state value-stack vect-length)) + vect) + (state/empty-stack? + (state/pop-stack-many end-state value-stack vect-length) + value-stack)))) + +(gen-specs "pushall" check-pushall :vector) + ;;; vector/_subvec (defn clean-subvec-bounds