From 5412ff6c90f4a21faf5119c3e4d8a67fb8f7709c Mon Sep 17 00:00:00 2001
From: Erik Rauer <eriktr22@gmail.com>
Date: Tue, 5 Jan 2021 15:52:59 -0600
Subject: [PATCH] Add tests for `vector/_take`

This add tests for `vector/_take`.
---
 .../push/instructions/vector_spec.clj          | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/test/propeller/push/instructions/vector_spec.clj b/test/propeller/push/instructions/vector_spec.clj
index 3b92862..b8cb6d4 100644
--- a/test/propeller/push/instructions/vector_spec.clj
+++ b/test/propeller/push/instructions/vector_spec.clj
@@ -431,3 +431,21 @@
        (state/peek-stack end-state stack-type))))
 
 (gen-specs "subvec" check-subvec :vector :integer :integer)
+
+;;; vector/_take
+
+(defn check-take
+  [value-type vect n]
+  (let [stack-type (keyword (str "vector_" value-type))
+        start-state (state/push-to-stack
+                     (state/push-to-stack state/empty-state
+                                          stack-type
+                                          vect)
+                     :integer
+                     n)
+        end-state (vector/_take stack-type start-state)
+        expected-result (vec (take n vect))]
+    (= expected-result
+       (state/peek-stack end-state stack-type))))
+
+(gen-specs "take" check-take :vector :integer)
\ No newline at end of file