From 3b765e5417501a39bca5c2f0038488dbbeb6b200 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 12 Sep 2018 19:39:36 +1000 Subject: [PATCH] add test for min method --- pkg/utils/utils_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/pkg/utils/utils_test.go b/pkg/utils/utils_test.go index 0b2d35959..a088ed849 100644 --- a/pkg/utils/utils_test.go +++ b/pkg/utils/utils_test.go @@ -167,3 +167,33 @@ func TestResolvePlaceholderString(t *testing.T) { assert.EqualValues(t, string(s.expected), ResolvePlaceholderString(s.templateString, s.arguments)) } } + +func TestMin(t *testing.T) { + type scenario struct { + a int + b int + expected int + } + + scenarios := []scenario{ + { + 2, + 4, + 2, + }, + { + 2, + 1, + 1, + }, + { + 1, + 1, + 1, + }, + } + + for _, s := range scenarios { + assert.EqualValues(t, s.expected, Min(s.a, s.b)) + } +}