Skip to content

Commit

Permalink
rng scale tests (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubikowski committed Jun 3, 2024
1 parent a055fa0 commit 3a7b34d
Show file tree
Hide file tree
Showing 13 changed files with 360 additions and 25 deletions.
28 changes: 25 additions & 3 deletions test/scale/comparisons/disjoint.function.scale.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Timer } from '../../util/scale/timer.model';

describe('disjoint @ scale', () => {
describe('disjoint ⋅ 2 large sets', () => {
const {multiplesOf1, multiplesOf2, multiplesOf2B } = ScaleTestSets;
const { multiplesOf1, multiplesOf2, multiplesOf2B } = ScaleTestSets;

it('disjoint(of1):'.padEnd(padding), () => {
const result = Timer.time('disjoint', () => disjoint(multiplesOf1));
Expand Down Expand Up @@ -60,7 +60,7 @@ describe('disjoint @ scale', () => {
});

describe('disjoint ⋅ many sets', () => {
const { manyDisjoint, manyEquivalent, someDisjoint, someEquivalent } = ScaleTestSets;
const { manyDisjoint, manyEquivalent, manyRandom, someDisjoint, someEquivalent, someRandom } = ScaleTestSets;
beforeAll(() => Timer.nextLine('disjoint'));

it('disjoint(100 Equivalent):'.padEnd(padding), () => {
Expand All @@ -82,10 +82,20 @@ describe('disjoint @ scale', () => {
const result = Timer.time('disjoint', () => disjoint(...manyDisjoint));
expect(result).toBe(true);
});

it('disjoint(100 Random):'.padEnd(padding), () => {
const result = Timer.time('disjoint', () => disjoint(...someRandom));
expect(result).toBe(false);
});

it('disjoint(10k Random):'.padEnd(padding), () => {
const result = Timer.time('disjoint', () => disjoint(...manyRandom));
expect(result).toBe(false);
});
});

describe('disjoint ⋅ many times', () => {
const { coupleDisjoint, coupleEquivalent, fewDisjoint, fewEquivalent } = ScaleTestSets;
const { coupleDisjoint, coupleEquivalent, coupleRandom, fewDisjoint, fewEquivalent, fewRandom } = ScaleTestSets;
beforeAll(() => Timer.nextLine('disjoint'));

it('100k ⋅ disjoint(2 Equivalent):'.padEnd(padding), () => {
Expand All @@ -111,6 +121,18 @@ describe('disjoint @ scale', () => {
Timer.manyTimes('disjoint', () => disjointMock(...fewDisjoint), times);
expect(disjointMock).toHaveBeenCalledTimes(times);
});

it('100k ⋅ disjoint(2 Random):'.padEnd(padding), () => {
const disjointMock = jest.fn(disjoint);
Timer.time('disjoint', () => coupleRandom.forEach(sets => disjointMock(...sets)));
expect(disjointMock).toHaveBeenCalledTimes(times);
});

it('100k ⋅ disjoint(5 Random):'.padEnd(padding), () => {
const disjointMock = jest.fn(disjoint);
Timer.time('disjoint', () => fewRandom.forEach(sets => disjointMock(...sets)));
expect(disjointMock).toHaveBeenCalledTimes(times);
});
});

afterAll(() => Timer.log('disjoint'));
Expand Down
26 changes: 24 additions & 2 deletions test/scale/comparisons/equivalence.function.scale.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('equivalence @ scale', () => {
});

describe('equivalence ⋅ many sets', () => {
const { manyDisjoint, manyEquivalent, someDisjoint, someEquivalent } = ScaleTestSets;
const { manyDisjoint, manyEquivalent, manyRandom, someDisjoint, someEquivalent, someRandom } = ScaleTestSets;
beforeAll(() => Timer.nextLine('equivalence'));

it('equivalence(100 Equivalent):'.padEnd(padding), () => {
Expand All @@ -82,10 +82,20 @@ describe('equivalence @ scale', () => {
const result = Timer.time('equivalence', () => equivalence(...manyDisjoint));
expect(result).toBe(false);
});

it('equivalence(100 Random):'.padEnd(padding), () => {
const result = Timer.time('equivalence', () => equivalence(...someRandom));
expect(result).toBe(false);
});

it('equivalence(10k Random):'.padEnd(padding), () => {
const result = Timer.time('equivalence', () => equivalence(...manyRandom));
expect(result).toBe(false);
});
});

describe('equivalence ⋅ many times', () => {
const { coupleDisjoint, coupleEquivalent, fewDisjoint, fewEquivalent } = ScaleTestSets;
const { coupleDisjoint, coupleEquivalent, coupleRandom, fewDisjoint, fewEquivalent, fewRandom } = ScaleTestSets;
beforeAll(() => Timer.nextLine('equivalence'));

it('100k ⋅ equivalence(2 Equivalent):'.padEnd(padding), () => {
Expand All @@ -111,6 +121,18 @@ describe('equivalence @ scale', () => {
Timer.manyTimes('equivalence', () => equivalenceMock(...fewDisjoint), times);
expect(equivalenceMock).toHaveBeenCalledTimes(times);
});

it('100k ⋅ equivalence(2 Random):'.padEnd(padding), () => {
const equivalenceMock = jest.fn(equivalence);
Timer.time('equivalence', () => coupleRandom.forEach(sets => equivalenceMock(...sets)));
expect(equivalenceMock).toHaveBeenCalledTimes(times);
});

it('100k ⋅ equivalence(5 Random):'.padEnd(padding), () => {
const equivalenceMock = jest.fn(equivalence);
Timer.time('equivalence', () => fewRandom.forEach(sets => equivalenceMock(...sets)));
expect(equivalenceMock).toHaveBeenCalledTimes(times);
});
});

afterAll(() => Timer.log('equivalence'));
Expand Down
26 changes: 24 additions & 2 deletions test/scale/comparisons/pairwise-disjoint.function.scale.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('pairwise disjoint @ scale', () => {
});

describe('pairwise disjoint ⋅ many sets', () => {
const { manyDisjoint, manyEquivalent, someDisjoint, someEquivalent } = ScaleTestSets;
const { manyDisjoint, manyEquivalent, manyRandom, someDisjoint, someEquivalent, someRandom } = ScaleTestSets;
beforeAll(() => Timer.nextLine('pairwiseDisjoint'));

it('pairwiseDisjoint(100 Equivalent):'.padEnd(padding), () => {
Expand All @@ -82,10 +82,20 @@ describe('pairwise disjoint @ scale', () => {
const result = Timer.time('pairwiseDisjoint', () => pairwiseDisjoint(...manyDisjoint));
expect(result).toBe(true);
});

it('pairwiseDisjoint(100 Random):'.padEnd(padding), () => {
const result = Timer.time('pairwiseDisjoint', () => pairwiseDisjoint(...someRandom));
expect(result).toBe(false);
});

it('pairwiseDisjoint(10k Random):'.padEnd(padding), () => {
const result = Timer.time('pairwiseDisjoint', () => pairwiseDisjoint(...manyRandom));
expect(result).toBe(false);
});
});

describe('pairwise disjoint ⋅ many times', () => {
const { coupleDisjoint, coupleEquivalent, fewDisjoint, fewEquivalent } = ScaleTestSets;
const { coupleDisjoint, coupleEquivalent, coupleRandom, fewDisjoint, fewEquivalent, fewRandom } = ScaleTestSets;
beforeAll(() => Timer.nextLine('pairwiseDisjoint'));

it('100k ⋅ pairwiseDisjoint(2 Equivalent):'.padEnd(padding), () => {
Expand All @@ -111,6 +121,18 @@ describe('pairwise disjoint @ scale', () => {
Timer.manyTimes('pairwiseDisjoint', () => pairwiseDisjointMock(...fewDisjoint), times);
expect(pairwiseDisjointMock).toHaveBeenCalledTimes(times);
});

it('100k ⋅ pairwiseDisjointMock(2 Random):'.padEnd(padding), () => {
const pairwiseDisjointMock = jest.fn(pairwiseDisjoint);
Timer.time('pairwiseDisjoint', () => coupleRandom.forEach(sets => pairwiseDisjointMock(...sets)));
expect(pairwiseDisjointMock).toHaveBeenCalledTimes(times);
});

it('100k ⋅ pairwiseDisjointMock(5 Random):'.padEnd(padding), () => {
const pairwiseDisjointMock = jest.fn(pairwiseDisjoint);
Timer.time('pairwiseDisjoint', () => fewRandom.forEach(sets => pairwiseDisjointMock(...sets)));
expect(pairwiseDisjointMock).toHaveBeenCalledTimes(times);
});
});

afterAll(() => Timer.log('pairwiseDisjoint'));
Expand Down
26 changes: 24 additions & 2 deletions test/scale/comparisons/proper-subset.function.scale.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('proper subset @ scale', () => {
});

describe('proper subset ⋅ many sets', () => {
const { manyDisjoint, manyEquivalent, someDisjoint, someEquivalent } = ScaleTestSets;
const { manyDisjoint, manyEquivalent, manyRandom, someDisjoint, someEquivalent, someRandom } = ScaleTestSets;
beforeAll(() => Timer.nextLine('properSubset'));

it('properSubset(100 Equivalent):'.padEnd(padding), () => {
Expand All @@ -82,10 +82,20 @@ describe('proper subset @ scale', () => {
const result = Timer.time('properSubset', () => properSubset(...manyDisjoint));
expect(result).toBe(false);
});

it('properSubset(100 Random):'.padEnd(padding), () => {
const result = Timer.time('properSubset', () => properSubset(...someRandom));
expect(result).toBe(false);
});

it('properSubset(10k Random):'.padEnd(padding), () => {
const result = Timer.time('properSubset', () => properSubset(...manyRandom));
expect(result).toBe(false);
});
});

describe('proper subset ⋅ many times', () => {
const { coupleDisjoint, coupleEquivalent, fewDisjoint, fewEquivalent } = ScaleTestSets;
const { coupleDisjoint, coupleEquivalent, coupleRandom, fewDisjoint, fewEquivalent, fewRandom } = ScaleTestSets;
beforeAll(() => Timer.nextLine('properSubset'));

it('100k ⋅ properSubset(2 Equivalent):'.padEnd(padding), () => {
Expand All @@ -111,6 +121,18 @@ describe('proper subset @ scale', () => {
Timer.manyTimes('properSubset', () => properSubsetMock(...fewDisjoint), times);
expect(properSubsetMock).toHaveBeenCalledTimes(times);
});

it('100k ⋅ properSubset(2 Random):'.padEnd(padding), () => {
const properSubsetMock = jest.fn(properSubset);
Timer.time('properSubset', () => coupleRandom.forEach(sets => properSubsetMock(...sets)));
expect(properSubsetMock).toHaveBeenCalledTimes(times);
});

it('100k ⋅ properSubset(5 Random):'.padEnd(padding), () => {
const properSubsetMock = jest.fn(properSubset);
Timer.time('properSubset', () => fewRandom.forEach(sets => properSubsetMock(...sets)));
expect(properSubsetMock).toHaveBeenCalledTimes(times);
});
});

afterAll(() => Timer.log('properSubset'));
Expand Down
26 changes: 24 additions & 2 deletions test/scale/comparisons/proper-superset.function.scale.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('proper superset @ scale', () => {
});

describe('proper superset ⋅ many sets', () => {
const { manyDisjoint, manyEquivalent, someDisjoint, someEquivalent } = ScaleTestSets;
const { manyDisjoint, manyEquivalent, manyRandom, someDisjoint, someEquivalent, someRandom } = ScaleTestSets;
beforeAll(() => Timer.nextLine('properSuperset'));

it('properSuperset(100 Equivalent):'.padEnd(padding), () => {
Expand All @@ -82,10 +82,20 @@ describe('proper superset @ scale', () => {
const result = Timer.time('properSuperset', () => properSuperset(...manyDisjoint));
expect(result).toBe(false);
});

it('properSuperset(100 Random):'.padEnd(padding), () => {
const result = Timer.time('properSuperset', () => properSuperset(...someRandom));
expect(result).toBe(false);
});

it('properSuperset(10k Random):'.padEnd(padding), () => {
const result = Timer.time('properSuperset', () => properSuperset(...manyRandom));
expect(result).toBe(false);
});
});

describe('proper superset ⋅ many times', () => {
const { coupleDisjoint, coupleEquivalent, fewDisjoint, fewEquivalent } = ScaleTestSets;
const { coupleDisjoint, coupleEquivalent, coupleRandom, fewDisjoint, fewEquivalent, fewRandom } = ScaleTestSets;
beforeAll(() => Timer.nextLine('properSuperset'));

it('100k ⋅ properSuperset(2 Equivalent):'.padEnd(padding), () => {
Expand All @@ -111,6 +121,18 @@ describe('proper superset @ scale', () => {
Timer.manyTimes('properSuperset', () => properSupersetMock(...fewDisjoint), times);
expect(properSupersetMock).toHaveBeenCalledTimes(times);
});

it('100k ⋅ properSuperset(2 Random):'.padEnd(padding), () => {
const properSupersetMock = jest.fn(properSuperset);
Timer.time('properSuperset', () => coupleRandom.forEach(sets => properSupersetMock(...sets)));
expect(properSupersetMock).toHaveBeenCalledTimes(times);
});

it('100k ⋅ properSuperset(5 Random):'.padEnd(padding), () => {
const properSupersetMock = jest.fn(properSuperset);
Timer.time('properSuperset', () => fewRandom.forEach(sets => properSupersetMock(...sets)));
expect(properSupersetMock).toHaveBeenCalledTimes(times);
});
});

afterAll(() => Timer.log('properSuperset'));
Expand Down
26 changes: 24 additions & 2 deletions test/scale/comparisons/subset.function.scale.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('subset @ scale', () => {
});

describe('subset ⋅ many sets', () => {
const { manyDisjoint, manyEquivalent, someDisjoint, someEquivalent } = ScaleTestSets;
const { manyDisjoint, manyEquivalent, manyRandom, someDisjoint, someEquivalent, someRandom } = ScaleTestSets;
beforeAll(() => Timer.nextLine('subset'));

it('subset(100 Equivalent):'.padEnd(padding), () => {
Expand All @@ -82,10 +82,20 @@ describe('subset @ scale', () => {
const result = Timer.time('subset', () => subset(...manyDisjoint));
expect(result).toBe(false);
});

it('subset(100 Random):'.padEnd(padding), () => {
const result = Timer.time('subset', () => subset(...someRandom));
expect(result).toBe(false);
});

it('subset(10k Random):'.padEnd(padding), () => {
const result = Timer.time('subset', () => subset(...manyRandom));
expect(result).toBe(false);
});
});

describe('subset ⋅ many times', () => {
const { coupleDisjoint, coupleEquivalent, fewDisjoint, fewEquivalent } = ScaleTestSets;
const { coupleDisjoint, coupleEquivalent, coupleRandom, fewDisjoint, fewEquivalent, fewRandom } = ScaleTestSets;
beforeAll(() => Timer.nextLine('subset'));

it('100k ⋅ subset(2 Equivalent):'.padEnd(padding), () => {
Expand All @@ -111,6 +121,18 @@ describe('subset @ scale', () => {
Timer.manyTimes('subset', () => subsetMock(...fewDisjoint), times);
expect(subsetMock).toHaveBeenCalledTimes(times);
});

it('100k ⋅ subset(2 Random):'.padEnd(padding), () => {
const subsetMock = jest.fn(subset);
Timer.time('subset', () => coupleRandom.forEach(sets => subsetMock(...sets)));
expect(subsetMock).toHaveBeenCalledTimes(times);
});

it('100k ⋅ subset(5 Random):'.padEnd(padding), () => {
const subsetMock = jest.fn(subset);
Timer.time('subset', () => fewRandom.forEach(sets => subsetMock(...sets)));
expect(subsetMock).toHaveBeenCalledTimes(times);
});
});

afterAll(() => Timer.log('subset'));
Expand Down
26 changes: 24 additions & 2 deletions test/scale/comparisons/superset.function.scale.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('superset @ scale', () => {
});

describe('superset ⋅ many sets', () => {
const { manyDisjoint, manyEquivalent, someDisjoint, someEquivalent } = ScaleTestSets;
const { manyDisjoint, manyEquivalent, manyRandom, someDisjoint, someEquivalent, someRandom } = ScaleTestSets;
beforeAll(() => Timer.nextLine('superset'));

it('superset(100 Equivalent):'.padEnd(padding), () => {
Expand All @@ -82,10 +82,20 @@ describe('superset @ scale', () => {
const result = Timer.time('superset', () => superset(...manyDisjoint));
expect(result).toBe(false);
});

it('superset(100 Random):'.padEnd(padding), () => {
const result = Timer.time('superset', () => superset(...someRandom));
expect(result).toBe(false);
});

it('superset(10k Random):'.padEnd(padding), () => {
const result = Timer.time('superset', () => superset(...manyRandom));
expect(result).toBe(false);
});
});

describe('superset ⋅ many times', () => {
const { coupleDisjoint, coupleEquivalent, fewDisjoint, fewEquivalent } = ScaleTestSets;
const { coupleDisjoint, coupleEquivalent, coupleRandom, fewDisjoint, fewEquivalent, fewRandom } = ScaleTestSets;
beforeAll(() => Timer.nextLine('superset'));

it('100k ⋅ superset(2 Equivalent):'.padEnd(padding), () => {
Expand All @@ -111,6 +121,18 @@ describe('superset @ scale', () => {
Timer.manyTimes('superset', () => supersetMock(...fewDisjoint), times);
expect(supersetMock).toHaveBeenCalledTimes(times);
});

it('100k ⋅ superset(2 Random):'.padEnd(padding), () => {
const supersetMock = jest.fn(superset);
Timer.time('superset', () => coupleRandom.forEach(sets => supersetMock(...sets)));
expect(supersetMock).toHaveBeenCalledTimes(times);
});

it('100k ⋅ superset(5 Random):'.padEnd(padding), () => {
const supersetMock = jest.fn(superset);
Timer.time('superset', () => fewRandom.forEach(sets => supersetMock(...sets)));
expect(supersetMock).toHaveBeenCalledTimes(times);
});
});

afterAll(() => Timer.log('superset'));
Expand Down
Loading

0 comments on commit 3a7b34d

Please sign in to comment.