summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMike Morris <michael.patrick.morris@gmail.com>2014-07-14 16:16:20 -0400
committerMike Morris <michael.patrick.morris@gmail.com>2014-07-14 16:16:20 -0400
commit97ec3766141052e557a4eb8c39883fd1b7d6536f (patch)
treedf895c1c0f694241d8df82a28b50da0f3a7eea30 /bin
parent935089c239ffd3428c6478ba74e147ab338910fe (diff)
downloadqtlocation-mapboxgl-97ec3766141052e557a4eb8c39883fd1b7d6536f.tar.gz
C++ exception with description "array value has unexpected number of elements" thrown in the test body.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/build-style.js4
-rwxr-xr-xbin/fuzz-functions.js27
-rwxr-xr-xbin/fuzz-layers.js23
3 files changed, 53 insertions, 1 deletions
diff --git a/bin/build-style.js b/bin/build-style.js
index 5ef8d317d5..4118faa3c8 100755
--- a/bin/build-style.js
+++ b/bin/build-style.js
@@ -8,7 +8,9 @@ var fs = require('fs');
var transforms = {
'style.min.js': require('./minify.js'),
- 'fuzz-colors.min.js': require('./fuzz-colors.js')
+ 'fuzz-colors.min.js': require('./fuzz-colors.js'),
+ 'fuzz-functions.min.js': require('./fuzz-functions.js'),
+ 'fuzz-layers.min.js': require('./fuzz-layers.js')
};
var source = load(process.argv[2]);
diff --git a/bin/fuzz-functions.js b/bin/fuzz-functions.js
new file mode 100755
index 0000000000..26a079d6d8
--- /dev/null
+++ b/bin/fuzz-functions.js
@@ -0,0 +1,27 @@
+#!/usr/bin/env node
+'use strict';
+
+var through = require('through2');
+var fuzzer = require('fuzzer');
+fuzzer.seed(0);
+
+module.exports = function() {
+ return through.obj(function(chunk, env, callback) {
+ var json = JSON.parse(chunk.toString());
+
+ json.constants = Object.keys(json.constants).reduce(function(obj, key, index) {
+ var value = json.constants[key];
+ if (typeof value === 'object' && value.hasOwnProperty('fn')) {
+ var mutator = fuzzer.mutate.object(value);
+ obj[key] = mutator();
+ }
+ return obj;
+ }, {});
+
+ var data = JSON.stringify(json);
+ this.push(data);
+ callback();
+ });
+};
+
+if (!module.parent) process.stdin.pipe(module.exports()).pipe(process.stdout);
diff --git a/bin/fuzz-layers.js b/bin/fuzz-layers.js
new file mode 100755
index 0000000000..5477757994
--- /dev/null
+++ b/bin/fuzz-layers.js
@@ -0,0 +1,23 @@
+#!/usr/bin/env node
+'use strict';
+
+var through = require('through2');
+var fuzzer = require('fuzzer');
+fuzzer.seed(0);
+
+module.exports = function() {
+ return through.obj(function(chunk, env, callback) {
+ var json = JSON.parse(chunk.toString());
+
+ json.layers.map(function(value) {
+ var mutator = fuzzer.mutate.object(value);
+ return mutator();
+ });
+
+ var data = JSON.stringify(json);
+ this.push(data);
+ callback();
+ });
+};
+
+if (!module.parent) process.stdin.pipe(module.exports()).pipe(process.stdout);