Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Side by Side Diff: fuzz/FuzzPaeth.cpp

Issue 1585353002: fuzz: signalBug() / signalBoring() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: stdlib for abs() Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fuzz/Fuzz.h ('k') | fuzz/fuzz.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "Fuzz.h" 8 #include "Fuzz.h"
9 #include <stdlib.h>
9 10
10 // This really is just an example Fuzz*.cpp file. 11 // This really is just an example Fuzz*.cpp file.
11 // It tests that two different ways of calculating the Paeth predictor function are equivalent. 12 // It tests that two different ways of calculating the Paeth predictor function are equivalent.
12 13
13 static uint8_t paeth_std(uint8_t a, uint8_t b, uint8_t c) { 14 static uint8_t paeth_std(uint8_t a, uint8_t b, uint8_t c) {
14 int p = a+b-c; 15 int p = a+b-c;
15 16
16 int pa = abs(p-a), 17 int pa = abs(p-a),
17 pb = abs(p-b), 18 pb = abs(p-b),
18 pc = abs(p-c); 19 pc = abs(p-c);
(...skipping 10 matching lines...) Expand all
29 30
30 if (c <= min+delta) return max; 31 if (c <= min+delta) return max;
31 if (c >= max-delta) return min; 32 if (c >= max-delta) return min;
32 return c; 33 return c;
33 } 34 }
34 35
35 DEF_FUZZ(Paeth, fuzz) { 36 DEF_FUZZ(Paeth, fuzz) {
36 auto a = fuzz->nextB(), 37 auto a = fuzz->nextB(),
37 b = fuzz->nextB(), 38 b = fuzz->nextB(),
38 c = fuzz->nextB(); 39 c = fuzz->nextB();
39 ASSERT(paeth_alt(a,b,c) == paeth_std(a,b,c)); 40 SkDebugf("Paeth(%d,%d,%d)\n", a,b,c);
41
42 if (a == b && b == c) {
43 fuzz->signalBoring(); // Not really boring, just demoing signalBoring() .
44 }
45
46 if (paeth_alt(a,b,c) != paeth_std(a,b,c)) {
47 fuzz->signalBug();
48 }
40 } 49 }
OLDNEW
« no previous file with comments | « fuzz/Fuzz.h ('k') | fuzz/fuzz.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698