Skip to content

Commit

Permalink
Rename generic_tuple into genericTuple
Browse files Browse the repository at this point in the history
Part of 'Migrate to tslint naming convention #70'
  • Loading branch information
dubzzz committed Apr 13, 2018
1 parent 8e92db8 commit b960938
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/check/arbitrary/RecordArbitrary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Random from '../../random/generator/Random';
import Arbitrary from './definition/Arbitrary';

import { option } from './OptionArbitrary';
import { generic_tuple } from './TupleArbitrary';
import { genericTuple } from './TupleArbitrary';

export interface RecordConstraints {
with_deleted_keys?: boolean;
Expand All @@ -11,7 +11,7 @@ export interface RecordConstraints {
function rawRecord<T>(recordModel: { [key: string]: Arbitrary<T> }): Arbitrary<{ [key: string]: T }> {
const keys = Object.keys(recordModel);
const arbs: Arbitrary<T>[] = keys.map(v => recordModel[v]);
return generic_tuple(arbs).map((gs: T[]) => {
return genericTuple(arbs).map((gs: T[]) => {
const obj: { [key: string]: T } = {};
for (let idx = 0; idx !== keys.length; ++idx) obj[keys[idx]] = gs[idx];
return obj;
Expand Down
4 changes: 2 additions & 2 deletions src/check/arbitrary/TupleArbitrary.generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class GenericTupleArbitrary<Ts> extends Arbitrary<Ts[]> {
}
}

function generic_tuple<Ts>(arbs: Arbitrary<Ts>[]): Arbitrary<Ts[]> {
function genericTuple<Ts>(arbs: Arbitrary<Ts>[]): Arbitrary<Ts[]> {
return new GenericTupleArbitrary(arbs);
}

export { GenericTupleArbitrary, generic_tuple };
export { GenericTupleArbitrary, genericTuple };
4 changes: 2 additions & 2 deletions src/check/arbitrary/TupleArbitrary.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { tuple } from './TupleArbitrary.generated';
import { generic_tuple } from './TupleArbitrary.generic';
import { genericTuple } from './TupleArbitrary.generic';

export { tuple, generic_tuple };
export { tuple, genericTuple };
4 changes: 2 additions & 2 deletions src/fast-check-default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
string16bits,
unicodeString
} from './check/arbitrary/StringArbitrary';
import { generic_tuple, tuple } from './check/arbitrary/TupleArbitrary';
import { genericTuple, tuple } from './check/arbitrary/TupleArbitrary';

import { Random } from './random/generator/Random';

Expand Down Expand Up @@ -89,7 +89,7 @@ export {
array,
set,
tuple,
generic_tuple,
genericTuple,
record,
dictionary,
anything,
Expand Down
6 changes: 3 additions & 3 deletions test/unit/check/arbitrary/TupleArbitrary.generic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ import {
} from './TupleArbitrary.properties';

import { char } from '../../../../src/check/arbitrary/CharacterArbitrary';
import { generic_tuple } from '../../../../src/check/arbitrary/TupleArbitrary';
import { genericTuple } from '../../../../src/check/arbitrary/TupleArbitrary';

import * as genericHelper from './generic/GenericArbitraryHelper';

describe('TupleArbitrary', () => {
describe('generic_tuple', () => {
describe('genericTuple', () => {
it('Should generate the same tuple with the same random', () =>
fc.assert(propertySameTupleForSameSeed([dummy(42), dummy(8)], true)));
it('Should shrink tuple within allowed values', () =>
fc.assert(propertyShrinkInRange([dummy(42), dummy(8)], true)));
it('Should not suggest input in tuple shrinked values', () =>
fc.assert(propertyNotSuggestInputInShrink([dummy(42), dummy(8)], true)));
genericHelper.testNoImpactOfMutation(generic_tuple([char(), char()]), tab => {
genericHelper.testNoImpactOfMutation(genericTuple([char(), char()]), tab => {
for (let idx = 0; idx !== tab.length; ++idx) tab[idx] = '.';
});
});
Expand Down
8 changes: 4 additions & 4 deletions test/unit/check/arbitrary/TupleArbitrary.properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fc from '../../../../lib/fast-check';
import Arbitrary from '../../../../src/check/arbitrary/definition/Arbitrary';
import Shrinkable from '../../../../src/check/arbitrary/definition/Shrinkable';
import { integer } from '../../../../src/check/arbitrary/IntegerArbitrary';
import { tuple, generic_tuple } from '../../../../src/check/arbitrary/TupleArbitrary';
import { tuple, genericTuple } from '../../../../src/check/arbitrary/TupleArbitrary';
import Random from '../../../../src/random/generator/Random';

import * as stubRng from '../../stubs/generators';
Expand All @@ -24,7 +24,7 @@ function dummy(id: number) {
}

function propertySameTupleForSameSeed(arbs: DummyArbitrary[], isGeneric?: boolean) {
const arb = isGeneric === true ? generic_tuple(arbs) : tuple(arbs[0], ...arbs.slice(1));
const arb = isGeneric === true ? genericTuple(arbs) : tuple(arbs[0], ...arbs.slice(1));
return fc.property(fc.integer(), seed => {
const mrng1 = stubRng.mutable.fastincrease(seed);
const mrng2 = stubRng.mutable.fastincrease(seed);
Expand All @@ -36,7 +36,7 @@ function propertySameTupleForSameSeed(arbs: DummyArbitrary[], isGeneric?: boolea
}

function propertyShrinkInRange(arbs: DummyArbitrary[], isGeneric?: boolean) {
const arb = isGeneric === true ? generic_tuple(arbs) : tuple(arbs[0], ...arbs.slice(1));
const arb = isGeneric === true ? genericTuple(arbs) : tuple(arbs[0], ...arbs.slice(1));
return fc.property(fc.integer(), seed => {
const mrng = stubRng.mutable.fastincrease(seed);
const shrinkable = arb.generate(mrng);
Expand All @@ -45,7 +45,7 @@ function propertyShrinkInRange(arbs: DummyArbitrary[], isGeneric?: boolean) {
}

function propertyNotSuggestInputInShrink(arbs: DummyArbitrary[], isGeneric?: boolean) {
const arb = isGeneric === true ? generic_tuple(arbs) : tuple(arbs[0], ...arbs.slice(1));
const arb = isGeneric === true ? genericTuple(arbs) : tuple(arbs[0], ...arbs.slice(1));
return fc.property(fc.integer(), seed => {
const mrng = stubRng.mutable.fastincrease(seed);
const shrinkable = arb.generate(mrng);
Expand Down

0 comments on commit b960938

Please sign in to comment.