diff options
| author | joeslay <54322500+joeslay@users.noreply.github.com> | 2019-08-23 17:03:37 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-23 17:03:37 +0100 |
| commit | 36bde84000e81fb811ba8605b39057b915f6cad3 (patch) | |
| tree | b959d9aa8c0044a793d78383f43b649440a6e696 /weed/util/bytes_test.go | |
| parent | 1e89e719b31d2a26384131e3931ad0e40e54e92f (diff) | |
| parent | 396c4fc143e783073924dc747a84978f76384c65 (diff) | |
| download | seaweedfs-36bde84000e81fb811ba8605b39057b915f6cad3.tar.xz seaweedfs-36bde84000e81fb811ba8605b39057b915f6cad3.zip | |
Merge pull request #1 from chrislusf/master
merge changes from chrislusf/seaweed master
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) - } -} |
