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

Side by Side Diff: fuzz/Fuzz.h

Issue 1581203003: some fuzz hacking (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: unused 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 | « no previous file | fuzz/FuzzPaeth.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 #ifndef Fuzz_DEFINED 8 #ifndef Fuzz_DEFINED
9 #define Fuzz_DEFINED 9 #define Fuzz_DEFINED
10 10
11 #include "SkData.h" 11 #include "SkData.h"
12 #include "SkTRegistry.h" 12 #include "SkTRegistry.h"
13 #include "SkTypes.h" 13 #include "SkTypes.h"
14 #include <stdlib.h> 14 #include <stdlib.h>
15 15
16 class Fuzz : SkNoncopyable { 16 class Fuzz : SkNoncopyable {
17 public: 17 public:
18 explicit Fuzz(SkData*); 18 explicit Fuzz(SkData*);
19 19
20 uint8_t nextB();
20 uint32_t nextU(); 21 uint32_t nextU();
21 float nextF(); 22 float nextF();
22 23
23 // These return a value in [min, max).
24 uint32_t nextURange(uint32_t min, uint32_t max);
25 float nextFRange(float min, float max);
26
27 private: 24 private:
28 SkAutoTUnref<SkData> fBytes; 25 SkAutoTUnref<SkData> fBytes;
26 int fNextByte;
29 }; 27 };
30 28
31 struct Fuzzable { 29 struct Fuzzable {
32 const char* name; 30 const char* name;
33 void (*fn)(Fuzz*); 31 void (*fn)(Fuzz*);
34 }; 32 };
35 33
36 #define DEF_FUZZ(name, f) \ 34 #define DEF_FUZZ(name, f) \
37 static void fuzz_##name(Fuzz*); \ 35 static void fuzz_##name(Fuzz*); \
38 SkTRegistry<Fuzzable> register_##name({#name, fuzz_##name}); \ 36 SkTRegistry<Fuzzable> register_##name({#name, fuzz_##name}); \
39 static void fuzz_##name(Fuzz* f) 37 static void fuzz_##name(Fuzz* f)
40 38
41 #define ASSERT(cond) do { if (!(cond)) abort(); } while(false) 39 #define ASSERT(cond) do { if (!(cond)) abort(); } while(false)
42 40
43 #endif//Fuzz_DEFINED 41 #endif//Fuzz_DEFINED
OLDNEW
« no previous file with comments | « no previous file | fuzz/FuzzPaeth.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698