summaryrefslogtreecommitdiff
path: root/src/util/util_test.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-01-12 12:56:17 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-01-12 12:56:17 +0900
commitcd847affb79ea6438c9721635724efc6f58e2215 (patch)
treed1e631e3dca8832ee4c495924789f6697c3629cf /src/util/util_test.go
parent7a2bc2cada971c7a390d09b0afda34780ff56fb6 (diff)
downloadfzf-cd847affb79ea6438c9721635724efc6f58e2215.tar.gz
Reorganize source code
Diffstat (limited to 'src/util/util_test.go')
-rw-r--r--src/util/util_test.go22
1 files changed, 22 insertions, 0 deletions
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)
+ }
+}