summaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/github.com/nfnt/resize/converter_test.go
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2015-06-14 23:53:32 -0800
committer=Corey Hulen <corey@hulen.com>2015-06-14 23:53:32 -0800
commit56e74239d6b34df8f30ef046f0b0ff4ff0866a71 (patch)
tree044da29848cf0f5c8607eac34de69065171669cf /Godeps/_workspace/src/github.com/nfnt/resize/converter_test.go
downloadchat-56e74239d6b34df8f30ef046f0b0ff4ff0866a71.tar.gz
chat-56e74239d6b34df8f30ef046f0b0ff4ff0866a71.tar.bz2
chat-56e74239d6b34df8f30ef046f0b0ff4ff0866a71.zip
first commit
Diffstat (limited to 'Godeps/_workspace/src/github.com/nfnt/resize/converter_test.go')
-rw-r--r--Godeps/_workspace/src/github.com/nfnt/resize/converter_test.go43
1 files changed, 43 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/nfnt/resize/converter_test.go b/Godeps/_workspace/src/github.com/nfnt/resize/converter_test.go
new file mode 100644
index 000000000..85639efc2
--- /dev/null
+++ b/Godeps/_workspace/src/github.com/nfnt/resize/converter_test.go
@@ -0,0 +1,43 @@
+package resize
+
+import (
+ "testing"
+)
+
+func Test_ClampUint8(t *testing.T) {
+ var testData = []struct {
+ in int32
+ expected uint8
+ }{
+ {0, 0},
+ {255, 255},
+ {128, 128},
+ {-2, 0},
+ {256, 255},
+ }
+ for _, test := range testData {
+ actual := clampUint8(test.in)
+ if actual != test.expected {
+ t.Fail()
+ }
+ }
+}
+
+func Test_ClampUint16(t *testing.T) {
+ var testData = []struct {
+ in int64
+ expected uint16
+ }{
+ {0, 0},
+ {65535, 65535},
+ {128, 128},
+ {-2, 0},
+ {65536, 65535},
+ }
+ for _, test := range testData {
+ actual := clampUint16(test.in)
+ if actual != test.expected {
+ t.Fail()
+ }
+ }
+}