diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/util.go | 11 | ||||
-rw-r--r-- | src/util/util_test.go | 2 |
2 files changed, 5 insertions, 8 deletions
diff --git a/src/util/util.go b/src/util/util.go index a95340e7..113fee91 100644 --- a/src/util/util.go +++ b/src/util/util.go @@ -10,14 +10,11 @@ import ( ) // Max returns the largest integer -func Max(first int, items ...int) int { - max := first - for _, item := range items { - if item > max { - max = item - } +func Max(first int, second int) int { + if first >= second { + return first } - return max + return second } // Min returns the smallest integer diff --git a/src/util/util_test.go b/src/util/util_test.go index 06cfd4f2..d6a03d9d 100644 --- a/src/util/util_test.go +++ b/src/util/util_test.go @@ -3,7 +3,7 @@ package util import "testing" func TestMax(t *testing.T) { - if Max(-2, 5, 1, 4, 3) != 5 { + if Max(-2, 5) != 5 { t.Error("Invalid result") } } |