You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

15 lines
355 B

const fc = require('fast-check');
// Function under test
function isSubstring(pattern, text) {
return text.indexOf(pattern) !== -1;
}
// Property based test
fc.assert(
fc.property(fc.string(), fc.string(), fc.string(), (a, b, c) => {
// For any a, b, c strings
// b is a substring of a + b + c
return isSubstring(b, a + b + c);
}),
);