diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2019-08-23 08:06:19 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-23 08:06:19 -0700 |
| commit | 396c4fc143e783073924dc747a84978f76384c65 (patch) | |
| tree | 3907eadcf1b9fd20236d248eb945b2ad9eec739c /weed/util/bytes_test.go | |
| parent | fa160e00f3ce1c0b79ecb7cbbfb72d2aa5001db4 (diff) | |
| parent | 35d471a8183f0e6ce9502bdcbec94b040463f002 (diff) | |
| download | seaweedfs-396c4fc143e783073924dc747a84978f76384c65.tar.xz seaweedfs-396c4fc143e783073924dc747a84978f76384c65.zip | |
Merge pull request #1054 from chrislusf/revert-1049-master
Revert "use std encoding lib"
Diffstat (limited to 'weed/util/bytes_test.go')
| -rw-r--r-- | weed/util/bytes_test.go | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/weed/util/bytes_test.go b/weed/util/bytes_test.go deleted file mode 100644 index 4e6b3f294..000000000 --- a/weed/util/bytes_test.go +++ /dev/null @@ -1,62 +0,0 @@ -package util - -import ( - "reflect" - "testing" -) - -// go test github.com/chrislusf/seaweedfs/weed/util -run '^(TestAll)$' -v - -func TestAll(t *testing.T) { - for i := 0; i <= 0xff; i += 7 { - assertU16(t, uint16(i)) - } - for i := 0; i <= 0xffff; i += 211 { - assertU32(t, uint32(i)) - } - for i := 0; i <= 0xffffffff; i += 1000000007 { - assertU64(t, uint64(i)) - } -} - -func assertU16(t *testing.T, i uint16) { - var buf1, buf2 [2]byte - Uint16toBytesOld(buf1[:], i) - Uint16toBytes(buf2[:], i) - if !reflect.DeepEqual(buf1, buf2) { - t.Errorf("i: %d, buf1: %v, buf2: %v\n", i, buf1, buf2) - } - v1 := BytesToUint16Old(buf1[:]) - v2 := BytesToUint16(buf2[:]) - if v1 != v2 { - t.Errorf("buf1: %v, v1: %d, buf2: %v, v2: %d\n", buf1, v1, buf2, v2) - } -} - -func assertU32(t *testing.T, i uint32) { - var buf1, buf2 [4]byte - Uint32toBytesOld(buf1[:], i) - Uint32toBytes(buf2[:], i) - if !reflect.DeepEqual(buf1, buf2) { - t.Errorf("i: %d, buf1: %v, buf2: %v\n", i, buf1, buf2) - } - v1 := BytesToUint32Old(buf1[:]) - v2 := BytesToUint32(buf2[:]) - if v1 != v2 { - t.Errorf("buf1: %v, v1: %d, buf2: %v, v2: %d\n", buf1, v1, buf2, v2) - } -} - -func assertU64(t *testing.T, i uint64) { - var buf1, buf2 [8]byte - Uint64toBytesOld(buf1[:], i) - Uint64toBytes(buf2[:], i) - if !reflect.DeepEqual(buf1, buf2) { - t.Errorf("i: %d, buf1: %v, buf2: %v\n", i, buf1, buf2) - } - v1 := BytesToUint64Old(buf1[:]) - v2 := BytesToUint64(buf2[:]) - if v1 != v2 { - t.Errorf("buf1: %v, v1: %d, buf2: %v, v2: %d\n", buf1, v1, buf2, v2) - } -} |
