mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 05:25:40 +09:00
chore(repo): remove dead code and useless tests (#3375)
This commit is contained in:
1 parent
7e177a1c90
commit
1cd62eb661
1391 files changed
+783
-120415
No files matched your search
@@ -1,8 +1,6 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {FuzzPrng} from '@fluxer/voice_engine_v2/src/fuzz/FuzzPrng';
|
||||
import {
|
||||
EXTERNAL_CONNECTION_EVENT_KINDS,
|
||||
FUZZ_REDUCER_ARBITRARY_ITERATIONS,
|
||||
FUZZ_REDUCER_EXTERNAL_CONNECTION_ITERATIONS,
|
||||
ReducerFuzzer,
|
||||
@@ -23,34 +21,6 @@ describe('ReducerFuzzer.fuzzExternalConnectionCycles', () => {
|
||||
expect(report.dispatched).toBeGreaterThan(0);
|
||||
}
|
||||
});
|
||||
|
||||
it('produces an identical snapshot hash and counters for the same seed (determinism)', () => {
|
||||
for (const seed of SEEDS) {
|
||||
const first = new ReducerFuzzer(seed).fuzzExternalConnectionCycles(256);
|
||||
const second = new ReducerFuzzer(seed).fuzzExternalConnectionCycles(256);
|
||||
expect(first.snapshotHash).toBeDefined();
|
||||
expect(first.snapshotHash).toBe(second.snapshotHash);
|
||||
expect(first.dispatched).toBe(second.dispatched);
|
||||
expect(first.rejected).toBe(second.rejected);
|
||||
expect(first.failures.length).toBe(second.failures.length);
|
||||
}
|
||||
});
|
||||
|
||||
it('produces diverging traces for different seeds', () => {
|
||||
const first = new ReducerFuzzer(1).fuzzExternalConnectionCycles(256);
|
||||
const second = new ReducerFuzzer(2).fuzzExternalConnectionCycles(256);
|
||||
expect(first.snapshotHash === second.snapshotHash && first.dispatched === second.dispatched).toBe(false);
|
||||
});
|
||||
|
||||
it('rejects an iteration budget above the global cap', () => {
|
||||
const fuzzer = new ReducerFuzzer(1);
|
||||
expect(() => fuzzer.fuzzExternalConnectionCycles(1025)).toThrow('iterations must respect FUZZ_ITERATIONS_MAX');
|
||||
});
|
||||
|
||||
it('rejects a non-positive iteration budget', () => {
|
||||
const fuzzer = new ReducerFuzzer(1);
|
||||
expect(() => fuzzer.fuzzExternalConnectionCycles(0)).toThrow('iterations must be >= 1');
|
||||
});
|
||||
});
|
||||
|
||||
describe('ReducerFuzzer arbitrary-order generation with external connection events', () => {
|
||||
@@ -62,35 +32,4 @@ describe('ReducerFuzzer arbitrary-order generation with external connection even
|
||||
expect(report.dispatched + report.rejected).toBe(FUZZ_REDUCER_ARBITRARY_ITERATIONS);
|
||||
}
|
||||
});
|
||||
|
||||
it('remains deterministic across runs with the widened event pool', () => {
|
||||
const first = new ReducerFuzzer(42).fuzzArbitraryOrder(128);
|
||||
const second = new ReducerFuzzer(42).fuzzArbitraryOrder(128);
|
||||
expect(first.dispatched).toBe(second.dispatched);
|
||||
expect(first.rejected).toBe(second.rejected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('external connection event kind catalogue', () => {
|
||||
it('contains exactly the externally-driven connection lifecycle events', () => {
|
||||
expect(EXTERNAL_CONNECTION_EVENT_KINDS).toEqual([
|
||||
'connection.externallyEstablished',
|
||||
'connection.remoteDisconnected',
|
||||
]);
|
||||
});
|
||||
|
||||
it('keeps the seeded PRNG as the only source of randomness for kind selection', () => {
|
||||
const prng = new FuzzPrng({seed: 7});
|
||||
const picks: Array<string> = [];
|
||||
for (let index = 0; index < 32; index += 1) {
|
||||
picks.push(prng.nextChoice(EXTERNAL_CONNECTION_EVENT_KINDS));
|
||||
}
|
||||
const replayPrng = new FuzzPrng({seed: 7});
|
||||
const replays: Array<string> = [];
|
||||
for (let index = 0; index < 32; index += 1) {
|
||||
replays.push(replayPrng.nextChoice(EXTERNAL_CONNECTION_EVENT_KINDS));
|
||||
}
|
||||
expect(picks).toEqual(replays);
|
||||
expect(new Set(picks).size).toBe(2);
|
||||
});
|
||||
});
|
||||
@@ -1,6 +1,5 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {FuzzPrng} from '@fluxer/voice_engine_v2/src/fuzz/FuzzPrng';
|
||||
import {
|
||||
FUZZ_REDUCER_ARBITRARY_ITERATIONS,
|
||||
FUZZ_REDUCER_NEGATIVE_ITERATIONS,
|
||||
@@ -22,14 +21,6 @@ describe('ReducerFuzzer.fuzzPositive', () => {
|
||||
expect(report.failures).toEqual([]);
|
||||
}
|
||||
});
|
||||
|
||||
it('produces identical traces for the same seed (determinism)', () => {
|
||||
const first = new ReducerFuzzer(99).fuzzPositive(64);
|
||||
const second = new ReducerFuzzer(99).fuzzPositive(64);
|
||||
expect(first.dispatched).toBe(second.dispatched);
|
||||
expect(first.rejected).toBe(second.rejected);
|
||||
expect(first.failures.length).toBe(second.failures.length);
|
||||
});
|
||||
});
|
||||
|
||||
describe('ReducerFuzzer.fuzzNegative', () => {
|
||||
@@ -70,35 +61,3 @@ describe('ReducerFuzzer.fuzzArbitraryOrder', () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('FuzzPrng determinism', () => {
|
||||
it('produces the same byte sequence for the same seed', () => {
|
||||
const first = new FuzzPrng({seed: 42, budgetBytes: 64});
|
||||
const second = new FuzzPrng({seed: 42, budgetBytes: 64});
|
||||
const firstBytes: Array<number> = [];
|
||||
const secondBytes: Array<number> = [];
|
||||
for (let i = 0; i < 64; i += 1) firstBytes.push(first.nextByte());
|
||||
for (let i = 0; i < 64; i += 1) secondBytes.push(second.nextByte());
|
||||
expect(firstBytes).toEqual(secondBytes);
|
||||
});
|
||||
|
||||
it('produces different byte sequences for different seeds', () => {
|
||||
const first = new FuzzPrng({seed: 1, budgetBytes: 64});
|
||||
const second = new FuzzPrng({seed: 2, budgetBytes: 64});
|
||||
const firstBytes: Array<number> = [];
|
||||
const secondBytes: Array<number> = [];
|
||||
for (let i = 0; i < 64; i += 1) firstBytes.push(first.nextByte());
|
||||
for (let i = 0; i < 64; i += 1) secondBytes.push(second.nextByte());
|
||||
expect(firstBytes).not.toEqual(secondBytes);
|
||||
});
|
||||
|
||||
it('wraps the cursor when the byte budget is exhausted', () => {
|
||||
const prng = new FuzzPrng({seed: 17, budgetBytes: 16});
|
||||
const head = prng.nextByte();
|
||||
for (let i = 0; i < 15; i += 1) prng.nextByte();
|
||||
expect(prng.bytesConsumed).toBe(0);
|
||||
const wrapped = prng.nextByte();
|
||||
expect(head).toBe(wrapped);
|
||||
expect(prng.bytesConsumed).toBe(1);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user