From cd847affb79ea6438c9721635724efc6f58e2215 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 12 Jan 2015 12:56:17 +0900 Subject: Reorganize source code --- src/util/util_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/util/util_test.go (limited to 'src/util/util_test.go') diff --git a/src/util/util_test.go b/src/util/util_test.go new file mode 100644 index 00000000..06cfd4f2 --- /dev/null +++ b/src/util/util_test.go @@ -0,0 +1,22 @@ +package util + +import "testing" + +func TestMax(t *testing.T) { + if Max(-2, 5, 1, 4, 3) != 5 { + t.Error("Invalid result") + } +} + +func TestContrain(t *testing.T) { + if Constrain(-3, -1, 3) != -1 { + t.Error("Expected", -1) + } + if Constrain(2, -1, 3) != 2 { + t.Error("Expected", 2) + } + + if Constrain(5, -1, 3) != 3 { + t.Error("Expected", 3) + } +} -- cgit v1.2.3