From 5e87478cebf951fe7cca876261a3a2325982842c Mon Sep 17 00:00:00 2001 From: Erik Rauer Date: Tue, 29 Dec 2020 14:43:39 -0600 Subject: [PATCH] Add tests for `vector/_butlast` This adds tests for `vector/_butlast`. --- test/propeller/push/instructions/vector_spec.clj | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/propeller/push/instructions/vector_spec.clj b/test/propeller/push/instructions/vector_spec.clj index 697d627..c6245a9 100644 --- a/test/propeller/push/instructions/vector_spec.clj +++ b/test/propeller/push/instructions/vector_spec.clj @@ -42,6 +42,21 @@ arg-types)] (~check-fn ~value-type ~@symbol-names))))))) +;;; vector/_butlast + +(defn check-butlast + [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/_butlast stack-type start-state) + expected-result (vec (butlast vect))] + (= expected-result + (state/peek-stack end-state stack-type)))) + +(gen-specs "butlast" check-butlast :vector) + ;;; vector/_contains (defn check-contains