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

Delta Between Two Patch Sets: src/pkg/fmt/scan_test.go

Issue 4440062: code review 4440062: fmt: decrease recursion depth (Closed)
Left Patch Set: Created 13 years, 11 months ago
Right Patch Set: diff -r 6f45b9b388e0 https://go.googlecode.com/hg/ Created 13 years, 11 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 package fmt_test 5 package fmt_test
6 6
7 import ( 7 import (
8 "bufio" 8 "bufio"
9 "bytes" 9 "bytes"
10 . "fmt" 10 . "fmt"
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 } 803 }
804 804
805 func TestScanInts(t *testing.T) { 805 func TestScanInts(t *testing.T) {
806 testScanInts(t, scanInts) 806 testScanInts(t, scanInts)
807 testScanInts(t, func(r *RecursiveInt, b *bytes.Buffer) (err os.Error) { 807 testScanInts(t, func(r *RecursiveInt, b *bytes.Buffer) (err os.Error) {
808 _, err = Fscan(b, r) 808 _, err = Fscan(b, r)
809 return 809 return
810 }) 810 })
811 } 811 }
812 812
813 // 800 is small enough to not overflow the stack when using gccgo on a
814 // platform that does not support split stack.
813 const intCount = 800 815 const intCount = 800
814 816
815 func testScanInts(t *testing.T, scan func(*RecursiveInt, *bytes.Buffer) os.Error ) { 817 func testScanInts(t *testing.T, scan func(*RecursiveInt, *bytes.Buffer) os.Error ) {
816 r := new(RecursiveInt) 818 r := new(RecursiveInt)
817 ints := makeInts(intCount) 819 ints := makeInts(intCount)
818 buf := bytes.NewBuffer(ints) 820 buf := bytes.NewBuffer(ints)
819 err := scan(r, buf) 821 err := scan(r, buf)
820 if err != nil { 822 if err != nil {
821 t.Error("unexpected error", err) 823 t.Error("unexpected error", err)
822 } 824 }
(...skipping 25 matching lines...) Expand all
848 b.ResetTimer() 850 b.ResetTimer()
849 ints := makeInts(intCount) 851 ints := makeInts(intCount)
850 var r RecursiveInt 852 var r RecursiveInt
851 for i := b.N - 1; i >= 0; i-- { 853 for i := b.N - 1; i >= 0; i-- {
852 buf := bytes.NewBuffer(ints) 854 buf := bytes.NewBuffer(ints)
853 b.StartTimer() 855 b.StartTimer()
854 Fscan(buf, &r) 856 Fscan(buf, &r)
855 b.StopTimer() 857 b.StopTimer()
856 } 858 }
857 } 859 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

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