Skip to content

Commit 998d934

Browse files
committed
Separate tests from source code
1 parent b4b4b97 commit 998d934

21 files changed

+110
-110
lines changed

src/Random.test.ts renamed to tests/Random.test.ts

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
1-
import { bool } from "./distribution/bool";
2-
import { date } from "./distribution/date";
3-
import { dice } from "./distribution/dice";
4-
import { die } from "./distribution/die";
5-
import { hex } from "./distribution/hex";
6-
import { int32 } from "./distribution/int32";
7-
import { int53 } from "./distribution/int53";
8-
import { int53Full } from "./distribution/int53Full";
9-
import { integer } from "./distribution/integer";
10-
import { pick } from "./distribution/pick";
11-
import { real } from "./distribution/real";
12-
import { realZeroToOneExclusive } from "./distribution/realZeroToOneExclusive";
13-
import { realZeroToOneInclusive } from "./distribution/realZeroToOneInclusive";
14-
import { sample } from "./distribution/sample";
15-
import { shuffle } from "./distribution/shuffle";
16-
import { string } from "./distribution/string";
17-
import { uint32 } from "./distribution/uint32";
18-
import { uint53 } from "./distribution/uint53";
19-
import { uint53Full } from "./distribution/uint53Full";
20-
import { uuid4 } from "./distribution/uuid4";
21-
import { nativeMath } from "./engine/nativeMath";
22-
import { Random } from "./Random";
23-
import { Distribution, Engine } from "./types";
24-
25-
jest.mock("./distribution/integer");
26-
jest.mock("./distribution/real");
27-
jest.mock("./distribution/bool");
28-
jest.mock("./distribution/pick");
29-
jest.mock("./distribution/shuffle");
30-
jest.mock("./distribution/sample");
31-
jest.mock("./distribution/die");
32-
jest.mock("./distribution/dice");
33-
jest.mock("./distribution/uuid4");
34-
jest.mock("./distribution/string");
35-
jest.mock("./distribution/hex");
36-
jest.mock("./distribution/date");
37-
jest.mock("./distribution/int32");
38-
jest.mock("./distribution/int53");
39-
jest.mock("./distribution/int53Full");
40-
jest.mock("./distribution/realZeroToOneExclusive");
41-
jest.mock("./distribution/realZeroToOneInclusive");
42-
jest.mock("./distribution/uint32");
43-
jest.mock("./distribution/uint53");
44-
jest.mock("./distribution/uint53Full");
1+
import { bool } from "../src/distribution/bool";
2+
import { date } from "../src/distribution/date";
3+
import { dice } from "../src/distribution/dice";
4+
import { die } from "../src/distribution/die";
5+
import { hex } from "../src/distribution/hex";
6+
import { int32 } from "../src/distribution/int32";
7+
import { int53 } from "../src/distribution/int53";
8+
import { int53Full } from "../src/distribution/int53Full";
9+
import { integer } from "../src/distribution/integer";
10+
import { pick } from "../src/distribution/pick";
11+
import { real } from "../src/distribution/real";
12+
import { realZeroToOneExclusive } from "../src/distribution/realZeroToOneExclusive";
13+
import { realZeroToOneInclusive } from "../src/distribution/realZeroToOneInclusive";
14+
import { sample } from "../src/distribution/sample";
15+
import { shuffle } from "../src/distribution/shuffle";
16+
import { string } from "../src/distribution/string";
17+
import { uint32 } from "../src/distribution/uint32";
18+
import { uint53 } from "../src/distribution/uint53";
19+
import { uint53Full } from "../src/distribution/uint53Full";
20+
import { uuid4 } from "../src/distribution/uuid4";
21+
import { nativeMath } from "../src/engine/nativeMath";
22+
import { Random } from "../src/Random";
23+
import { Distribution, Engine } from "../src/types";
24+
25+
jest.mock("../src/distribution/integer");
26+
jest.mock("../src/distribution/real");
27+
jest.mock("../src/distribution/bool");
28+
jest.mock("../src/distribution/pick");
29+
jest.mock("../src/distribution/shuffle");
30+
jest.mock("../src/distribution/sample");
31+
jest.mock("../src/distribution/die");
32+
jest.mock("../src/distribution/dice");
33+
jest.mock("../src/distribution/uuid4");
34+
jest.mock("../src/distribution/string");
35+
jest.mock("../src/distribution/hex");
36+
jest.mock("../src/distribution/date");
37+
jest.mock("../src/distribution/int32");
38+
jest.mock("../src/distribution/int53");
39+
jest.mock("../src/distribution/int53Full");
40+
jest.mock("../src/distribution/realZeroToOneExclusive");
41+
jest.mock("../src/distribution/realZeroToOneInclusive");
42+
jest.mock("../src/distribution/uint32");
43+
jest.mock("../src/distribution/uint53");
44+
jest.mock("../src/distribution/uint53Full");
4545

4646
describe("Random", () => {
4747
describe("constructor", () => {

src/distribution/bool.test.ts renamed to tests/distribution/bool.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { bool } from "./bool";
2-
import { int32 } from "./int32";
3-
import { integer } from "./integer";
4-
import { uint53 } from "./uint53";
5-
6-
jest.mock("./int32");
7-
jest.mock("./uint53");
8-
jest.mock("./integer");
1+
import { bool } from "../../src/distribution/bool";
2+
import { int32 } from "../../src/distribution/int32";
3+
import { integer } from "../../src/distribution/integer";
4+
import { uint53 } from "../../src/distribution/uint53";
5+
6+
jest.mock("../../src/distribution/int32");
7+
jest.mock("../../src/distribution/uint53");
8+
jest.mock("../../src/distribution/integer");
99

1010
describe("bool distribution", () => {
1111
describe("when passed no arguments", () => {

src/distribution/date.test.ts renamed to tests/distribution/date.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { date } from "./date";
2-
import { integer } from "./integer";
1+
import { date } from "../../src/distribution/date";
2+
import { integer } from "../../src/distribution/integer";
33

4-
jest.mock("./integer");
4+
jest.mock("../../src/distribution/integer");
55

66
describe("date distribution", () => {
77
it("returns a wrapped integer distribution from start time to end time", () => {

src/distribution/dice.test.ts renamed to tests/distribution/dice.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { dice } from "./dice";
2-
import { die } from "./die";
1+
import { dice } from "../../src/distribution/dice";
2+
import { die } from "../../src/distribution/die";
33

4-
jest.mock("./die");
4+
jest.mock("../../src/distribution/die");
55

66
describe("dice", () => {
77
function makeReturner<T>(input: ReadonlyArray<T>): () => T {

src/distribution/die.test.ts renamed to tests/distribution/die.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { die } from "./die";
2-
import { integer } from "./integer";
1+
import { die } from "../../src/distribution/die";
2+
import { integer } from "../../src/distribution/integer";
33

4-
jest.mock("./integer");
4+
jest.mock("../../src/distribution/integer");
55

66
describe("die", () => {
77
it("returns an integer distribution from 1 to sideCount", () => {

src/distribution/hex.test.ts renamed to tests/distribution/hex.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { nativeMath } from "../engine/nativeMath";
2-
import { hex } from "./hex";
1+
import { nativeMath } from "../../src/engine/nativeMath";
2+
import { hex } from "../../src/distribution/hex";
33

44
describe("hex", () => {
55
const owns = Object.prototype.hasOwnProperty;

src/distribution/integer.test.ts renamed to tests/distribution/integer.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { MersenneTwister19937 } from "../engine/MersenneTwister19937";
2-
import { Distribution, Engine } from "../types";
3-
import { int32 } from "./int32";
4-
import { int53 } from "./int53";
5-
import { int53Full } from "./int53Full";
6-
import { integer } from "./integer";
7-
import { uint32 } from "./uint32";
8-
import { uint53 } from "./uint53";
9-
import { uint53Full } from "./uint53Full";
1+
import { MersenneTwister19937 } from "../../src/engine/MersenneTwister19937";
2+
import { Distribution, Engine } from "../../src/types";
3+
import { int32 } from "../../src/distribution/int32";
4+
import { int53 } from "../../src/distribution/int53";
5+
import { int53Full } from "../../src/distribution/int53Full";
6+
import { integer } from "../../src/distribution/integer";
7+
import { uint32 } from "../../src/distribution/uint32";
8+
import { uint53 } from "../../src/distribution/uint53";
9+
import { uint53Full } from "../../src/distribution/uint53Full";
1010

1111
describe("integer distribution", () => {
1212
[-Math.pow(2, 53) - 2, -Infinity, NaN, Infinity].forEach(min => {

src/distribution/pick.test.ts renamed to tests/distribution/pick.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { integer } from "./integer";
2-
import { pick } from "./pick";
1+
import { integer } from "../../src/distribution/integer";
2+
import { pick } from "../../src/distribution/pick";
33

4-
jest.mock("./integer");
4+
jest.mock("../../src/distribution/integer");
55

66
describe("pick", () => {
77
describe("with an empty array", () => {

src/distribution/picker.test.ts renamed to tests/distribution/picker.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// import { integer } from "./integer";
2-
import { integer } from "./integer";
3-
import { picker } from "./picker";
2+
import { integer } from "../../src/distribution/integer";
3+
import { picker } from "../../src/distribution/picker";
44

5-
jest.mock("./integer");
5+
jest.mock("../../src/distribution/integer");
66

77
describe("picker", () => {
88
it("throws when passed an empty array", () => {

src/distribution/real.test.ts renamed to tests/distribution/real.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { real } from "./real";
2-
import { realZeroToOneExclusive } from "./realZeroToOneExclusive";
3-
import { realZeroToOneInclusive } from "./realZeroToOneInclusive";
1+
import { real } from "../../src/distribution/real";
2+
import { realZeroToOneExclusive } from "../../src/distribution/realZeroToOneExclusive";
3+
import { realZeroToOneInclusive } from "../../src/distribution/realZeroToOneInclusive";
44

5-
jest.mock("./realZeroToOneExclusive");
6-
jest.mock("./realZeroToOneInclusive");
5+
jest.mock("../../src/distribution/realZeroToOneExclusive");
6+
jest.mock("../../src/distribution/realZeroToOneInclusive");
77

88
describe("real distribution", () => {
99
[-Infinity, NaN, Infinity].forEach(value => {

0 commit comments

Comments
 (0)