summaryrefslogtreecommitdiff
path: root/test/integration/math.bats
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2017-10-14 13:51:01 -0400
committerDave Henderson <dhenderson@gmail.com>2017-10-30 22:18:37 -0400
commit90ca86ec9c3db804ac32ef942fa04a0aa8c133e7 (patch)
tree5295f93799d77f8fc0eb5ed3199fd41b858b0d6e /test/integration/math.bats
parent4e626fdfc870c212c73e5b9494f63888e570f8ac (diff)
Adding math functions
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'test/integration/math.bats')
-rw-r--r--test/integration/math.bats39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/integration/math.bats b/test/integration/math.bats
new file mode 100644
index 00000000..0756485d
--- /dev/null
+++ b/test/integration/math.bats
@@ -0,0 +1,39 @@
+#!/usr/bin/env bats
+
+load helper
+
+@test "'math.Add'" {
+ gomplate -i '{{ math.Add 1 2 3 4 }} {{ add -5 5 }}'
+ [ "$status" -eq 0 ]
+ [[ "${output}" == "10 0" ]]
+}
+
+@test "'math.Sub'" {
+ gomplate -i '{{ math.Sub 10 5 }} {{ sub -5 5 }}'
+ [ "$status" -eq 0 ]
+ [[ "${output}" == "5 -10" ]]
+}
+
+@test "'math.Mul'" {
+ gomplate -i '{{ math.Mul 1 2 3 4 }} {{ mul -5 5 }}'
+ [ "$status" -eq 0 ]
+ [[ "${output}" == "24 -25" ]]
+}
+
+@test "'math.Div'" {
+ gomplate -i '{{ math.Div 5 3 }} {{ div -5 5 }}'
+ [ "$status" -eq 0 ]
+ [[ "${output}" == "1 -1" ]]
+}
+
+@test "'math.Rem'" {
+ gomplate -i '{{ math.Rem 5 3 }} {{ rem 2 2 }}'
+ [ "$status" -eq 0 ]
+ [[ "${output}" == "2 0" ]]
+}
+
+@test "'math.Pow'" {
+ gomplate -i '{{ math.Pow 8 4 }} {{ pow 2 2 }}'
+ [ "$status" -eq 0 ]
+ [[ "${output}" == "4096 4" ]]
+} \ No newline at end of file