Fix inspections

This commit is contained in:
Christoph Diehl 2017-04-13 05:14:02 +03:00
parent 3ac4c7d281
commit 3a2e88c4b3
10 changed files with 65 additions and 65 deletions

View file

@ -9,4 +9,4 @@ make.arrays = {
return array; return array;
} }
} };

View file

@ -1,6 +1,6 @@
make.colors = { make.colors = {
colors: function() { colors: function() {
return Random.pick([ return random.pick([
make.colorRGB, make.colorRGB,
make.colorHSL, make.colorHSL,
make.colorKeywords make.colorKeywords
@ -10,51 +10,51 @@ make.colors = {
colorRGB: function() { colorRGB: function() {
let values; let values;
switch (Random.number(4)) { switch (random.number(4)) {
case 0: case 0:
// Rgb functional notation // Rgb functional notation
if (Random.bool()) { if (random.bool()) {
// Ints // Ints
values = [Random.number(255), Random.number(255), Random.number(255)]; values = [random.number(255), random.number(255), random.number(255)];
} else { } else {
// Percents // Percents
values = ["%" + Random.number(255), "%" + Random.number(255), "%" + Random.number(255)]; values = ["%" + random.number(255), "%" + random.number(255), "%" + random.number(255)];
} }
return "rgba(" + values.join(',') + ")"; return "rgba(" + values.join(',') + ")";
case 1: case 1:
// Rgba functional notation // Rgba functional notation
values = [Random.number(255), Random.number(255), Random.number(255), Random.float()]; values = [random.number(255), random.number(255), random.number(255), random.float()];
return "rgba(" + values.join(',') + ")"; return "rgba(" + values.join(',') + ")";
case 2: case 2:
// 4 char hex // 4 char hex
return "#" + Random.hex(4); return "#" + random.hex(4);
default: default:
// 8 char hex // 8 char hex
return "#" + Random.hex(8); return "#" + random.hex(8);
} }
}, },
colorHSL: function() { colorHSL: function() {
let values, opt; let values, opt;
switch(Random.number(4)) { switch(random.number(4)) {
case 0: case 0:
values = [Random.number(255), "%" + Random.number(255), "%" + Random.number(255)]; values = [random.number(255), "%" + random.number(255), "%" + random.number(255)];
return "hsl(" + values.join(',') + ")"; return "hsl(" + values.join(',') + ")";
case 1: case 1:
values = [Random.number(255), "%" + Random.number(255), "%" + Random.number(255), "%" + Random.number(255)]; values = [random.number(255), "%" + random.number(255), "%" + random.number(255), "%" + random.number(255)];
return "hsl(" + values.join(',') + ")"; return "hsl(" + values.join(',') + ")";
case 2: case 2:
opt = Random.pick(['deg', 'rad', 'grad', 'turn']); opt = random.pick(['deg', 'rad', 'grad', 'turn']);
values = [Random.number(255) + opt, "%" + Random.number(255), "%" + Random.number(255), "%" + Random.number(255)]; values = [random.number(255) + opt, "%" + random.number(255), "%" + random.number(255), "%" + random.number(255)];
return "hsl(" + values.join(',') + ")"; return "hsl(" + values.join(',') + ")";
default: default:
values = [Random.number(255), "%" + Random.number(255), "%" + Random.number(255), Random.float()]; values = [random.number(255), "%" + random.number(255), "%" + random.number(255), random.float()];
return "hsl(" + values.join(',') + ")"; return "hsl(" + values.join(',') + ")";
} }
}, },
colorKeywords: function() { colorKeywords: function() {
return Random.pick([ return random.pick([
"lime", "red", "blue", "invert", "currentColor", "ActiveBorder", "ActiveCaption", "lime", "red", "blue", "invert", "currentColor", "ActiveBorder", "ActiveCaption",
"AppWorkspace", "Background", "ButtonFace", "ButtonHighlight", "ButtonShadow", "AppWorkspace", "Background", "ButtonFace", "ButtonHighlight", "ButtonShadow",
"ButtonText", "CaptionText", "GrayText", "Highlight", "HighlightText", "ButtonText", "CaptionText", "GrayText", "Highlight", "HighlightText",

View file

@ -1,6 +1,6 @@
make.files = { make.files = {
image: function () { image: function () {
return Utils.quote(random.pick([ return utils.quote(random.pick([
"data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=", "data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=",
"data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==", "data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",
"data:image/gif;base64,R0lGODlhAQABAAAAACwAAAAAAQABAAA=", "data:image/gif;base64,R0lGODlhAQABAAAAACwAAAAAAQABAAA=",
@ -12,13 +12,13 @@ make.files = {
])); ]));
}, },
video: function () { video: function () {
return Utils.quote(random.pick([ return utils.quote(random.pick([
"media/video/video1.webm", "media/video/video1.webm",
"media/video/video2.webm" "media/video/video2.webm"
])); ]));
}, },
audio: function () { audio: function () {
return Utils.quote(random.pick([ return utils.quote(random.pick([
"media/audio/mono-uncompressed-8bit-8000hz.wav", "media/audio/mono-uncompressed-8bit-8000hz.wav",
"media/audio/mono-uncompressed-8bit-44100hz.wav", "media/audio/mono-uncompressed-8bit-44100hz.wav",
"media/audio/mono-uncompressed-32bit-8000hz.wav", "media/audio/mono-uncompressed-32bit-8000hz.wav",
@ -26,16 +26,16 @@ make.files = {
])); ]));
}, },
webvtt: function () { webvtt: function () {
return Utils.quote(random.pick([ return utils.quote(random.pick([
//'data:text/vtt,' + encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 00:00:00.001\ntest');, //'data:text/vtt,' + encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 00:00:00.001\ntest');,
"media/video/sample.vtt" "media/video/sample.vtt"
])); ]));
}, },
file: function () { file: function () {
return random.pick([ return random.pick([
Make.image, make.image,
Make.video, make.video,
Make.audio make.audio
]); ]);
}, },
} };

View file

@ -45,5 +45,5 @@ make.fonts = {
s += " "; s += " ";
s += Make.fontFamily(); s += Make.fontFamily();
return "'" + s + "'"; return "'" + s + "'";
};
} }
};

View file

@ -15,7 +15,7 @@ make.network = {
"a=ptime:20", "a=ptime:20",
"a=rtpmap:0 PCMU/8000", "a=rtpmap:0 PCMU/8000",
"a=rtpmap:8 PCMA/8000", "a=rtpmap:8 PCMA/8000",
"a=rtpmap:101 telephone-event/8000" "a=rtpmap:101 telephone-event/8000",
"a=fmtp:101 0-15", "a=fmtp:101 0-15",
"a=sendrecv", "a=sendrecv",
"a=candidate:0 1 UDP 2113601791 192.168.129.33 52757 typ host", "a=candidate:0 1 UDP 2113601791 192.168.129.33 52757 typ host",
@ -25,7 +25,7 @@ make.network = {
"a=rtpmap:120 VP8/90000", "a=rtpmap:120 VP8/90000",
"a=sendrecv", "a=sendrecv",
"a=candidate:0 1 UDP 2113601791 192.168.129.33 63901 typ host", "a=candidate:0 1 UDP 2113601791 192.168.129.33 63901 typ host",
"a=candidate:0 2 UDP 2113601790 192.168.129.33 54165 typ host" "a=candidate:0 2 UDP 2113601790 192.168.129.33 54165 typ host",
"m=application 65080 SCTP/DTLS 5000", "m=application 65080 SCTP/DTLS 5000",
"c=IN IP4 192.168.129.33", "c=IN IP4 192.168.129.33",
"a=fmtp:5000 protocol=webrtc-datachannel;streams=16", "a=fmtp:5000 protocol=webrtc-datachannel;streams=16",
@ -38,16 +38,16 @@ make.network = {
return ["turn", "turns", "stun", "stuns"] return ["turn", "turns", "stun", "stuns"]
}, },
randomIPv4: function() { randomIPv4: function() {
return Random.pick([Random.number(255), Make.number]) + "." + return random.pick([random.number(255), make.number]) + "." +
Random.pick([Random.number(255), Make.number]) + "." + random.pick([random.number(255), make.number]) + "." +
Random.pick([Random.number(255), Make.number]) + "." + random.pick([random.number(255), make.number]) + "." +
Random.pick([Random.number(255), Make.number]); random.pick([random.number(255), make.number]);
}, },
randomIPv6: function() { randomIPv6: function() {
return "[" + Make.stringFromBlocks([":", function() { return Make.digitsHex(Random.range(1, 4)) }]) + "]" return "[" + make.stringFromBlocks([":", function() { return make.digitsHex(random.range(1, 4)) }]) + "]"
}, },
goodHostnames: function() { return [ goodHostnames: function() { return [
"0.0.0.0" "0.0.0.0",
"127.0.0.1:8080", "127.0.0.1:8080",
]}, ]},
badHostnames: function() { return [ badHostnames: function() { return [
@ -62,16 +62,16 @@ make.network = {
"::ffff:192.0.2.128", "::ffff:192.0.2.128",
"2001:db8::1:2", "2001:db8::1:2",
"2001:db8::1:1:1:1:1" "2001:db8::1:1:1:1:1"
], ]},
randomBitmask: function(list) { randomBitmask: function(list) {
if (list.length <= 1) { if (list.length <= 1) {
return list.join(""); return list.join("");
} }
var max = random.range(2, list.length); let max = random.range(2, list.length);
var mask = random.pick(list); let mask = random.pick(list);
for (var i = 1; i < max; i++) { for (let i = 1; i < max; i++) {
mask += "|" + random.pick(list); mask += "|" + random.pick(list);
} }
return mask; return mask;
}, },
} };

View file

@ -34,11 +34,11 @@ make.numbers = {
return number % 2 == 1 ? ++number : number; return number % 2 == 1 ? ++number : number;
}, },
number: function () { number: function () {
var value = random.choose([ let value = random.choose([
[10, make.float], [10, make.float],
[10, [make.rangeNumber, make.tinyNumber]], [10, [make.rangeNumber, make.tinyNumber]],
[ 1, Make.unsignedNumber] [ 1, Make.unsignedNumber]
]); ]);
return random.chance(10) ? -value : value; return random.chance(10) ? -value : value;
} }
} };

View file

@ -1,9 +1,9 @@
make.shaders = { make.shaders = {
fragment1: function() { fragment1: function() {
[ return [
[ [
"#ifdef GL_ES", "#ifdef GL_ES",
"precision mediump float;" "precision mediump float;",
"#endif", "#endif",
"varying vec4 vColor;", "varying vec4 vColor;",
"void main() {", "void main() {",
@ -19,10 +19,10 @@ make.shaders = {
"gl_FragColor = vec4(texelColor.rgb * vLighting, texelColor.a);", "gl_FragColor = vec4(texelColor.rgb * vLighting, texelColor.a);",
"}" "}"
] ]
], ]
}, },
vertex1: function () { vertex1: function () {
[ return [
[ [
"attribute vec4 aVertex;", "attribute vec4 aVertex;",
"attribute vec4 aColor;", "attribute vec4 aColor;",
@ -55,7 +55,7 @@ make.shaders = {
] ]
}, },
fragment2: function() { fragment2: function() {
[ return [
[ [
"varying highp vec2 vTextureCoord;", "varying highp vec2 vTextureCoord;",
"varying highp vec3 vLighting;", "varying highp vec3 vLighting;",
@ -87,7 +87,7 @@ make.shaders = {
] ]
}, },
vertex2: function() { vertex2: function() {
[ return [
[ [
"attribute highp vec3 aVertexNormal;", "attribute highp vec3 aVertexNormal;",
"attribute highp vec3 aVertexPosition;", "attribute highp vec3 aVertexPosition;",
@ -130,13 +130,13 @@ make.shaders = {
"varyingUV = vertexUV;", "varyingUV = vertexUV;",
"}" "}"
] ]
], ]
}, },
shaderPair: function(v, f) { shaderPair: function(v, f) {
var i = Random.number(v.length); let i = random.number(v.length);
return { return {
vertex: Utils.quote(v[i].join("\n")), vertex: Utils.quote(v[i].join("\n")),
fragment: Utils.quote(f[i].join("\n")) fragment: Utils.quote(f[i].join("\n"))
}; };
}, },
} };

View file

@ -31,8 +31,8 @@ make.strings = {
digitsHex: function (n) { digitsHex: function (n) {
let s = ''; let s = '';
while (n-- > 0) { while (n-- > 0) {
s += (Random.number(16)).toString(16); s += (random.number(16)).toString(16);
} }
return s; return s;
}, },
} };

View file

@ -115,11 +115,11 @@ make.text = {
[0x1D17B, 0x1D18B], [0x1D17B, 0x1D18B],
[0x1D1AA, 0x1D1AD], [0x1D1AA, 0x1D1AD],
[0x1D242, 0x1D244] [0x1D242, 0x1D244]
]), ])},
unicodeBMP: function() { return random.item([ unicodeBMP: function() { return random.item([
// BMP = Basic Multilingual Plane // BMP = Basic Multilingual Plane
[0x0000, 0xFFFF] [0x0000, 0xFFFF]
]), ])},
unicodeSMP: function() { return random.item([ unicodeSMP: function() { return random.item([
// SMP = Supplementary Multilingual Plane // SMP = Supplementary Multilingual Plane
[0x10000, 0x13FFF], [0x10000, 0x13FFF],
@ -127,16 +127,16 @@ make.text = {
[0x1B000, 0x1BFFF], [0x1B000, 0x1BFFF],
[0x1D000, 0x1DFFF], [0x1D000, 0x1DFFF],
[0x1F000, 0x1FFFF] [0x1F000, 0x1FFFF]
]), ])},
unicodeSIP: function() { return random.item([ unicodeSIP: function() { return random.item([
// SIP = Supplementary Ideographic Plane // SIP = Supplementary Ideographic Plane
[0x20000, 0x2BFFF], [0x20000, 0x2BFFF],
[0x2F000, 0x2FFFF] [0x2F000, 0x2FFFF]
]), ])},
unicodeSSP: function() { return random.item([ unicodeSSP: function() { return random.item([
// SSP = Supplementary Special-purpose Plane // SSP = Supplementary Special-purpose Plane
[0xE0000, 0xE0FFF] [0xE0000, 0xE0FFF]
]), ])},
registeredFontFeatures: function() { return random.pick([ registeredFontFeatures: function() { return random.pick([
'aalt', 'abvf', 'abvm', 'abvs', 'afrc', 'akhn', 'blwf', 'blwm', 'blws', 'aalt', 'abvf', 'abvm', 'abvs', 'afrc', 'akhn', 'blwf', 'blwm', 'blws',
'calt', 'case', 'ccmp', 'cfar', 'cjct', 'clig', 'cpct', 'cpsp', 'cswh', 'calt', 'case', 'ccmp', 'cfar', 'cjct', 'clig', 'cpct', 'cpsp', 'cswh',
@ -153,16 +153,16 @@ make.text = {
'ss14', 'ss15', 'ss16', 'ss17', 'ss18', 'ss19', 'ss20', 'subs', 'sups', 'ss14', 'ss15', 'ss16', 'ss17', 'ss18', 'ss19', 'ss20', 'subs', 'sups',
'swsh', 'titl', 'tjmo', 'tnam', 'tnum', 'trad', 'twid', 'unic', 'valt', 'swsh', 'titl', 'tjmo', 'tnam', 'tnum', 'trad', 'twid', 'unic', 'valt',
'vatu', 'vert', 'vhal', 'vjmo', 'vkna', 'vkrn', 'vpal', 'vrt2', 'zero' 'vatu', 'vert', 'vhal', 'vjmo', 'vkna', 'vkrn', 'vpal', 'vrt2', 'zero'
]), ])},
assignmentOperator: function() { return random.pick([ assignmentOperator: function() { return random.pick([
"=", "-=", "+=", "*=", "/=" "=", "-=", "+=", "*=", "/="
]), ])},
arithmeticOperator: function() { return random.pick([ arithmeticOperator: function() { return random.pick([
"%", "-", "+", "*", "/" "%", "-", "+", "*", "/"
]), ])},
currency: function() { return Random.pick([ currency: function() { return random.pick([
// https://en.wikipedia.org/wiki/ISO_4217 // https://en.wikipedia.org/wiki/ISO_4217
"USD", "USS", "USN", "EUR", "CHF", "GBP", "XAG", "XBA", "XBB", "XBC", "USD", "USS", "USN", "EUR", "CHF", "GBP", "XAG", "XBA", "XBB", "XBC",
"XBD", "XSU", "XTS", "XXX", "XBD", "XSU", "XTS", "XXX",
]), ])},
} };

View file

@ -11,4 +11,4 @@ make.types = {
"function() {}" "function() {}"
]); ]);
} }
} };