test(core): RIP measured with Java FILIUS
RipRun runs rip-chain's three routers in Java FILIUS, each router's random set by reflection to the core's ripSeed, and writes the frames, every change of each RIP table and the calls. converge: the tables fill, a ping at 45 s. expire: R3 falls silent at 10 s; R2 marks its network 16 hops only at its own next beacon, R1 passes it on at once, the ping gets ICMP 3/0. Both match: per sending card the same messages at the same times, every table through the same states. The first 5 s are compared by the state the tables reach, since Java's routers start one after the other. Measured on the JDK: Java's pause divides nextFloat() by 3 in float; the core does too now (a millisecond off in one draw of about 10,000 before). Scenarios name their RIP routers in the new field rip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -431,11 +431,15 @@ describe('UDP sockets', () => {
|
||||
|
||||
describe('Java-compatible randomness', () => {
|
||||
it('draws the same RIP jitter as java.util.Random', () => {
|
||||
// Measured on OpenJDK 21 (30.09.2026): (int) (1000 * 30 * (r.nextFloat() / 3 + 0.84)).
|
||||
const random = new JavaCompatibleRandom(42);
|
||||
|
||||
expect(Array.from({ length: 5 }, () => random.nextRipJitterMilliseconds())).toEqual([
|
||||
32_475, 25_746, 32_032, 25_679, 28_287,
|
||||
]);
|
||||
// new Random(7), the 530th draw: 28145 with Java's float division, 28144 in double.
|
||||
const seven = new JavaCompatibleRandom(7);
|
||||
for (let draw = 0; draw < 529; draw += 1) seven.nextFloat();
|
||||
expect(seven.nextRipJitterMilliseconds()).toBe(28_145);
|
||||
});
|
||||
|
||||
it('matches java.util.Random.nextInt for bounded and power-of-two ranges', () => {
|
||||
|
||||
Reference in New Issue
Block a user