Initial commit
This commit is contained in:
commit
b3a51a4115
10336 changed files with 2381973 additions and 0 deletions
28
node_modules/fast-check/lib/esm/arbitrary/_internals/SchedulerArbitrary.js
generated
vendored
Normal file
28
node_modules/fast-check/lib/esm/arbitrary/_internals/SchedulerArbitrary.js
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { Arbitrary } from '../../check/arbitrary/definition/Arbitrary.js';
|
||||
import { Value } from '../../check/arbitrary/definition/Value.js';
|
||||
import { Stream } from '../../stream/Stream.js';
|
||||
import { SchedulerImplem } from './implementations/SchedulerImplem.js';
|
||||
function buildNextTaskIndex(mrng) {
|
||||
const clonedMrng = mrng.clone();
|
||||
return {
|
||||
clone: () => buildNextTaskIndex(clonedMrng),
|
||||
nextTaskIndex: (scheduledTasks) => {
|
||||
return mrng.nextInt(0, scheduledTasks.length - 1);
|
||||
},
|
||||
};
|
||||
}
|
||||
export class SchedulerArbitrary extends Arbitrary {
|
||||
constructor(act) {
|
||||
super();
|
||||
this.act = act;
|
||||
}
|
||||
generate(mrng, _biasFactor) {
|
||||
return new Value(new SchedulerImplem(this.act, buildNextTaskIndex(mrng.clone())), undefined);
|
||||
}
|
||||
canShrinkWithoutContext(value) {
|
||||
return false;
|
||||
}
|
||||
shrink(_value, _context) {
|
||||
return Stream.nil();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue