Skip to content

Commit 42aece2

Browse files
committed
Resolve nested tests
1 parent 561dda3 commit 42aece2

File tree

1 file changed

+22
-28
lines changed

1 file changed

+22
-28
lines changed

src/autoencoder.test.ts

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -48,36 +48,30 @@ test('denoise a data sample', async () => {
4848

4949
test('encode and decode a data sample', async () => {
5050
expect(result.error).toBeLessThanOrEqual(errorThresh);
51-
test('encode and decode a data sample', async () => {
52-
expect(result.error).toBeLessThanOrEqual(errorThresh);
53-
54-
const run1$input = [0, 0, 0];
55-
const run1$encoded = xornet.encode(run1$input);
56-
const run1$decoded = xornet.decode(run1$encoded);
57-
58-
const run2$input = [0, 1, 1];
59-
const run2$encoded = xornet.encode(run2$input);
60-
const run2$decoded = xornet.decode(run2$encoded);
61-
62-
for (let i = 0; i < 3; i++)
63-
expect(Math.round(run1$decoded[i])).toBe(run1$input[i]);
64-
for (let i = 0; i < 3; i++)
65-
expect(Math.round(run2$decoded[i])).toBe(run2$input[i]);
66-
});
51+
52+
const run1$input = [0, 0, 0];
53+
const run1$encoded = xornet.encode(run1$input);
54+
const run1$decoded = xornet.decode(run1$encoded);
55+
56+
const run2$input = [0, 1, 1];
57+
const run2$encoded = xornet.encode(run2$input);
58+
const run2$decoded = xornet.decode(run2$encoded);
59+
60+
for (let i = 0; i < 3; i++)
61+
expect(Math.round(run1$decoded[i])).toBe(run1$input[i]);
62+
for (let i = 0; i < 3; i++)
63+
expect(Math.round(run2$decoded[i])).toBe(run2$input[i]);
6764
});
6865

6966
test('test a data sample for anomalies', async () => {
7067
expect(result.error).toBeLessThanOrEqual(errorThresh);
71-
test('test a data sample for anomalies', async () => {
72-
expect(result.error).toBeLessThanOrEqual(errorThresh);
73-
74-
function likelyIncludesAnomalies(...args: number[]) {
75-
expect(xornet.likelyIncludesAnomalies(args, 0.5)).toBe(false);
76-
}
77-
78-
likelyIncludesAnomalies(0, 0, 0);
79-
likelyIncludesAnomalies(0, 1, 1);
80-
likelyIncludesAnomalies(1, 0, 1);
81-
likelyIncludesAnomalies(1, 1, 0);
82-
});
68+
69+
function likelyIncludesAnomalies(...args: number[]) {
70+
expect(xornet.likelyIncludesAnomalies(args, 0.5)).toBe(false);
71+
}
72+
73+
likelyIncludesAnomalies(0, 0, 0);
74+
likelyIncludesAnomalies(0, 1, 1);
75+
likelyIncludesAnomalies(1, 0, 1);
76+
likelyIncludesAnomalies(1, 1, 0);
8377
});

0 commit comments

Comments
 (0)