diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2018-09-12 19:39:36 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2018-09-12 19:39:36 +1000 |
commit | 3b765e5417501a39bca5c2f0038488dbbeb6b200 (patch) | |
tree | 374ed2c6ca0d550f6d6363bcc1b7ffdc75b9dca8 /pkg/utils | |
parent | 57f6a552d2b69b582b383dfa45817dbccd76c9d6 (diff) |
add test for min method
Diffstat (limited to 'pkg/utils')
-rw-r--r-- | pkg/utils/utils_test.go | 30 |
1 files changed, 30 insertions, 0 deletions
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)) + } +} |