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

Delta Between Two Patch Sets: src/pkg/image/gif/reader_test.go

Issue 7808045: code review 7808045: image/gif: make test repeatable (Closed)
Left Patch Set: diff -r d448734315d3 https://code.google.com/p/go Created 12 years ago
Right Patch Set: diff -r 19eb878576c6 https://code.google.com/p/go Created 12 years 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 package gif 1 package gif
2 2
3 import ( 3 import (
4 "bytes" 4 "bytes"
5 "compress/lzw" 5 "compress/lzw"
6 "image" 6 "image"
7 "image/color" 7 "image/color"
8 "reflect" 8 "reflect"
9 "testing" 9 "testing"
10 ) 10 )
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 var got string 107 var got string
108 if err != nil { 108 if err != nil {
109 got = err.Error() 109 got = err.Error()
110 } 110 }
111 if got != want { 111 if got != want {
112 t.Fatalf("got %v, want %v", got, want) 112 t.Fatalf("got %v, want %v", got, want)
113 } 113 }
114 } 114 }
115 115
116 func TestBounds(t *testing.T) { 116 func TestBounds(t *testing.T) {
117 » // make a local copy of testGif 117 » // make a local copy of testGIF
118 gif := make([]byte, len(testGIF)) 118 gif := make([]byte, len(testGIF))
119 copy(gif, testGIF) 119 copy(gif, testGIF)
minux1 2013/03/25 09:34:04 is using append([]byte(nil), testGIF...) more idio
dave_cheney.net 2013/03/26 05:20:29 My personal feeling is it is not, I dislike using
120 // Make the bounds too big, just by one. 120 // Make the bounds too big, just by one.
121 gif[32] = 2 121 gif[32] = 2
122 want := "gif: frame bounds larger than image bounds" 122 want := "gif: frame bounds larger than image bounds"
123 try(t, gif, want) 123 try(t, gif, want)
124 124
125 // Make the bounds too small; does not trigger bounds 125 // Make the bounds too small; does not trigger bounds
126 // check, but now there's too much data. 126 // check, but now there's too much data.
127 gif[32] = 0 127 gif[32] = 0
128 want = "gif: too much image data" 128 want = "gif: too much image data"
129 try(t, gif, want) 129 try(t, gif, want)
130 gif[32] = 1 130 gif[32] = 1
131 131
132 // Make the bounds really big, expect an error. 132 // Make the bounds really big, expect an error.
133 want = "gif: frame bounds larger than image bounds" 133 want = "gif: frame bounds larger than image bounds"
134 for i := 0; i < 4; i++ { 134 for i := 0; i < 4; i++ {
135 gif[32+i] = 0xff 135 gif[32+i] = 0xff
136 } 136 }
137 try(t, gif, want) 137 try(t, gif, want)
138 } 138 }
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