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

Side by Side Diff: src/pkg/container/vector/stringvector_test.go

Issue 1814043: code review 1814043: container/vector: rename Data() -> Copy() (Closed)
Patch Set: code review 1814043: container/vector: rename Data() -> Copy() Created 14 years, 8 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 | « src/pkg/container/vector/stringvector.go ('k') | src/pkg/container/vector/vector.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 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // CAUTION: If this file is not vector_test.go, it was generated 5 // CAUTION: If this file is not vector_test.go, it was generated
6 // automatically from vector_test.go - DO NOT EDIT in that case! 6 // automatically from vector_test.go - DO NOT EDIT in that case!
7 7
8 package vector 8 package vector
9 9
10 import "testing" 10 import "testing"
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 } 319 }
320 count++ 320 count++
321 }) 321 })
322 if count != n { 322 if count != n {
323 t.Error(tname(c), "c) should visit", n, "values; did visit", cou nt) 323 t.Error(tname(c), "c) should visit", n, "values; did visit", cou nt)
324 } 324 }
325 325
326 } 326 }
327 327
328 328
329 func TestStrVectorData(t *testing.T) { 329 func TestStrVectorCopy(t *testing.T) {
330 » // verify Data() returns a slice of a copy, not a slice of the original vector 330 » // verify Copy() returns a copy, not simply a slice of the original vect or
331 const Len = 10 331 const Len = 10
332 var src StringVector 332 var src StringVector
333 for i := 0; i < Len; i++ { 333 for i := 0; i < Len; i++ {
334 src.Push(int2StrValue(i * i)) 334 src.Push(int2StrValue(i * i))
335 } 335 }
336 » dest := src.Data() 336 » dest := src.Copy()
337 for i := 0; i < Len; i++ { 337 for i := 0; i < Len; i++ {
338 src[i] = int2StrValue(-1) 338 src[i] = int2StrValue(-1)
339 v := elem2StrValue(dest[i]) 339 v := elem2StrValue(dest[i])
340 if v != int2StrValue(i*i) { 340 if v != int2StrValue(i*i) {
341 t.Error(tname(src), "expected", i*i, "got", v) 341 t.Error(tname(src), "expected", i*i, "got", v)
342 } 342 }
343 } 343 }
344 } 344 }
OLDNEW
« no previous file with comments | « src/pkg/container/vector/stringvector.go ('k') | src/pkg/container/vector/vector.go » ('j') | no next file with comments »

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