|
@ -20,13 +20,8 @@ function arbArray(gen) { |
|
|
return qc.arbArray(gen); |
|
|
return qc.arbArray(gen); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function arbArrays(gen) { |
|
|
function arbStrings() { |
|
|
return function() { |
|
|
return qc.arbArray(qc.arbString); |
|
|
return qc.arbArray( |
|
|
|
|
|
function () { |
|
|
|
|
|
return qc.arbArray(gen); |
|
|
|
|
|
}) |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -73,15 +68,21 @@ function dictProp(pairs) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function opMatchProp(strings) { |
|
|
function opMatchProp(strings) { |
|
|
console.log(typeof strings); |
|
|
|
|
|
if (strings.length < 1) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
var match = tools.opMatch(strings); |
|
|
var match = tools.opMatch(strings); |
|
|
return _.map(strings, |
|
|
var result = _.every(_.map(strings, |
|
|
function(str) { |
|
|
function (str) { |
|
|
return match(str); |
|
|
if (str.replace(/ /g,'').length < 1) { |
|
|
}); |
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
var res = match(str); |
|
|
|
|
|
if (res !== false) { |
|
|
|
|
|
console.log(str); |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
return false; |
|
|
|
|
|
}), |
|
|
|
|
|
_.identity); |
|
|
|
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function extendProp(pair) { |
|
|
function extendProp(pair) { |
|
@ -100,7 +101,7 @@ function toolsTests() { |
|
|
assert.equal(true, tools.empty([])); |
|
|
assert.equal(true, tools.empty([])); |
|
|
assert.equal(true, qc.forAll(dictProp, arbArrayofPairs)); |
|
|
assert.equal(true, qc.forAll(dictProp, arbArrayofPairs)); |
|
|
assert.equal(true, qc.forAll(extendProp, arbPairs)); |
|
|
assert.equal(true, qc.forAll(extendProp, arbPairs)); |
|
|
assert.equal(true, qc.forAll(opMatchProp, arbArrays(qc.arbString))); |
|
|
//assert.equal(true, qc.forAll(opMatchProp, arbStrings));
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|