Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(202)

Side by Side Diff: trivial/trivial_test.go

Issue 8322043: state: add environment persistency with UUID (Closed)
Patch Set: state: add environment persistency with UUID Created 11 years, 12 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « state/watcher.go ('k') | trivial/uuid.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package trivial_test 1 package trivial_test
2 2
3 import ( 3 import (
4 . "launchpad.net/gocheck" 4 . "launchpad.net/gocheck"
5 "launchpad.net/juju-core/trivial" 5 "launchpad.net/juju-core/trivial"
6 "strings" 6 "strings"
7 "testing" 7 "testing"
8 "time" 8 "time"
9 ) 9 )
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 cdata := trivial.Gzip(data) 100 cdata := trivial.Gzip(data)
101 c.Assert(len(cdata) < len(data), Equals, true) 101 c.Assert(len(cdata) < len(data), Equals, true)
102 data1, err := trivial.Gunzip(cdata) 102 data1, err := trivial.Gunzip(cdata)
103 c.Assert(err, IsNil) 103 c.Assert(err, IsNil)
104 c.Assert(data1, DeepEquals, data) 104 c.Assert(data1, DeepEquals, data)
105 105
106 data1, err = trivial.Gunzip(compressedData) 106 data1, err = trivial.Gunzip(compressedData)
107 c.Assert(err, IsNil) 107 c.Assert(err, IsNil)
108 c.Assert(data1, DeepEquals, data) 108 c.Assert(data1, DeepEquals, data)
109 } 109 }
110
111 func (trivialSuite) TestUUID(c *C) {
112 uuid, err := trivial.NewUUID()
113 c.Assert(err, IsNil)
114 uuidCopy := uuid.Copy()
115 uuidRaw := uuid.Raw()
116 uuidStr := uuid.String()
117 c.Assert(uuidRaw, HasLen, 16)
118 c.Assert(uuidStr, Matches, "[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[8,9,a, b][0-9a-f]{3}-[0-9a-f]{12}")
119 uuid[0] = 0x00
120 uuidCopy[0] = 0xFF
121 c.Assert(uuid, Not(DeepEquals), uuidCopy)
122 uuidRaw[0] = 0xFF
123 c.Assert(uuid, Not(DeepEquals), uuidRaw)
124 nextUUID, err := trivial.NewUUID()
125 c.Assert(err, IsNil)
126 c.Assert(uuid, Not(DeepEquals), nextUUID)
127 }
OLDNEW
« no previous file with comments | « state/watcher.go ('k') | trivial/uuid.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b