Update dependencies, enable pruning for vendor/

So, `dep` got an nice new feature to remove tests and non-go files from
`vendor/`, and this brings the size of the vendor directory from ~300MiB
down to ~20MiB. We don that now.
This commit is contained in:
Alexander Neumann
2018-08-01 21:32:15 +02:00
parent 3422c1ca83
commit bff635bc5f
6741 changed files with 26940 additions and 4902031 deletions
-248
View File
@@ -1,248 +0,0 @@
// Copyright (C) 2013-2018 by Maxim Bublis <b@codemonkey.ru>
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package uuid
import (
"bytes"
. "gopkg.in/check.v1"
)
type codecTestSuite struct{}
var _ = Suite(&codecTestSuite{})
func (s *codecTestSuite) TestFromBytes(c *C) {
u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
u1, err := FromBytes(b1)
c.Assert(err, IsNil)
c.Assert(u1, Equals, u)
b2 := []byte{}
_, err = FromBytes(b2)
c.Assert(err, NotNil)
}
func (s *codecTestSuite) BenchmarkFromBytes(c *C) {
bytes := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
for i := 0; i < c.N; i++ {
FromBytes(bytes)
}
}
func (s *codecTestSuite) TestMarshalBinary(c *C) {
u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
b2, err := u.MarshalBinary()
c.Assert(err, IsNil)
c.Assert(bytes.Equal(b1, b2), Equals, true)
}
func (s *codecTestSuite) BenchmarkMarshalBinary(c *C) {
u := NewV4()
for i := 0; i < c.N; i++ {
u.MarshalBinary()
}
}
func (s *codecTestSuite) TestUnmarshalBinary(c *C) {
u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
u1 := UUID{}
err := u1.UnmarshalBinary(b1)
c.Assert(err, IsNil)
c.Assert(u1, Equals, u)
b2 := []byte{}
u2 := UUID{}
err = u2.UnmarshalBinary(b2)
c.Assert(err, NotNil)
}
func (s *codecTestSuite) TestFromString(c *C) {
u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
s2 := "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}"
s3 := "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8"
s4 := "6ba7b8109dad11d180b400c04fd430c8"
s5 := "urn:uuid:6ba7b8109dad11d180b400c04fd430c8"
_, err := FromString("")
c.Assert(err, NotNil)
u1, err := FromString(s1)
c.Assert(err, IsNil)
c.Assert(u1, Equals, u)
u2, err := FromString(s2)
c.Assert(err, IsNil)
c.Assert(u2, Equals, u)
u3, err := FromString(s3)
c.Assert(err, IsNil)
c.Assert(u3, Equals, u)
u4, err := FromString(s4)
c.Assert(err, IsNil)
c.Assert(u4, Equals, u)
u5, err := FromString(s5)
c.Assert(err, IsNil)
c.Assert(u5, Equals, u)
}
func (s *codecTestSuite) BenchmarkFromString(c *C) {
str := "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
for i := 0; i < c.N; i++ {
FromString(str)
}
}
func (s *codecTestSuite) BenchmarkFromStringUrn(c *C) {
str := "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8"
for i := 0; i < c.N; i++ {
FromString(str)
}
}
func (s *codecTestSuite) BenchmarkFromStringWithBrackets(c *C) {
str := "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}"
for i := 0; i < c.N; i++ {
FromString(str)
}
}
func (s *codecTestSuite) TestFromStringShort(c *C) {
// Invalid 35-character UUID string
s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c"
for i := len(s1); i >= 0; i-- {
_, err := FromString(s1[:i])
c.Assert(err, NotNil)
}
}
func (s *codecTestSuite) TestFromStringLong(c *C) {
// Invalid 37+ character UUID string
strings := []string{
"6ba7b810-9dad-11d1-80b4-00c04fd430c8=",
"6ba7b810-9dad-11d1-80b4-00c04fd430c8}",
"{6ba7b810-9dad-11d1-80b4-00c04fd430c8}f",
"6ba7b810-9dad-11d1-80b4-00c04fd430c800c04fd430c8",
}
for _, str := range strings {
_, err := FromString(str)
c.Assert(err, NotNil)
}
}
func (s *codecTestSuite) TestFromStringInvalid(c *C) {
// Invalid UUID string formats
strings := []string{
"6ba7b8109dad11d180b400c04fd430c86ba7b8109dad11d180b400c04fd430c8",
"urn:uuid:{6ba7b810-9dad-11d1-80b4-00c04fd430c8}",
"uuid:urn:6ba7b810-9dad-11d1-80b4-00c04fd430c8",
"uuid:urn:6ba7b8109dad11d180b400c04fd430c8",
"6ba7b8109-dad-11d1-80b4-00c04fd430c8",
"6ba7b810-9dad1-1d1-80b4-00c04fd430c8",
"6ba7b810-9dad-11d18-0b4-00c04fd430c8",
"6ba7b810-9dad-11d1-80b40-0c04fd430c8",
"6ba7b810+9dad+11d1+80b4+00c04fd430c8",
"(6ba7b810-9dad-11d1-80b4-00c04fd430c8}",
"{6ba7b810-9dad-11d1-80b4-00c04fd430c8>",
"zba7b810-9dad-11d1-80b4-00c04fd430c8",
"6ba7b810-9dad11d180b400c04fd430c8",
"6ba7b8109dad-11d180b400c04fd430c8",
"6ba7b8109dad11d1-80b400c04fd430c8",
"6ba7b8109dad11d180b4-00c04fd430c8",
}
for _, str := range strings {
_, err := FromString(str)
c.Assert(err, NotNil)
}
}
func (s *codecTestSuite) TestFromStringOrNil(c *C) {
u := FromStringOrNil("")
c.Assert(u, Equals, Nil)
}
func (s *codecTestSuite) TestFromBytesOrNil(c *C) {
b := []byte{}
u := FromBytesOrNil(b)
c.Assert(u, Equals, Nil)
}
func (s *codecTestSuite) TestMarshalText(c *C) {
u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
b1 := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
b2, err := u.MarshalText()
c.Assert(err, IsNil)
c.Assert(bytes.Equal(b1, b2), Equals, true)
}
func (s *codecTestSuite) BenchmarkMarshalText(c *C) {
u := NewV4()
for i := 0; i < c.N; i++ {
u.MarshalText()
}
}
func (s *codecTestSuite) TestUnmarshalText(c *C) {
u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
b1 := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
u1 := UUID{}
err := u1.UnmarshalText(b1)
c.Assert(err, IsNil)
c.Assert(u1, Equals, u)
b2 := []byte("")
u2 := UUID{}
err = u2.UnmarshalText(b2)
c.Assert(err, NotNil)
}
func (s *codecTestSuite) BenchmarkUnmarshalText(c *C) {
bytes := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
u := UUID{}
for i := 0; i < c.N; i++ {
u.UnmarshalText(bytes)
}
}
var sink string
func (s *codecTestSuite) BenchmarkMarshalToString(c *C) {
u := NewV4()
for i := 0; i < c.N; i++ {
sink = u.String()
}
}
-134
View File
@@ -1,134 +0,0 @@
// Copyright (C) 2013-2018 by Maxim Bublis <b@codemonkey.ru>
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package uuid
import (
. "gopkg.in/check.v1"
)
type genTestSuite struct{}
var _ = Suite(&genTestSuite{})
func (s *genTestSuite) TestNewV1(c *C) {
u := NewV1()
c.Assert(u.Version(), Equals, V1)
c.Assert(u.Variant(), Equals, VariantRFC4122)
u1 := NewV1()
u2 := NewV1()
c.Assert(u1, Not(Equals), u2)
oldFunc := epochFunc
epochFunc = func() uint64 { return 0 }
u3 := NewV1()
u4 := NewV1()
c.Assert(u3, Not(Equals), u4)
epochFunc = oldFunc
}
func (s *genTestSuite) BenchmarkNewV1(c *C) {
for i := 0; i < c.N; i++ {
NewV1()
}
}
func (s *genTestSuite) TestNewV2(c *C) {
u1 := NewV2(DomainPerson)
c.Assert(u1.Version(), Equals, V2)
c.Assert(u1.Variant(), Equals, VariantRFC4122)
u2 := NewV2(DomainGroup)
c.Assert(u2.Version(), Equals, V2)
c.Assert(u2.Variant(), Equals, VariantRFC4122)
}
func (s *genTestSuite) BenchmarkNewV2(c *C) {
for i := 0; i < c.N; i++ {
NewV2(DomainPerson)
}
}
func (s *genTestSuite) TestNewV3(c *C) {
u := NewV3(NamespaceDNS, "www.example.com")
c.Assert(u.Version(), Equals, V3)
c.Assert(u.Variant(), Equals, VariantRFC4122)
c.Assert(u.String(), Equals, "5df41881-3aed-3515-88a7-2f4a814cf09e")
u = NewV3(NamespaceDNS, "python.org")
c.Assert(u.String(), Equals, "6fa459ea-ee8a-3ca4-894e-db77e160355e")
u1 := NewV3(NamespaceDNS, "golang.org")
u2 := NewV3(NamespaceDNS, "golang.org")
c.Assert(u1, Equals, u2)
u3 := NewV3(NamespaceDNS, "example.com")
c.Assert(u1, Not(Equals), u3)
u4 := NewV3(NamespaceURL, "golang.org")
c.Assert(u1, Not(Equals), u4)
}
func (s *genTestSuite) BenchmarkNewV3(c *C) {
for i := 0; i < c.N; i++ {
NewV3(NamespaceDNS, "www.example.com")
}
}
func (s *genTestSuite) TestNewV4(c *C) {
u := NewV4()
c.Assert(u.Version(), Equals, V4)
c.Assert(u.Variant(), Equals, VariantRFC4122)
}
func (s *genTestSuite) BenchmarkNewV4(c *C) {
for i := 0; i < c.N; i++ {
NewV4()
}
}
func (s *genTestSuite) TestNewV5(c *C) {
u := NewV5(NamespaceDNS, "www.example.com")
c.Assert(u.Version(), Equals, V5)
c.Assert(u.Variant(), Equals, VariantRFC4122)
u = NewV5(NamespaceDNS, "python.org")
c.Assert(u.String(), Equals, "886313e1-3b8a-5372-9b90-0c9aee199e5d")
u1 := NewV5(NamespaceDNS, "golang.org")
u2 := NewV5(NamespaceDNS, "golang.org")
c.Assert(u1, Equals, u2)
u3 := NewV5(NamespaceDNS, "example.com")
c.Assert(u1, Not(Equals), u3)
u4 := NewV5(NamespaceURL, "golang.org")
c.Assert(u1, Not(Equals), u4)
}
func (s *genTestSuite) BenchmarkNewV5(c *C) {
for i := 0; i < c.N; i++ {
NewV5(NamespaceDNS, "www.example.com")
}
}
-136
View File
@@ -1,136 +0,0 @@
// Copyright (C) 2013-2018 by Maxim Bublis <b@codemonkey.ru>
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package uuid
import (
. "gopkg.in/check.v1"
)
type sqlTestSuite struct{}
var _ = Suite(&sqlTestSuite{})
func (s *sqlTestSuite) TestValue(c *C) {
u, err := FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
c.Assert(err, IsNil)
val, err := u.Value()
c.Assert(err, IsNil)
c.Assert(val, Equals, u.String())
}
func (s *sqlTestSuite) TestValueNil(c *C) {
u := UUID{}
val, err := u.Value()
c.Assert(err, IsNil)
c.Assert(val, Equals, Nil.String())
}
func (s *sqlTestSuite) TestNullUUIDValueNil(c *C) {
u := NullUUID{}
val, err := u.Value()
c.Assert(err, IsNil)
c.Assert(val, IsNil)
}
func (s *sqlTestSuite) TestScanBinary(c *C) {
u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
u1 := UUID{}
err := u1.Scan(b1)
c.Assert(err, IsNil)
c.Assert(u, Equals, u1)
b2 := []byte{}
u2 := UUID{}
err = u2.Scan(b2)
c.Assert(err, NotNil)
}
func (s *sqlTestSuite) TestScanString(c *C) {
u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
u1 := UUID{}
err := u1.Scan(s1)
c.Assert(err, IsNil)
c.Assert(u, Equals, u1)
s2 := ""
u2 := UUID{}
err = u2.Scan(s2)
c.Assert(err, NotNil)
}
func (s *sqlTestSuite) TestScanText(c *C) {
u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
b1 := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
u1 := UUID{}
err := u1.Scan(b1)
c.Assert(err, IsNil)
c.Assert(u, Equals, u1)
b2 := []byte("")
u2 := UUID{}
err = u2.Scan(b2)
c.Assert(err, NotNil)
}
func (s *sqlTestSuite) TestScanUnsupported(c *C) {
u := UUID{}
err := u.Scan(true)
c.Assert(err, NotNil)
}
func (s *sqlTestSuite) TestScanNil(c *C) {
u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
err := u.Scan(nil)
c.Assert(err, NotNil)
}
func (s *sqlTestSuite) TestNullUUIDScanValid(c *C) {
u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
u1 := NullUUID{}
err := u1.Scan(s1)
c.Assert(err, IsNil)
c.Assert(u1.Valid, Equals, true)
c.Assert(u1.UUID, Equals, u)
}
func (s *sqlTestSuite) TestNullUUIDScanNil(c *C) {
u := NullUUID{UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}, true}
err := u.Scan(nil)
c.Assert(err, IsNil)
c.Assert(u.Valid, Equals, false)
c.Assert(u.UUID, Equals, Nil)
}
-90
View File
@@ -1,90 +0,0 @@
// Copyright (C) 2013-2018 by Maxim Bublis <b@codemonkey.ru>
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package uuid
import (
"bytes"
"testing"
. "gopkg.in/check.v1"
)
// Hook up gocheck into the "go test" runner.
func TestUUID(t *testing.T) { TestingT(t) }
type testSuite struct{}
var _ = Suite(&testSuite{})
func (s *testSuite) TestBytes(c *C) {
u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
bytes1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
c.Assert(bytes.Equal(u.Bytes(), bytes1), Equals, true)
}
func (s *testSuite) TestString(c *C) {
c.Assert(NamespaceDNS.String(), Equals, "6ba7b810-9dad-11d1-80b4-00c04fd430c8")
}
func (s *testSuite) TestEqual(c *C) {
c.Assert(Equal(NamespaceDNS, NamespaceDNS), Equals, true)
c.Assert(Equal(NamespaceDNS, NamespaceURL), Equals, false)
}
func (s *testSuite) TestVersion(c *C) {
u := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
c.Assert(u.Version(), Equals, V1)
}
func (s *testSuite) TestSetVersion(c *C) {
u := UUID{}
u.SetVersion(4)
c.Assert(u.Version(), Equals, V4)
}
func (s *testSuite) TestVariant(c *C) {
u1 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
c.Assert(u1.Variant(), Equals, VariantNCS)
u2 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
c.Assert(u2.Variant(), Equals, VariantRFC4122)
u3 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
c.Assert(u3.Variant(), Equals, VariantMicrosoft)
u4 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
c.Assert(u4.Variant(), Equals, VariantFuture)
}
func (s *testSuite) TestSetVariant(c *C) {
u := UUID{}
u.SetVariant(VariantNCS)
c.Assert(u.Variant(), Equals, VariantNCS)
u.SetVariant(VariantRFC4122)
c.Assert(u.Variant(), Equals, VariantRFC4122)
u.SetVariant(VariantMicrosoft)
c.Assert(u.Variant(), Equals, VariantMicrosoft)
u.SetVariant(VariantFuture)
c.Assert(u.Variant(), Equals, VariantFuture)
}