(size int)
| 180 | } |
| 181 | |
| 182 | func generateRandFile(size int) (p string, m string) { |
| 183 | p = filepath.Join(os.TempDir(), "fcgict"+strconv.Itoa(rand.Int())) |
| 184 | |
| 185 | // open output file |
| 186 | fo, err := os.Create(p) |
| 187 | if err != nil { |
| 188 | panic(err) |
| 189 | } |
| 190 | // close fo on exit and check for its returned error |
| 191 | defer func() { |
| 192 | if err := fo.Close(); err != nil { |
| 193 | panic(err) |
| 194 | } |
| 195 | }() |
| 196 | |
| 197 | h := md5.New() |
| 198 | for i := 0; i < size/16; i++ { |
| 199 | buf := make([]byte, 16) |
| 200 | binary.PutVarint(buf, rand.Int64()) |
| 201 | if _, err := fo.Write(buf); err != nil { |
| 202 | log.Printf("[ERROR] failed to write buffer: %v\n", err) |
| 203 | } |
| 204 | if _, err := h.Write(buf); err != nil { |
| 205 | log.Printf("[ERROR] failed to write buffer: %v\n", err) |
| 206 | } |
| 207 | } |
| 208 | m = fmt.Sprintf("%x", h.Sum(nil)) |
| 209 | return p, m |
| 210 | } |
| 211 | |
| 212 | func DisabledTest(t *testing.T) { |
| 213 | // TODO: test chunked reader |
no test coverage detected