From 962b18411893e1fffd10c2b6370ac34aba62f146 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Tue, 23 Feb 2016 14:07:01 -0500 Subject: Updating golang dependancies (godep) --- Godeps/_workspace/src/golang.org/x/crypto/LICENSE | 27 ++ Godeps/_workspace/src/golang.org/x/crypto/PATENTS | 22 ++ .../src/golang.org/x/crypto/bcrypt/bcrypt_test.go | 226 ------------ .../golang.org/x/crypto/blowfish/blowfish_test.go | 274 --------------- Godeps/_workspace/src/golang.org/x/image/LICENSE | 27 ++ Godeps/_workspace/src/golang.org/x/image/PATENTS | 22 ++ .../src/golang.org/x/image/bmp/reader_test.go | 75 ---- .../src/golang.org/x/image/bmp/writer_test.go | 91 ----- .../x/image/font/plan9font/example_test.go | 93 ----- .../x/image/font/testdata/fixed/7x13.0000 | Bin 3136 -> 0 bytes .../x/image/font/testdata/fixed/7x13.0100 | Bin 3908 -> 0 bytes .../x/image/font/testdata/fixed/7x13.0200 | Bin 3095 -> 0 bytes .../x/image/font/testdata/fixed/7x13.0300 | Bin 2631 -> 0 bytes .../x/image/font/testdata/fixed/7x13.0400 | Bin 3623 -> 0 bytes .../x/image/font/testdata/fixed/7x13.0500 | Bin 2492 -> 0 bytes .../x/image/font/testdata/fixed/7x13.0E00 | Bin 1235 -> 0 bytes .../x/image/font/testdata/fixed/7x13.1000 | Bin 2354 -> 0 bytes .../x/image/font/testdata/fixed/7x13.1600 | Bin 1825 -> 0 bytes .../x/image/font/testdata/fixed/7x13.1E00 | Bin 3713 -> 0 bytes .../x/image/font/testdata/fixed/7x13.1F00 | Bin 3012 -> 0 bytes .../x/image/font/testdata/fixed/7x13.2000 | Bin 2310 -> 0 bytes .../x/image/font/testdata/fixed/7x13.2100 | Bin 3206 -> 0 bytes .../x/image/font/testdata/fixed/7x13.2200 | Bin 3532 -> 0 bytes .../x/image/font/testdata/fixed/7x13.2300 | Bin 1613 -> 0 bytes .../x/image/font/testdata/fixed/7x13.2400 | Bin 1013 -> 0 bytes .../x/image/font/testdata/fixed/7x13.2500 | Bin 2747 -> 0 bytes .../x/image/font/testdata/fixed/7x13.2600 | Bin 1765 -> 0 bytes .../x/image/font/testdata/fixed/7x13.2700 | Bin 1762 -> 0 bytes .../x/image/font/testdata/fixed/7x13.2800 | Bin 1918 -> 0 bytes .../x/image/font/testdata/fixed/7x13.2A00 | Bin 620 -> 0 bytes .../x/image/font/testdata/fixed/7x13.3000 | Bin 569 -> 0 bytes .../x/image/font/testdata/fixed/7x13.FB00 | Bin 912 -> 0 bytes .../x/image/font/testdata/fixed/7x13.FE00 | Bin 387 -> 0 bytes .../x/image/font/testdata/fixed/7x13.FF00 | Bin 1687 -> 0 bytes .../golang.org/x/image/font/testdata/fixed/README | 9 - .../x/image/font/testdata/fixed/unicode.7x13.font | 68 ---- .../golang.org/x/image/math/fixed/fixed_test.go | 25 -- .../src/golang.org/x/image/tiff/buffer_test.go | 36 -- .../src/golang.org/x/image/tiff/reader_test.go | 377 --------------------- .../src/golang.org/x/image/tiff/writer_test.go | 95 ------ 40 files changed, 98 insertions(+), 1369 deletions(-) create mode 100644 Godeps/_workspace/src/golang.org/x/crypto/LICENSE create mode 100644 Godeps/_workspace/src/golang.org/x/crypto/PATENTS delete mode 100644 Godeps/_workspace/src/golang.org/x/crypto/bcrypt/bcrypt_test.go delete mode 100644 Godeps/_workspace/src/golang.org/x/crypto/blowfish/blowfish_test.go create mode 100644 Godeps/_workspace/src/golang.org/x/image/LICENSE create mode 100644 Godeps/_workspace/src/golang.org/x/image/PATENTS delete mode 100644 Godeps/_workspace/src/golang.org/x/image/bmp/reader_test.go delete mode 100644 Godeps/_workspace/src/golang.org/x/image/bmp/writer_test.go delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/plan9font/example_test.go delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0000 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0100 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0200 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0300 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0400 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0500 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0E00 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.1000 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.1600 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.1E00 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.1F00 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2000 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2100 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2200 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2300 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2400 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2500 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2600 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2700 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2800 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2A00 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.3000 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.FB00 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.FE00 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.FF00 delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/README delete mode 100644 Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/unicode.7x13.font delete mode 100644 Godeps/_workspace/src/golang.org/x/image/math/fixed/fixed_test.go delete mode 100644 Godeps/_workspace/src/golang.org/x/image/tiff/buffer_test.go delete mode 100644 Godeps/_workspace/src/golang.org/x/image/tiff/reader_test.go delete mode 100644 Godeps/_workspace/src/golang.org/x/image/tiff/writer_test.go (limited to 'Godeps/_workspace/src/golang.org/x') diff --git a/Godeps/_workspace/src/golang.org/x/crypto/LICENSE b/Godeps/_workspace/src/golang.org/x/crypto/LICENSE new file mode 100644 index 000000000..6a66aea5e --- /dev/null +++ b/Godeps/_workspace/src/golang.org/x/crypto/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Godeps/_workspace/src/golang.org/x/crypto/PATENTS b/Godeps/_workspace/src/golang.org/x/crypto/PATENTS new file mode 100644 index 000000000..733099041 --- /dev/null +++ b/Godeps/_workspace/src/golang.org/x/crypto/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/Godeps/_workspace/src/golang.org/x/crypto/bcrypt/bcrypt_test.go b/Godeps/_workspace/src/golang.org/x/crypto/bcrypt/bcrypt_test.go deleted file mode 100644 index f08a6f5b2..000000000 --- a/Godeps/_workspace/src/golang.org/x/crypto/bcrypt/bcrypt_test.go +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bcrypt - -import ( - "bytes" - "fmt" - "testing" -) - -func TestBcryptingIsEasy(t *testing.T) { - pass := []byte("mypassword") - hp, err := GenerateFromPassword(pass, 0) - if err != nil { - t.Fatalf("GenerateFromPassword error: %s", err) - } - - if CompareHashAndPassword(hp, pass) != nil { - t.Errorf("%v should hash %s correctly", hp, pass) - } - - notPass := "notthepass" - err = CompareHashAndPassword(hp, []byte(notPass)) - if err != ErrMismatchedHashAndPassword { - t.Errorf("%v and %s should be mismatched", hp, notPass) - } -} - -func TestBcryptingIsCorrect(t *testing.T) { - pass := []byte("allmine") - salt := []byte("XajjQvNhvvRt5GSeFk1xFe") - expectedHash := []byte("$2a$10$XajjQvNhvvRt5GSeFk1xFeyqRrsxkhBkUiQeg0dt.wU1qD4aFDcga") - - hash, err := bcrypt(pass, 10, salt) - if err != nil { - t.Fatalf("bcrypt blew up: %v", err) - } - if !bytes.HasSuffix(expectedHash, hash) { - t.Errorf("%v should be the suffix of %v", hash, expectedHash) - } - - h, err := newFromHash(expectedHash) - if err != nil { - t.Errorf("Unable to parse %s: %v", string(expectedHash), err) - } - - // This is not the safe way to compare these hashes. We do this only for - // testing clarity. Use bcrypt.CompareHashAndPassword() - if err == nil && !bytes.Equal(expectedHash, h.Hash()) { - t.Errorf("Parsed hash %v should equal %v", h.Hash(), expectedHash) - } -} - -func TestVeryShortPasswords(t *testing.T) { - key := []byte("k") - salt := []byte("XajjQvNhvvRt5GSeFk1xFe") - _, err := bcrypt(key, 10, salt) - if err != nil { - t.Errorf("One byte key resulted in error: %s", err) - } -} - -func TestTooLongPasswordsWork(t *testing.T) { - salt := []byte("XajjQvNhvvRt5GSeFk1xFe") - // One byte over the usual 56 byte limit that blowfish has - tooLongPass := []byte("012345678901234567890123456789012345678901234567890123456") - tooLongExpected := []byte("$2a$10$XajjQvNhvvRt5GSeFk1xFe5l47dONXg781AmZtd869sO8zfsHuw7C") - hash, err := bcrypt(tooLongPass, 10, salt) - if err != nil { - t.Fatalf("bcrypt blew up on long password: %v", err) - } - if !bytes.HasSuffix(tooLongExpected, hash) { - t.Errorf("%v should be the suffix of %v", hash, tooLongExpected) - } -} - -type InvalidHashTest struct { - err error - hash []byte -} - -var invalidTests = []InvalidHashTest{ - {ErrHashTooShort, []byte("$2a$10$fooo")}, - {ErrHashTooShort, []byte("$2a")}, - {HashVersionTooNewError('3'), []byte("$3a$10$sssssssssssssssssssssshhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh")}, - {InvalidHashPrefixError('%'), []byte("%2a$10$sssssssssssssssssssssshhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh")}, - {InvalidCostError(32), []byte("$2a$32$sssssssssssssssssssssshhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh")}, -} - -func TestInvalidHashErrors(t *testing.T) { - check := func(name string, expected, err error) { - if err == nil { - t.Errorf("%s: Should have returned an error", name) - } - if err != nil && err != expected { - t.Errorf("%s gave err %v but should have given %v", name, err, expected) - } - } - for _, iht := range invalidTests { - _, err := newFromHash(iht.hash) - check("newFromHash", iht.err, err) - err = CompareHashAndPassword(iht.hash, []byte("anything")) - check("CompareHashAndPassword", iht.err, err) - } -} - -func TestUnpaddedBase64Encoding(t *testing.T) { - original := []byte{101, 201, 101, 75, 19, 227, 199, 20, 239, 236, 133, 32, 30, 109, 243, 30} - encodedOriginal := []byte("XajjQvNhvvRt5GSeFk1xFe") - - encoded := base64Encode(original) - - if !bytes.Equal(encodedOriginal, encoded) { - t.Errorf("Encoded %v should have equaled %v", encoded, encodedOriginal) - } - - decoded, err := base64Decode(encodedOriginal) - if err != nil { - t.Fatalf("base64Decode blew up: %s", err) - } - - if !bytes.Equal(decoded, original) { - t.Errorf("Decoded %v should have equaled %v", decoded, original) - } -} - -func TestCost(t *testing.T) { - suffix := "XajjQvNhvvRt5GSeFk1xFe5l47dONXg781AmZtd869sO8zfsHuw7C" - for _, vers := range []string{"2a", "2"} { - for _, cost := range []int{4, 10} { - s := fmt.Sprintf("$%s$%02d$%s", vers, cost, suffix) - h := []byte(s) - actual, err := Cost(h) - if err != nil { - t.Errorf("Cost, error: %s", err) - continue - } - if actual != cost { - t.Errorf("Cost, expected: %d, actual: %d", cost, actual) - } - } - } - _, err := Cost([]byte("$a$a$" + suffix)) - if err == nil { - t.Errorf("Cost, malformed but no error returned") - } -} - -func TestCostValidationInHash(t *testing.T) { - if testing.Short() { - return - } - - pass := []byte("mypassword") - - for c := 0; c < MinCost; c++ { - p, _ := newFromPassword(pass, c) - if p.cost != DefaultCost { - t.Errorf("newFromPassword should default costs below %d to %d, but was %d", MinCost, DefaultCost, p.cost) - } - } - - p, _ := newFromPassword(pass, 14) - if p.cost != 14 { - t.Errorf("newFromPassword should default cost to 14, but was %d", p.cost) - } - - hp, _ := newFromHash(p.Hash()) - if p.cost != hp.cost { - t.Errorf("newFromHash should maintain the cost at %d, but was %d", p.cost, hp.cost) - } - - _, err := newFromPassword(pass, 32) - if err == nil { - t.Fatalf("newFromPassword: should return a cost error") - } - if err != InvalidCostError(32) { - t.Errorf("newFromPassword: should return cost error, got %#v", err) - } -} - -func TestCostReturnsWithLeadingZeroes(t *testing.T) { - hp, _ := newFromPassword([]byte("abcdefgh"), 7) - cost := hp.Hash()[4:7] - expected := []byte("07$") - - if !bytes.Equal(expected, cost) { - t.Errorf("single digit costs in hash should have leading zeros: was %v instead of %v", cost, expected) - } -} - -func TestMinorNotRequired(t *testing.T) { - noMinorHash := []byte("$2$10$XajjQvNhvvRt5GSeFk1xFeyqRrsxkhBkUiQeg0dt.wU1qD4aFDcga") - h, err := newFromHash(noMinorHash) - if err != nil { - t.Fatalf("No minor hash blew up: %s", err) - } - if h.minor != 0 { - t.Errorf("Should leave minor version at 0, but was %d", h.minor) - } - - if !bytes.Equal(noMinorHash, h.Hash()) { - t.Errorf("Should generate hash %v, but created %v", noMinorHash, h.Hash()) - } -} - -func BenchmarkEqual(b *testing.B) { - b.StopTimer() - passwd := []byte("somepasswordyoulike") - hash, _ := GenerateFromPassword(passwd, 10) - b.StartTimer() - for i := 0; i < b.N; i++ { - CompareHashAndPassword(hash, passwd) - } -} - -func BenchmarkGeneration(b *testing.B) { - b.StopTimer() - passwd := []byte("mylongpassword1234") - b.StartTimer() - for i := 0; i < b.N; i++ { - GenerateFromPassword(passwd, 10) - } -} diff --git a/Godeps/_workspace/src/golang.org/x/crypto/blowfish/blowfish_test.go b/Godeps/_workspace/src/golang.org/x/crypto/blowfish/blowfish_test.go deleted file mode 100644 index 7afa1fdf3..000000000 --- a/Godeps/_workspace/src/golang.org/x/crypto/blowfish/blowfish_test.go +++ /dev/null @@ -1,274 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package blowfish - -import "testing" - -type CryptTest struct { - key []byte - in []byte - out []byte -} - -// Test vector values are from http://www.schneier.com/code/vectors.txt. -var encryptTests = []CryptTest{ - { - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x4E, 0xF9, 0x97, 0x45, 0x61, 0x98, 0xDD, 0x78}}, - { - []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, - []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, - []byte{0x51, 0x86, 0x6F, 0xD5, 0xB8, 0x5E, 0xCB, 0x8A}}, - { - []byte{0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, - []byte{0x7D, 0x85, 0x6F, 0x9A, 0x61, 0x30, 0x63, 0xF2}}, - { - []byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}, - []byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}, - []byte{0x24, 0x66, 0xDD, 0x87, 0x8B, 0x96, 0x3C, 0x9D}}, - - { - []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}, - []byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}, - []byte{0x61, 0xF9, 0xC3, 0x80, 0x22, 0x81, 0xB0, 0x96}}, - { - []byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}, - []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}, - []byte{0x7D, 0x0C, 0xC6, 0x30, 0xAF, 0xDA, 0x1E, 0xC7}}, - { - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x4E, 0xF9, 0x97, 0x45, 0x61, 0x98, 0xDD, 0x78}}, - { - []byte{0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10}, - []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}, - []byte{0x0A, 0xCE, 0xAB, 0x0F, 0xC6, 0xA0, 0xA2, 0x8D}}, - { - []byte{0x7C, 0xA1, 0x10, 0x45, 0x4A, 0x1A, 0x6E, 0x57}, - []byte{0x01, 0xA1, 0xD6, 0xD0, 0x39, 0x77, 0x67, 0x42}, - []byte{0x59, 0xC6, 0x82, 0x45, 0xEB, 0x05, 0x28, 0x2B}}, - { - []byte{0x01, 0x31, 0xD9, 0x61, 0x9D, 0xC1, 0x37, 0x6E}, - []byte{0x5C, 0xD5, 0x4C, 0xA8, 0x3D, 0xEF, 0x57, 0xDA}, - []byte{0xB1, 0xB8, 0xCC, 0x0B, 0x25, 0x0F, 0x09, 0xA0}}, - { - []byte{0x07, 0xA1, 0x13, 0x3E, 0x4A, 0x0B, 0x26, 0x86}, - []byte{0x02, 0x48, 0xD4, 0x38, 0x06, 0xF6, 0x71, 0x72}, - []byte{0x17, 0x30, 0xE5, 0x77, 0x8B, 0xEA, 0x1D, 0xA4}}, - { - []byte{0x38, 0x49, 0x67, 0x4C, 0x26, 0x02, 0x31, 0x9E}, - []byte{0x51, 0x45, 0x4B, 0x58, 0x2D, 0xDF, 0x44, 0x0A}, - []byte{0xA2, 0x5E, 0x78, 0x56, 0xCF, 0x26, 0x51, 0xEB}}, - { - []byte{0x04, 0xB9, 0x15, 0xBA, 0x43, 0xFE, 0xB5, 0xB6}, - []byte{0x42, 0xFD, 0x44, 0x30, 0x59, 0x57, 0x7F, 0xA2}, - []byte{0x35, 0x38, 0x82, 0xB1, 0x09, 0xCE, 0x8F, 0x1A}}, - { - []byte{0x01, 0x13, 0xB9, 0x70, 0xFD, 0x34, 0xF2, 0xCE}, - []byte{0x05, 0x9B, 0x5E, 0x08, 0x51, 0xCF, 0x14, 0x3A}, - []byte{0x48, 0xF4, 0xD0, 0x88, 0x4C, 0x37, 0x99, 0x18}}, - { - []byte{0x01, 0x70, 0xF1, 0x75, 0x46, 0x8F, 0xB5, 0xE6}, - []byte{0x07, 0x56, 0xD8, 0xE0, 0x77, 0x47, 0x61, 0xD2}, - []byte{0x43, 0x21, 0x93, 0xB7, 0x89, 0x51, 0xFC, 0x98}}, - { - []byte{0x43, 0x29, 0x7F, 0xAD, 0x38, 0xE3, 0x73, 0xFE}, - []byte{0x76, 0x25, 0x14, 0xB8, 0x29, 0xBF, 0x48, 0x6A}, - []byte{0x13, 0xF0, 0x41, 0x54, 0xD6, 0x9D, 0x1A, 0xE5}}, - { - []byte{0x07, 0xA7, 0x13, 0x70, 0x45, 0xDA, 0x2A, 0x16}, - []byte{0x3B, 0xDD, 0x11, 0x90, 0x49, 0x37, 0x28, 0x02}, - []byte{0x2E, 0xED, 0xDA, 0x93, 0xFF, 0xD3, 0x9C, 0x79}}, - { - []byte{0x04, 0x68, 0x91, 0x04, 0xC2, 0xFD, 0x3B, 0x2F}, - []byte{0x26, 0x95, 0x5F, 0x68, 0x35, 0xAF, 0x60, 0x9A}, - []byte{0xD8, 0x87, 0xE0, 0x39, 0x3C, 0x2D, 0xA6, 0xE3}}, - { - []byte{0x37, 0xD0, 0x6B, 0xB5, 0x16, 0xCB, 0x75, 0x46}, - []byte{0x16, 0x4D, 0x5E, 0x40, 0x4F, 0x27, 0x52, 0x32}, - []byte{0x5F, 0x99, 0xD0, 0x4F, 0x5B, 0x16, 0x39, 0x69}}, - { - []byte{0x1F, 0x08, 0x26, 0x0D, 0x1A, 0xC2, 0x46, 0x5E}, - []byte{0x6B, 0x05, 0x6E, 0x18, 0x75, 0x9F, 0x5C, 0xCA}, - []byte{0x4A, 0x05, 0x7A, 0x3B, 0x24, 0xD3, 0x97, 0x7B}}, - { - []byte{0x58, 0x40, 0x23, 0x64, 0x1A, 0xBA, 0x61, 0x76}, - []byte{0x00, 0x4B, 0xD6, 0xEF, 0x09, 0x17, 0x60, 0x62}, - []byte{0x45, 0x20, 0x31, 0xC1, 0xE4, 0xFA, 0xDA, 0x8E}}, - { - []byte{0x02, 0x58, 0x16, 0x16, 0x46, 0x29, 0xB0, 0x07}, - []byte{0x48, 0x0D, 0x39, 0x00, 0x6E, 0xE7, 0x62, 0xF2}, - []byte{0x75, 0x55, 0xAE, 0x39, 0xF5, 0x9B, 0x87, 0xBD}}, - { - []byte{0x49, 0x79, 0x3E, 0xBC, 0x79, 0xB3, 0x25, 0x8F}, - []byte{0x43, 0x75, 0x40, 0xC8, 0x69, 0x8F, 0x3C, 0xFA}, - []byte{0x53, 0xC5, 0x5F, 0x9C, 0xB4, 0x9F, 0xC0, 0x19}}, - { - []byte{0x4F, 0xB0, 0x5E, 0x15, 0x15, 0xAB, 0x73, 0xA7}, - []byte{0x07, 0x2D, 0x43, 0xA0, 0x77, 0x07, 0x52, 0x92}, - []byte{0x7A, 0x8E, 0x7B, 0xFA, 0x93, 0x7E, 0x89, 0xA3}}, - { - []byte{0x49, 0xE9, 0x5D, 0x6D, 0x4C, 0xA2, 0x29, 0xBF}, - []byte{0x02, 0xFE, 0x55, 0x77, 0x81, 0x17, 0xF1, 0x2A}, - []byte{0xCF, 0x9C, 0x5D, 0x7A, 0x49, 0x86, 0xAD, 0xB5}}, - { - []byte{0x01, 0x83, 0x10, 0xDC, 0x40, 0x9B, 0x26, 0xD6}, - []byte{0x1D, 0x9D, 0x5C, 0x50, 0x18, 0xF7, 0x28, 0xC2}, - []byte{0xD1, 0xAB, 0xB2, 0x90, 0x65, 0x8B, 0xC7, 0x78}}, - { - []byte{0x1C, 0x58, 0x7F, 0x1C, 0x13, 0x92, 0x4F, 0xEF}, - []byte{0x30, 0x55, 0x32, 0x28, 0x6D, 0x6F, 0x29, 0x5A}, - []byte{0x55, 0xCB, 0x37, 0x74, 0xD1, 0x3E, 0xF2, 0x01}}, - { - []byte{0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, - []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}, - []byte{0xFA, 0x34, 0xEC, 0x48, 0x47, 0xB2, 0x68, 0xB2}}, - { - []byte{0x1F, 0x1F, 0x1F, 0x1F, 0x0E, 0x0E, 0x0E, 0x0E}, - []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}, - []byte{0xA7, 0x90, 0x79, 0x51, 0x08, 0xEA, 0x3C, 0xAE}}, - { - []byte{0xE0, 0xFE, 0xE0, 0xFE, 0xF1, 0xFE, 0xF1, 0xFE}, - []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}, - []byte{0xC3, 0x9E, 0x07, 0x2D, 0x9F, 0xAC, 0x63, 0x1D}}, - { - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, - []byte{0x01, 0x49, 0x33, 0xE0, 0xCD, 0xAF, 0xF6, 0xE4}}, - { - []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0xF2, 0x1E, 0x9A, 0x77, 0xB7, 0x1C, 0x49, 0xBC}}, - { - []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}, - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x24, 0x59, 0x46, 0x88, 0x57, 0x54, 0x36, 0x9A}}, - { - []byte{0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10}, - []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, - []byte{0x6B, 0x5C, 0x5A, 0x9C, 0x5D, 0x9E, 0x0A, 0x5A}}, -} - -func TestCipherEncrypt(t *testing.T) { - for i, tt := range encryptTests { - c, err := NewCipher(tt.key) - if err != nil { - t.Errorf("NewCipher(%d bytes) = %s", len(tt.key), err) - continue - } - ct := make([]byte, len(tt.out)) - c.Encrypt(ct, tt.in) - for j, v := range ct { - if v != tt.out[j] { - t.Errorf("Cipher.Encrypt, test vector #%d: cipher-text[%d] = %#x, expected %#x", i, j, v, tt.out[j]) - break - } - } - } -} - -func TestCipherDecrypt(t *testing.T) { - for i, tt := range encryptTests { - c, err := NewCipher(tt.key) - if err != nil { - t.Errorf("NewCipher(%d bytes) = %s", len(tt.key), err) - continue - } - pt := make([]byte, len(tt.in)) - c.Decrypt(pt, tt.out) - for j, v := range pt { - if v != tt.in[j] { - t.Errorf("Cipher.Decrypt, test vector #%d: plain-text[%d] = %#x, expected %#x", i, j, v, tt.in[j]) - break - } - } - } -} - -func TestSaltedCipherKeyLength(t *testing.T) { - if _, err := NewSaltedCipher(nil, []byte{'a'}); err != KeySizeError(0) { - t.Errorf("NewSaltedCipher with short key, gave error %#v, expected %#v", err, KeySizeError(0)) - } - - // A 57-byte key. One over the typical blowfish restriction. - key := []byte("012345678901234567890123456789012345678901234567890123456") - if _, err := NewSaltedCipher(key, []byte{'a'}); err != nil { - t.Errorf("NewSaltedCipher with long key, gave error %#v", err) - } -} - -// Test vectors generated with Blowfish from OpenSSH. -var saltedVectors = [][8]byte{ - {0x0c, 0x82, 0x3b, 0x7b, 0x8d, 0x01, 0x4b, 0x7e}, - {0xd1, 0xe1, 0x93, 0xf0, 0x70, 0xa6, 0xdb, 0x12}, - {0xfc, 0x5e, 0xba, 0xde, 0xcb, 0xf8, 0x59, 0xad}, - {0x8a, 0x0c, 0x76, 0xe7, 0xdd, 0x2c, 0xd3, 0xa8}, - {0x2c, 0xcb, 0x7b, 0xee, 0xac, 0x7b, 0x7f, 0xf8}, - {0xbb, 0xf6, 0x30, 0x6f, 0xe1, 0x5d, 0x62, 0xbf}, - {0x97, 0x1e, 0xc1, 0x3d, 0x3d, 0xe0, 0x11, 0xe9}, - {0x06, 0xd7, 0x4d, 0xb1, 0x80, 0xa3, 0xb1, 0x38}, - {0x67, 0xa1, 0xa9, 0x75, 0x0e, 0x5b, 0xc6, 0xb4}, - {0x51, 0x0f, 0x33, 0x0e, 0x4f, 0x67, 0xd2, 0x0c}, - {0xf1, 0x73, 0x7e, 0xd8, 0x44, 0xea, 0xdb, 0xe5}, - {0x14, 0x0e, 0x16, 0xce, 0x7f, 0x4a, 0x9c, 0x7b}, - {0x4b, 0xfe, 0x43, 0xfd, 0xbf, 0x36, 0x04, 0x47}, - {0xb1, 0xeb, 0x3e, 0x15, 0x36, 0xa7, 0xbb, 0xe2}, - {0x6d, 0x0b, 0x41, 0xdd, 0x00, 0x98, 0x0b, 0x19}, - {0xd3, 0xce, 0x45, 0xce, 0x1d, 0x56, 0xb7, 0xfc}, - {0xd9, 0xf0, 0xfd, 0xda, 0xc0, 0x23, 0xb7, 0x93}, - {0x4c, 0x6f, 0xa1, 0xe4, 0x0c, 0xa8, 0xca, 0x57}, - {0xe6, 0x2f, 0x28, 0xa7, 0x0c, 0x94, 0x0d, 0x08}, - {0x8f, 0xe3, 0xf0, 0xb6, 0x29, 0xe3, 0x44, 0x03}, - {0xff, 0x98, 0xdd, 0x04, 0x45, 0xb4, 0x6d, 0x1f}, - {0x9e, 0x45, 0x4d, 0x18, 0x40, 0x53, 0xdb, 0xef}, - {0xb7, 0x3b, 0xef, 0x29, 0xbe, 0xa8, 0x13, 0x71}, - {0x02, 0x54, 0x55, 0x41, 0x8e, 0x04, 0xfc, 0xad}, - {0x6a, 0x0a, 0xee, 0x7c, 0x10, 0xd9, 0x19, 0xfe}, - {0x0a, 0x22, 0xd9, 0x41, 0xcc, 0x23, 0x87, 0x13}, - {0x6e, 0xff, 0x1f, 0xff, 0x36, 0x17, 0x9c, 0xbe}, - {0x79, 0xad, 0xb7, 0x40, 0xf4, 0x9f, 0x51, 0xa6}, - {0x97, 0x81, 0x99, 0xa4, 0xde, 0x9e, 0x9f, 0xb6}, - {0x12, 0x19, 0x7a, 0x28, 0xd0, 0xdc, 0xcc, 0x92}, - {0x81, 0xda, 0x60, 0x1e, 0x0e, 0xdd, 0x65, 0x56}, - {0x7d, 0x76, 0x20, 0xb2, 0x73, 0xc9, 0x9e, 0xee}, -} - -func TestSaltedCipher(t *testing.T) { - var key, salt [32]byte - for i := range key { - key[i] = byte(i) - salt[i] = byte(i + 32) - } - for i, v := range saltedVectors { - c, err := NewSaltedCipher(key[:], salt[:i]) - if err != nil { - t.Fatal(err) - } - var buf [8]byte - c.Encrypt(buf[:], buf[:]) - if v != buf { - t.Errorf("%d: expected %x, got %x", i, v, buf) - } - } -} - -func BenchmarkExpandKeyWithSalt(b *testing.B) { - key := make([]byte, 32) - salt := make([]byte, 16) - c, _ := NewCipher(key) - for i := 0; i < b.N; i++ { - expandKeyWithSalt(key, salt, c) - } -} - -func BenchmarkExpandKey(b *testing.B) { - key := make([]byte, 32) - c, _ := NewCipher(key) - for i := 0; i < b.N; i++ { - ExpandKey(key, c) - } -} diff --git a/Godeps/_workspace/src/golang.org/x/image/LICENSE b/Godeps/_workspace/src/golang.org/x/image/LICENSE new file mode 100644 index 000000000..6a66aea5e --- /dev/null +++ b/Godeps/_workspace/src/golang.org/x/image/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Godeps/_workspace/src/golang.org/x/image/PATENTS b/Godeps/_workspace/src/golang.org/x/image/PATENTS new file mode 100644 index 000000000..733099041 --- /dev/null +++ b/Godeps/_workspace/src/golang.org/x/image/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/Godeps/_workspace/src/golang.org/x/image/bmp/reader_test.go b/Godeps/_workspace/src/golang.org/x/image/bmp/reader_test.go deleted file mode 100644 index fd6ff64f6..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/bmp/reader_test.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bmp - -import ( - "fmt" - "image" - "os" - "testing" - - _ "image/png" -) - -const testdataDir = "../testdata/" - -func compare(t *testing.T, img0, img1 image.Image) error { - b := img1.Bounds() - if !b.Eq(img0.Bounds()) { - return fmt.Errorf("wrong image size: want %s, got %s", img0.Bounds(), b) - } - for y := b.Min.Y; y < b.Max.Y; y++ { - for x := b.Min.X; x < b.Max.X; x++ { - c0 := img0.At(x, y) - c1 := img1.At(x, y) - r0, g0, b0, a0 := c0.RGBA() - r1, g1, b1, a1 := c1.RGBA() - if r0 != r1 || g0 != g1 || b0 != b1 || a0 != a1 { - return fmt.Errorf("pixel at (%d, %d) has wrong color: want %v, got %v", x, y, c0, c1) - } - } - } - return nil -} - -// TestDecode tests that decoding a PNG image and a BMP image result in the -// same pixel data. -func TestDecode(t *testing.T) { - testCases := []string{ - "video-001", - "yellow_rose-small", - } - - for _, tc := range testCases { - f0, err := os.Open(testdataDir + tc + ".png") - if err != nil { - t.Errorf("%s: Open PNG: %v", tc, err) - continue - } - defer f0.Close() - img0, _, err := image.Decode(f0) - if err != nil { - t.Errorf("%s: Decode PNG: %v", tc, err) - continue - } - - f1, err := os.Open(testdataDir + tc + ".bmp") - if err != nil { - t.Errorf("%s: Open BMP: %v", tc, err) - continue - } - defer f1.Close() - img1, _, err := image.Decode(f1) - if err != nil { - t.Errorf("%s: Decode BMP: %v", tc, err) - continue - } - - if err := compare(t, img0, img1); err != nil { - t.Errorf("%s: %v", tc, err) - continue - } - } -} diff --git a/Godeps/_workspace/src/golang.org/x/image/bmp/writer_test.go b/Godeps/_workspace/src/golang.org/x/image/bmp/writer_test.go deleted file mode 100644 index 9e5a32741..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/bmp/writer_test.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bmp - -import ( - "bytes" - "fmt" - "image" - "io/ioutil" - "os" - "testing" - "time" -) - -func openImage(filename string) (image.Image, error) { - f, err := os.Open(testdataDir + filename) - if err != nil { - return nil, err - } - defer f.Close() - return Decode(f) -} - -func TestEncode(t *testing.T) { - img0, err := openImage("video-001.bmp") - if err != nil { - t.Fatal(err) - } - - buf := new(bytes.Buffer) - err = Encode(buf, img0) - if err != nil { - t.Fatal(err) - } - - img1, err := Decode(buf) - if err != nil { - t.Fatal(err) - } - - compare(t, img0, img1) -} - -// TestZeroWidthVeryLargeHeight tests that encoding and decoding a degenerate -// image with zero width but over one billion pixels in height is faster than -// naively calling an io.Reader or io.Writer method once per row. -func TestZeroWidthVeryLargeHeight(t *testing.T) { - c := make(chan error, 1) - go func() { - b := image.Rect(0, 0, 0, 0x3fffffff) - var buf bytes.Buffer - if err := Encode(&buf, image.NewRGBA(b)); err != nil { - c <- err - return - } - m, err := Decode(&buf) - if err != nil { - c <- err - return - } - if got := m.Bounds(); got != b { - c <- fmt.Errorf("bounds: got %v, want %v", got, b) - return - } - c <- nil - }() - select { - case err := <-c: - if err != nil { - t.Fatal(err) - } - case <-time.After(3 * time.Second): - t.Fatalf("timed out") - } -} - -// BenchmarkEncode benchmarks the encoding of an image. -func BenchmarkEncode(b *testing.B) { - img, err := openImage("video-001.bmp") - if err != nil { - b.Fatal(err) - } - s := img.Bounds().Size() - b.SetBytes(int64(s.X * s.Y * 4)) - b.ResetTimer() - for i := 0; i < b.N; i++ { - Encode(ioutil.Discard, img) - } -} diff --git a/Godeps/_workspace/src/golang.org/x/image/font/plan9font/example_test.go b/Godeps/_workspace/src/golang.org/x/image/font/plan9font/example_test.go deleted file mode 100644 index c1eacb230..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/font/plan9font/example_test.go +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package plan9font_test - -import ( - "image" - "image/draw" - "io/ioutil" - "log" - "os" - "path" - "path/filepath" - - "golang.org/x/image/font" - "golang.org/x/image/font/plan9font" - "golang.org/x/image/math/fixed" -) - -func ExampleParseFont() { - readFile := func(name string) ([]byte, error) { - return ioutil.ReadFile(filepath.FromSlash(path.Join("../testdata/fixed", name))) - } - fontData, err := readFile("unicode.7x13.font") - if err != nil { - log.Fatal(err) - } - face, err := plan9font.ParseFont(fontData, readFile) - if err != nil { - log.Fatal(err) - } - // TODO: derive the ascent from the face's metrics. - const ascent = 11 - - dst := image.NewRGBA(image.Rect(0, 0, 4*7, 13)) - draw.Draw(dst, dst.Bounds(), image.Black, image.Point{}, draw.Src) - d := &font.Drawer{ - Dst: dst, - Src: image.White, - Face: face, - Dot: fixed.P(0, ascent), - } - // Draw: - // - U+0053 LATIN CAPITAL LETTER S - // - U+03A3 GREEK CAPITAL LETTER SIGMA - // - U+222B INTEGRAL - // - U+3055 HIRAGANA LETTER SA - // The testdata does not contain the CJK subfont files, so U+3055 HIRAGANA - // LETTER SA (さ) should be rendered as U+FFFD REPLACEMENT CHARACTER (�). - // - // The missing subfont file will trigger an "open - // ../testdata/shinonome/k12.3000: no such file or directory" log message. - // This is expected and can be ignored. - d.DrawString("SΣ∫さ") - - // Convert the dst image to ASCII art. - var out []byte - b := dst.Bounds() - for y := b.Min.Y; y < b.Max.Y; y++ { - out = append(out, '0'+byte(y%10), ' ') - for x := b.Min.X; x < b.Max.X; x++ { - if dst.RGBAAt(x, y).R > 0 { - out = append(out, 'X') - } else { - out = append(out, '.') - } - } - // Highlight the last row before the baseline. Glyphs like 'S' without - // descenders should not affect any pixels whose Y coordinate is >= the - // baseline. - if y == ascent-1 { - out = append(out, '_') - } - out = append(out, '\n') - } - os.Stdout.Write(out) - - // Output: - // 0 ..................X......... - // 1 .................X.X........ - // 2 .XXXX..XXXXXX....X.....XXX.. - // 3 X....X.X.........X....XX.XX. - // 4 X.......X........X....X.X.X. - // 5 X........X.......X....XXX.X. - // 6 .XXXX.....X......X....XX.XX. - // 7 .....X...X.......X....XX.XX. - // 8 .....X..X........X....XXXXX. - // 9 X....X.X.........X....XX.XX. - // 0 .XXXX..XXXXXX....X.....XXX.._ - // 1 ...............X.X.......... - // 2 ................X........... -} diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0000 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0000 deleted file mode 100644 index 9509cdf97..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0000 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0100 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0100 deleted file mode 100644 index 0a79f555c..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0100 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0200 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0200 deleted file mode 100644 index e25247ecc..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0200 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0300 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0300 deleted file mode 100644 index 86eb33f42..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0300 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0400 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0400 deleted file mode 100644 index 43300ad95..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0400 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0500 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0500 deleted file mode 100644 index 2d9326708..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0500 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0E00 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0E00 deleted file mode 100644 index 7c51a1e51..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.0E00 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.1000 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.1000 deleted file mode 100644 index 019698c8d..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.1000 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.1600 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.1600 deleted file mode 100644 index f69a97745..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.1600 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.1E00 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.1E00 deleted file mode 100644 index 3bc5068cf..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.1E00 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.1F00 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.1F00 deleted file mode 100644 index 43b320be1..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.1F00 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2000 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2000 deleted file mode 100644 index f9244e1cf..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2000 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2100 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2100 deleted file mode 100644 index c565abb7d..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2100 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2200 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2200 deleted file mode 100644 index a992d3521..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2200 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2300 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2300 deleted file mode 100644 index 8ff099d19..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2300 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2400 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2400 deleted file mode 100644 index 99927a11f..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2400 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2500 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2500 deleted file mode 100644 index 60dc224cd..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2500 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2600 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2600 deleted file mode 100644 index 1b393c28b..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2600 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2700 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2700 deleted file mode 100644 index c39a57206..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2700 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2800 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2800 deleted file mode 100644 index c7572de47..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2800 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2A00 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2A00 deleted file mode 100644 index 71791ace6..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.2A00 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.3000 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.3000 deleted file mode 100644 index fb830f4fb..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.3000 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.FB00 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.FB00 deleted file mode 100644 index 3a0b30a99..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.FB00 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.FE00 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.FE00 deleted file mode 100644 index 3989d2673..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.FE00 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.FF00 b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.FF00 deleted file mode 100644 index 78ed39865..000000000 Binary files a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/7x13.FF00 and /dev/null differ diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/README b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/README deleted file mode 100644 index a39f8a5e2..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/README +++ /dev/null @@ -1,9 +0,0 @@ -These font files were copied from the Plan 9 Port's font/fixed directory. The -README in that directory states that: "These fonts are converted from the BDFs -in the XFree86 distribution. They were all marked as public domain." - -The Plan 9 Port is at https://github.com/9fans/plan9port and the copy was made -from commit a78b1841 (2015-08-18). - -The unicode.7x13.font file also refers to a ../shinonome directory, but this -testdata does not include those subfont files. diff --git a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/unicode.7x13.font b/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/unicode.7x13.font deleted file mode 100644 index 337b4286b..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/font/testdata/fixed/unicode.7x13.font +++ /dev/null @@ -1,68 +0,0 @@ -13 10 -0x0000 0x001F 7x13.2400 -0x0000 0x00FF 7x13.0000 -0x0100 0x01FF 7x13.0100 -0x0200 0x02FF 7x13.0200 -0x0300 0x03FF 7x13.0300 -0x0400 0x04FF 7x13.0400 -0x0500 0x05FF 7x13.0500 -0x0E00 0x0EFF 7x13.0E00 -0x1000 0x10FF 7x13.1000 -0x1600 0x16FF 7x13.1600 -0x1E00 0x1EFF 7x13.1E00 -0x1F00 0x1FFF 7x13.1F00 -0x2000 0x20FF 7x13.2000 -0x2100 0x21FF 7x13.2100 -0x2200 0x22FF 7x13.2200 -0x2300 0x23FF 7x13.2300 -0x2400 0x24FF 7x13.2400 -0x2500 0x25FF 7x13.2500 -0x2600 0x26FF 7x13.2600 -0x2700 0x27FF 7x13.2700 -0x2800 0x28FF 7x13.2800 -0x2A00 0x2AFF 7x13.2A00 -0x3000 0x30fe ../shinonome/k12.3000 -0x4e00 0x4ffe ../shinonome/k12.4e00 -0x5005 0x51fe ../shinonome/k12.5005 -0x5200 0x53fa ../shinonome/k12.5200 -0x5401 0x55fe ../shinonome/k12.5401 -0x5606 0x57fc ../shinonome/k12.5606 -0x5800 0x59ff ../shinonome/k12.5800 -0x5a01 0x5bff ../shinonome/k12.5a01 -0x5c01 0x5dfe ../shinonome/k12.5c01 -0x5e02 0x5fff ../shinonome/k12.5e02 -0x600e 0x61ff ../shinonome/k12.600e -0x6200 0x63fa ../shinonome/k12.6200 -0x6406 0x65fb ../shinonome/k12.6406 -0x6602 0x67ff ../shinonome/k12.6602 -0x6802 0x69ff ../shinonome/k12.6802 -0x6a02 0x6bf3 ../shinonome/k12.6a02 -0x6c08 0x6dfb ../shinonome/k12.6c08 -0x6e05 0x6ffe ../shinonome/k12.6e05 -0x7001 0x71ff ../shinonome/k12.7001 -0x7206 0x73fe ../shinonome/k12.7206 -0x7403 0x75ff ../shinonome/k12.7403 -0x7601 0x77fc ../shinonome/k12.7601 -0x7802 0x79fb ../shinonome/k12.7802 -0x7a00 0x7bf7 ../shinonome/k12.7a00 -0x7c00 0x7dfb ../shinonome/k12.7c00 -0x7e01 0x7ffc ../shinonome/k12.7e01 -0x8000 0x81fe ../shinonome/k12.8000 -0x8201 0x83fd ../shinonome/k12.8201 -0x8403 0x85fe ../shinonome/k12.8403 -0x8602 0x87fe ../shinonome/k12.8602 -0x8805 0x89f8 ../shinonome/k12.8805 -0x8a00 0x8b9a ../shinonome/k12.8a00 -0x8c37 0x8dff ../shinonome/k12.8c37 -0x8e08 0x8ffd ../shinonome/k12.8e08 -0x9000 0x91ff ../shinonome/k12.9000 -0x920d 0x93e8 ../shinonome/k12.920d -0x9403 0x95e5 ../shinonome/k12.9403 -0x961c 0x97ff ../shinonome/k12.961c -0x9801 0x99ff ../shinonome/k12.9801 -0x9a01 0x9bf5 ../shinonome/k12.9a01 -0x9c04 0x9dfd ../shinonome/k12.9c04 -0x9e1a 0x9fa0 ../shinonome/k12.9e1a -0xFB00 0xFBFF 7x13.FB00 -0xFE00 0xFEFF 7x13.FE00 -0xFF00 0xFFFF 7x13.FF00 diff --git a/Godeps/_workspace/src/golang.org/x/image/math/fixed/fixed_test.go b/Godeps/_workspace/src/golang.org/x/image/math/fixed/fixed_test.go deleted file mode 100644 index e252de7cb..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/math/fixed/fixed_test.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fixed - -import ( - "testing" -) - -func TestInt26_6(t *testing.T) { - got := Int26_6(1<<6 + 1<<4).String() - want := "1:16" - if got != want { - t.Fatalf("got %q, want %q", got, want) - } -} - -func TestInt52_12(t *testing.T) { - got := Int52_12(1<<12 + 1<<10).String() - want := "1:1024" - if got != want { - t.Fatalf("got %q, want %q", got, want) - } -} diff --git a/Godeps/_workspace/src/golang.org/x/image/tiff/buffer_test.go b/Godeps/_workspace/src/golang.org/x/image/tiff/buffer_test.go deleted file mode 100644 index e13afb361..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/tiff/buffer_test.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tiff - -import ( - "io" - "strings" - "testing" -) - -var readAtTests = []struct { - n int - off int64 - s string - err error -}{ - {2, 0, "ab", nil}, - {6, 0, "abcdef", nil}, - {3, 3, "def", nil}, - {3, 5, "f", io.EOF}, - {3, 6, "", io.EOF}, -} - -func TestReadAt(t *testing.T) { - r := newReaderAt(strings.NewReader("abcdef")) - b := make([]byte, 10) - for _, test := range readAtTests { - n, err := r.ReadAt(b[:test.n], test.off) - s := string(b[:n]) - if s != test.s || err != test.err { - t.Errorf("buffer.ReadAt(<%v bytes>, %v): got %v, %q; want %v, %q", test.n, test.off, err, s, test.err, test.s) - } - } -} diff --git a/Godeps/_workspace/src/golang.org/x/image/tiff/reader_test.go b/Godeps/_workspace/src/golang.org/x/image/tiff/reader_test.go deleted file mode 100644 index f5c02e697..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/tiff/reader_test.go +++ /dev/null @@ -1,377 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tiff - -import ( - "bytes" - "encoding/binary" - "encoding/hex" - "errors" - "image" - "io/ioutil" - "os" - "strings" - "testing" - - _ "image/png" -) - -const testdataDir = "../testdata/" - -// Read makes *buffer implements io.Reader, so that we can pass one to Decode. -func (*buffer) Read([]byte) (int, error) { - panic("unimplemented") -} - -func load(name string) (image.Image, error) { - f, err := os.Open(testdataDir + name) - if err != nil { - return nil, err - } - defer f.Close() - img, _, err := image.Decode(f) - if err != nil { - return nil, err - } - return img, nil -} - -// TestNoRPS tests decoding an image that has no RowsPerStrip tag. The tag is -// mandatory according to the spec but some software omits it in the case of a -// single strip. -func TestNoRPS(t *testing.T) { - _, err := load("no_rps.tiff") - if err != nil { - t.Fatal(err) - } -} - -// TestNoCompression tests decoding an image that has no Compression tag. This -// tag is mandatory, but most tools interpret a missing value as no -// compression. -func TestNoCompression(t *testing.T) { - _, err := load("no_compress.tiff") - if err != nil { - t.Fatal(err) - } -} - -// TestUnpackBits tests the decoding of PackBits-encoded data. -func TestUnpackBits(t *testing.T) { - var unpackBitsTests = []struct { - compressed string - uncompressed string - }{{ - // Example data from Wikipedia. - "\xfe\xaa\x02\x80\x00\x2a\xfd\xaa\x03\x80\x00\x2a\x22\xf7\xaa", - "\xaa\xaa\xaa\x80\x00\x2a\xaa\xaa\xaa\xaa\x80\x00\x2a\x22\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", - }} - for _, u := range unpackBitsTests { - buf, err := unpackBits(strings.NewReader(u.compressed)) - if err != nil { - t.Fatal(err) - } - if string(buf) != u.uncompressed { - t.Fatalf("unpackBits: want %x, got %x", u.uncompressed, buf) - } - } -} - -func TestShortBlockData(t *testing.T) { - b, err := ioutil.ReadFile("../testdata/bw-uncompressed.tiff") - if err != nil { - t.Fatal(err) - } - // The bw-uncompressed.tiff image is a 153x55 bi-level image. This is 1 bit - // per pixel, or 20 bytes per row, times 55 rows, or 1100 bytes of pixel - // data. 1100 in hex is 0x44c, or "\x4c\x04" in little-endian. We replace - // that byte count (StripByteCounts-tagged data) by something less than - // that, so that there is not enough pixel data. - old := []byte{0x4c, 0x04} - new := []byte{0x01, 0x01} - i := bytes.Index(b, old) - if i < 0 { - t.Fatal(`could not find "\x4c\x04" byte count`) - } - if bytes.Contains(b[i+len(old):], old) { - t.Fatal(`too many occurrences of "\x4c\x04"`) - } - b[i+0] = new[0] - b[i+1] = new[1] - if _, err = Decode(bytes.NewReader(b)); err == nil { - t.Fatal("got nil error, want non-nil") - } -} - -func TestDecodeInvalidDataType(t *testing.T) { - b, err := ioutil.ReadFile("../testdata/bw-uncompressed.tiff") - if err != nil { - t.Fatal(err) - } - - // off is the offset of the ImageWidth tag. It is the offset of the overall - // IFD block (0x00000454), plus 2 for the uint16 number of IFD entries, plus 12 - // to skip the first entry. - const off = 0x00000454 + 2 + 12*1 - - if v := binary.LittleEndian.Uint16(b[off : off+2]); v != tImageWidth { - t.Fatal(`could not find ImageWidth tag`) - } - binary.LittleEndian.PutUint16(b[off+2:], uint16(len(lengths))) // invalid datatype - - if _, err = Decode(bytes.NewReader(b)); err == nil { - t.Fatal("got nil error, want non-nil") - } -} - -func compare(t *testing.T, img0, img1 image.Image) { - b0 := img0.Bounds() - b1 := img1.Bounds() - if b0.Dx() != b1.Dx() || b0.Dy() != b1.Dy() { - t.Fatalf("wrong image size: want %s, got %s", b0, b1) - } - x1 := b1.Min.X - b0.Min.X - y1 := b1.Min.Y - b0.Min.Y - for y := b0.Min.Y; y < b0.Max.Y; y++ { - for x := b0.Min.X; x < b0.Max.X; x++ { - c0 := img0.At(x, y) - c1 := img1.At(x+x1, y+y1) - r0, g0, b0, a0 := c0.RGBA() - r1, g1, b1, a1 := c1.RGBA() - if r0 != r1 || g0 != g1 || b0 != b1 || a0 != a1 { - t.Fatalf("pixel at (%d, %d) has wrong color: want %v, got %v", x, y, c0, c1) - } - } - } -} - -// TestDecode tests that decoding a PNG image and a TIFF image result in the -// same pixel data. -func TestDecode(t *testing.T) { - img0, err := load("video-001.png") - if err != nil { - t.Fatal(err) - } - img1, err := load("video-001.tiff") - if err != nil { - t.Fatal(err) - } - img2, err := load("video-001-strip-64.tiff") - if err != nil { - t.Fatal(err) - } - img3, err := load("video-001-tile-64x64.tiff") - if err != nil { - t.Fatal(err) - } - img4, err := load("video-001-16bit.tiff") - if err != nil { - t.Fatal(err) - } - - compare(t, img0, img1) - compare(t, img0, img2) - compare(t, img0, img3) - compare(t, img0, img4) -} - -// TestDecodeLZW tests that decoding a PNG image and a LZW-compressed TIFF -// image result in the same pixel data. -func TestDecodeLZW(t *testing.T) { - img0, err := load("blue-purple-pink.png") - if err != nil { - t.Fatal(err) - } - img1, err := load("blue-purple-pink.lzwcompressed.tiff") - if err != nil { - t.Fatal(err) - } - - compare(t, img0, img1) -} - -// TestDecompress tests that decoding some TIFF images that use different -// compression formats result in the same pixel data. -func TestDecompress(t *testing.T) { - var decompressTests = []string{ - "bw-uncompressed.tiff", - "bw-deflate.tiff", - "bw-packbits.tiff", - } - var img0 image.Image - for _, name := range decompressTests { - img1, err := load(name) - if err != nil { - t.Fatalf("decoding %s: %v", name, err) - } - if img0 == nil { - img0 = img1 - continue - } - compare(t, img0, img1) - } -} - -func replace(src []byte, find, repl string) ([]byte, error) { - removeSpaces := func(r rune) rune { - if r != ' ' { - return r - } - return -1 - } - - f, err := hex.DecodeString(strings.Map(removeSpaces, find)) - if err != nil { - return nil, err - } - r, err := hex.DecodeString(strings.Map(removeSpaces, repl)) - if err != nil { - return nil, err - } - dst := bytes.Replace(src, f, r, 1) - if bytes.Equal(dst, src) { - return nil, errors.New("replacement failed") - } - return dst, nil -} - -// TestZeroBitsPerSample tests that an IFD with a bitsPerSample of 0 does not -// cause a crash. -// Issue 10711. -func TestZeroBitsPerSample(t *testing.T) { - b0, err := ioutil.ReadFile(testdataDir + "bw-deflate.tiff") - if err != nil { - t.Fatal(err) - } - - // Mutate the loaded image to have the problem. - // 02 01: tag number (tBitsPerSample) - // 03 00: data type (short, or uint16) - // 01 00 00 00: count - // ?? 00 00 00: value (1 -> 0) - b1, err := replace(b0, - "02 01 03 00 01 00 00 00 01 00 00 00", - "02 01 03 00 01 00 00 00 00 00 00 00", - ) - if err != nil { - t.Fatal(err) - } - - _, err = Decode(bytes.NewReader(b1)) - if err == nil { - t.Fatal("Decode with 0 bits per sample: got nil error, want non-nil") - } -} - -// TestTileTooBig tests that we do not panic when a tile is too big compared to -// the data available. -// Issue 10712 -func TestTileTooBig(t *testing.T) { - b0, err := ioutil.ReadFile(testdataDir + "video-001-tile-64x64.tiff") - if err != nil { - t.Fatal(err) - } - - // Mutate the loaded image to have the problem. - // - // 42 01: tag number (tTileWidth) - // 03 00: data type (short, or uint16) - // 01 00 00 00: count - // xx 00 00 00: value (0x40 -> 0x44: a wider tile consumes more data - // than is available) - b1, err := replace(b0, - "42 01 03 00 01 00 00 00 40 00 00 00", - "42 01 03 00 01 00 00 00 44 00 00 00", - ) - if err != nil { - t.Fatal(err) - } - - // Turn off the predictor, which makes it possible to hit the - // place with the defect. Without this patch to the image, we run - // out of data too early, and do not hit the part of the code where - // the original panic was. - // - // 3d 01: tag number (tPredictor) - // 03 00: data type (short, or uint16) - // 01 00 00 00: count - // xx 00 00 00: value (2 -> 1: 2 = horizontal, 1 = none) - b2, err := replace(b1, - "3d 01 03 00 01 00 00 00 02 00 00 00", - "3d 01 03 00 01 00 00 00 01 00 00 00", - ) - if err != nil { - t.Fatal(err) - } - - _, err = Decode(bytes.NewReader(b2)) - if err == nil { - t.Fatal("did not expect nil error") - } -} - -// TestZeroSizedImages tests that decoding does not panic when image dimensions -// are zero, and returns a zero-sized image instead. -// Issue 10393. -func TestZeroSizedImages(t *testing.T) { - testsizes := []struct { - w, h int - }{ - {0, 0}, - {1, 0}, - {0, 1}, - {1, 1}, - } - for _, r := range testsizes { - img := image.NewRGBA(image.Rect(0, 0, r.w, r.h)) - var buf bytes.Buffer - if err := Encode(&buf, img, nil); err != nil { - t.Errorf("encode w=%d h=%d: %v", r.w, r.h, err) - continue - } - if _, err := Decode(&buf); err != nil { - t.Errorf("decode w=%d h=%d: %v", r.w, r.h, err) - } - } -} - -// TestLargeIFDEntry tests that a large IFD entry does not cause Decode to -// panic. -// Issue 10596. -func TestLargeIFDEntry(t *testing.T) { - testdata := "II*\x00\x08\x00\x00\x00\f\x000000000000" + - "00000000000000000000" + - "00000000000000000000" + - "00000000000000000000" + - "00000000000000\x17\x01\x04\x00\x01\x00" + - "\x00\xc0000000000000000000" + - "00000000000000000000" + - "00000000000000000000" + - "000000" - _, err := Decode(strings.NewReader(testdata)) - if err == nil { - t.Fatal("Decode with large IFD entry: got nil error, want non-nil") - } -} - -// benchmarkDecode benchmarks the decoding of an image. -func benchmarkDecode(b *testing.B, filename string) { - b.StopTimer() - contents, err := ioutil.ReadFile(testdataDir + filename) - if err != nil { - b.Fatal(err) - } - r := &buffer{buf: contents} - b.StartTimer() - for i := 0; i < b.N; i++ { - _, err := Decode(r) - if err != nil { - b.Fatal("Decode:", err) - } - } -} - -func BenchmarkDecodeCompressed(b *testing.B) { benchmarkDecode(b, "video-001.tiff") } -func BenchmarkDecodeUncompressed(b *testing.B) { benchmarkDecode(b, "video-001-uncompressed.tiff") } diff --git a/Godeps/_workspace/src/golang.org/x/image/tiff/writer_test.go b/Godeps/_workspace/src/golang.org/x/image/tiff/writer_test.go deleted file mode 100644 index c8fb7bf37..000000000 --- a/Godeps/_workspace/src/golang.org/x/image/tiff/writer_test.go +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tiff - -import ( - "bytes" - "image" - "io/ioutil" - "os" - "testing" -) - -var roundtripTests = []struct { - filename string - opts *Options -}{ - {"video-001.tiff", nil}, - {"video-001-16bit.tiff", nil}, - {"video-001-gray.tiff", nil}, - {"video-001-gray-16bit.tiff", nil}, - {"video-001-paletted.tiff", nil}, - {"bw-packbits.tiff", nil}, - {"video-001.tiff", &Options{Predictor: true}}, - {"video-001.tiff", &Options{Compression: Deflate}}, - {"video-001.tiff", &Options{Predictor: true, Compression: Deflate}}, -} - -func openImage(filename string) (image.Image, error) { - f, err := os.Open(testdataDir + filename) - if err != nil { - return nil, err - } - defer f.Close() - return Decode(f) -} - -func TestRoundtrip(t *testing.T) { - for _, rt := range roundtripTests { - img, err := openImage(rt.filename) - if err != nil { - t.Fatal(err) - } - out := new(bytes.Buffer) - err = Encode(out, img, rt.opts) - if err != nil { - t.Fatal(err) - } - - img2, err := Decode(&buffer{buf: out.Bytes()}) - if err != nil { - t.Fatal(err) - } - compare(t, img, img2) - } -} - -// TestRoundtrip2 tests that encoding and decoding an image whose -// origin is not (0, 0) gives the same thing. -func TestRoundtrip2(t *testing.T) { - m0 := image.NewRGBA(image.Rect(3, 4, 9, 8)) - for i := range m0.Pix { - m0.Pix[i] = byte(i) - } - out := new(bytes.Buffer) - if err := Encode(out, m0, nil); err != nil { - t.Fatal(err) - } - m1, err := Decode(&buffer{buf: out.Bytes()}) - if err != nil { - t.Fatal(err) - } - compare(t, m0, m1) -} - -func benchmarkEncode(b *testing.B, name string, pixelSize int) { - img, err := openImage(name) - if err != nil { - b.Fatal(err) - } - s := img.Bounds().Size() - b.SetBytes(int64(s.X * s.Y * pixelSize)) - b.ResetTimer() - for i := 0; i < b.N; i++ { - Encode(ioutil.Discard, img, nil) - } -} - -func BenchmarkEncode(b *testing.B) { benchmarkEncode(b, "video-001.tiff", 4) } -func BenchmarkEncodePaletted(b *testing.B) { benchmarkEncode(b, "video-001-paletted.tiff", 1) } -func BenchmarkEncodeGray(b *testing.B) { benchmarkEncode(b, "video-001-gray.tiff", 1) } -func BenchmarkEncodeGray16(b *testing.B) { benchmarkEncode(b, "video-001-gray-16bit.tiff", 2) } -func BenchmarkEncodeRGBA(b *testing.B) { benchmarkEncode(b, "video-001.tiff", 4) } -func BenchmarkEncodeRGBA64(b *testing.B) { benchmarkEncode(b, "video-001-16bit.tiff", 8) } -- cgit v1.2.3-1-g7c22