WWN Test Procedures
Table of Contents
Overview
This document contains test procedures for verifying WWN state transitions, boundary behavior, and URL normalization. The implementation uses:
- WMAX = 8191 = 2¹³ - 1 (Mersenne prime)
- Modulus = 16383
- State space: Zord × Z16383 (discrete torus)
URL Normalization
Out-of-Range w Correction
Visitors arriving with w outside [-8191, 8191] should have their URL
silently corrected via history.replaceState.
| Test | Input w | Expected w | Behavior |
|---|---|---|---|
| N1 | -8192 | 8191 | Wrap via torus |
| N2 | -8193 | 8190 | Wrap via torus |
| N3 | 8192 | -8191 | Wrap via torus |
| N4 | 10000 | -6383 | Wrap via torus |
| N5 | 0 | 0 | No change |
| N6 | 8191 | 8191 | No change (boundary) |
| N7 | -8191 | -8191 | No change (boundary) |
Test N1: Negative overflow
LOAD: ?ord=1&k=1&w=-8192&t=2&d=p&utm_source=ring&utm_medium=webring&utm_campaign=literate-web
EXPECTED: Address bar changes to w=8191 (no redirect, no reload)
Page renders with w=8191 displayed
Test N3: Positive overflow
LOAD: ?ord=1&k=1&w=8192&t=0&d=p EXPECTED: Address bar changes to w=-8191
Next Transitions
Normal next (no wrap)
Position increments without winding change.
LOAD: ?ord=7&k=3&w=5&t=0&d=p ACTION: Click "next →" RESULT: ?ord=7&k=4&w=5&t=0&d=p k: 3 → 4 w: unchanged (no boundary crossing) t: unchanged (no direction reversal) d: p (was p, still p)
Next with ring wrap (k=ord → k=1)
Position wraps, winding increments.
LOAD: ?ord=7&k=7&w=5&t=0&d=p ACTION: Click "next →" RESULT: ?ord=7&k=1&w=6&t=0&d=p k: 7 → 1 (wrap) w: 5 → 6 (boundary crossing) t: unchanged d: p
Next at torus boundary
Winding wraps through the hole.
LOAD: ?ord=1&k=1&w=8191&t=0&d=p ACTION: Click "next →" RESULT: ?ord=1&k=1&w=-8191&t=0&d=p k: 1 → 1 (ord=1, always wraps) w: 8191 → 8192 → wraps to -8191 t: unchanged d: p The hole is real.
Next after prev (direction reversal)
Turning count increments.
LOAD: ?ord=7&k=3&w=0&t=0&d=n ACTION: Click "next →" RESULT: ?ord=7&k=4&w=0&t=1&d=p k: 3 → 4 w: unchanged t: 0 → 1 (direction reversal: was n, now p) d: n → p
Prev Transitions
Normal prev (no wrap)
LOAD: ?ord=7&k=5&w=3&t=0&d=n ACTION: Click "← prev" RESULT: ?ord=7&k=4&w=3&t=0&d=n k: 5 → 4 w: unchanged t: unchanged (was n, still n) d: n
Prev with ring wrap (k=1 → k=ord)
LOAD: ?ord=7&k=1&w=3&t=0&d=n ACTION: Click "← prev" RESULT: ?ord=7&k=7&w=2&t=0&d=n k: 1 → 7 (wrap) w: 3 → 2 (boundary crossing, decrement) t: unchanged d: n
Prev at torus boundary
LOAD: ?ord=1&k=1&w=-8191&t=0&d=n ACTION: Click "← prev" RESULT: ?ord=1&k=1&w=8191&t=0&d=n k: 1 → 1 w: -8191 → -8192 → wraps to 8191 t: unchanged d: n Through the hole, other direction.
Prev after next (direction reversal)
LOAD: ?ord=7&k=3&w=0&t=0&d=p ACTION: Click "← prev" RESULT: ?ord=7&k=2&w=0&t=1&d=n k: 3 → 2 w: unchanged t: 0 → 1 (direction reversal: was p, now n) d: p → n
Auto-Navigation
Auto-next one-shot
LOAD: ?ord=1&k=1&w=8190&t=0&d=p&auto=next RESULT: Redirects to ?ord=1&k=1&w=8191&t=0&d=p auto param stripped (one-shot mode) w: 8190 → 8191 (boundary crossing on ord=1)
Auto-prev one-shot
LOAD: ?ord=1&k=1&w=-8190&t=0&d=n&auto=prev RESULT: Redirects to ?ord=1&k=1&w=-8191&t=0&d=n auto param stripped w: -8190 → -8191
Auto with empty value (inherit direction)
LOAD: ?ord=1&k=1&w=0&t=0&d=n&auto RESULT: Redirects to ?ord=1&k=1&w=-1&t=0&d=n auto="" inherits d=n → fires prev w: 0 → -1
Auto-next through torus hole
LOAD: ?ord=1&k=1&w=8191&t=0&d=p&auto=next RESULT: Redirects to ?ord=1&k=1&w=-8191&t=0&d=p w: 8191 → 8192 → wraps to -8191
Auto-prev through torus hole
LOAD: ?ord=1&k=1&w=-8191&t=0&d=n&auto=prev RESULT: Redirects to ?ord=1&k=1&w=8191&t=0&d=n w: -8191 → -8192 → wraps to 8191
Edge Cases
ord=1 (degenerate ring)
Every action is a boundary crossing.
LOAD: ?ord=1&k=1&w=0&t=0&d=p ACTION: Click "next →" RESULT: ?ord=1&k=1&w=1&t=0&d=p Every next increments w. Every prev decrements w. You are the ring.
High turning count
LOAD: ?ord=3&k=2&w=0&t=100&d=p ACTION: Click "← prev" RESULT: ?ord=3&k=1&w=0&t=101&d=n Oscillator pattern: high t, low w.
Compressed URL mode
With data-wwn-compress-url"true"=:
LOAD: ?w=5&t=2&d=n&utm_source=ring
ACTION: Click "next →"
RESULT: ?w=5&t=3&utm_source=ring
Note: d omitted when p (default)
ord and k not included
Wrap Function Verification
Mathematical verification of wrapW():
function wrapW(w) { var size = 2 * W_MAX + 1; // 16383 var normalized = ((w + W_MAX) % size + size) % size; return normalized - W_MAX; }
| Input w | w + WMAX | % size | + size % size | - WMAX | Result |
|---|---|---|---|---|---|
| 0 | 8191 | 8191 | 8191 | 0 | 0 |
| 8191 | 16382 | 16382 | 16382 | 8191 | 8191 |
| 8192 | 16383 | 0 | 0 | -8191 | -8191 |
| -8191 | 0 | 0 | 0 | -8191 | -8191 |
| -8192 | -1 | -1 | 16382 | 8191 | 8191 |
| 16383 | 24574 | 8191 | 8191 | 0 | 0 |
The double-modulo ((x % n) + n) % n handles JavaScript's negative modulo behavior.
Bot Fingerprinting Signatures
| Behavior | w pattern | t | Torus class |
|---|---|---|---|
| Human browser | low, oscillating | >0 | low-order, non-monotonic |
| Linear scraper | monotonic | 0 | (1, ord)-torus knot |
| Ping-pong bot | ≈0 | →∞ | trivial (contractible) |
| auto=next loop | monotonic to boundary | 0 | knot until browser limit |
