test: F3 acceptance — the classroom classics on FILIUS' examples against Java
A web page by its DNS name (internetwork_komplett), an e-mail between two networks through NAT and MX relay (Internet_Komplett_..._DE), a file found and fetched with Gnutella across a router (zwei_rechnernetze_komplett): ExampleRun records frames, tables, program lines and end states; the core plays the same calls and matches card by card. Equal RIP ties take Java's choice, RIP beacons are left out, the search's two connections compared flow by flow. Also: a core test that an equal RIP route from another router neither replaces nor refreshes the route, and nine stale type errors in core tests fixed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2189,6 +2189,20 @@ describe('RIP', () => {
|
||||
expect(engine.sendIPv4Packet(routerAId, packet)).toEqual({ type: 'icmpError', packetIdentity: packet.identity, nodeId: routerAId, kind: 'destinationNetworkUnreachable' });
|
||||
});
|
||||
|
||||
it('keeps the route it learned first when another router tells one as long', () => {
|
||||
// Java keeps whichever its threads handle first (classicsJava.test.ts, equalRipTies); the engine the first it hears.
|
||||
const engine = ripTopology();
|
||||
fromB(engine, '10.0.0.3\n10.0.0.3\n16\n75000\n203.0.113.0 255.255.255.0 1');
|
||||
const expires = route(engine, routerAId, '203.0.113.0')!.expiresAtMilliseconds;
|
||||
engine.handle({ type: 'advance', toMilliseconds: engine.state.currentTimeMilliseconds + 5_000 });
|
||||
fromB(engine, '10.0.0.2\n10.0.0.2\n16\n75000\n203.0.113.0 255.255.255.0 1');
|
||||
// Nor does that one keep it alive.
|
||||
expect(route(engine, routerAId, '203.0.113.0')).toMatchObject({ metric: 2, nextHop: '10.0.0.3', expiresAtMilliseconds: expires });
|
||||
// A shorter one replaces it.
|
||||
fromB(engine, '10.0.0.2\n10.0.0.2\n16\n75000\n203.0.113.0 255.255.255.0 0');
|
||||
expect(route(engine, routerAId, '203.0.113.0')).toMatchObject({ metric: 1, nextHop: '10.0.0.2' });
|
||||
});
|
||||
|
||||
it('forwards along the fewest hops, then the longest mask, and not along 16 hops', () => {
|
||||
const engine = ripTopology();
|
||||
// The /24 through a router at 10.0.0.3, which is not there.
|
||||
|
||||
Reference in New Issue
Block a user