WWN Test Procedures

Table of Contents

1. Overview

This document contains test procedures for verifying WWN state transitions, boundary behavior, and URL normalization. The implementation uses:

  • W_MAX = 8191 = 2¹³ - 1 (Mersenne prime)
  • Modulus = 16383
  • State space: Z_ord × Z16383 (discrete torus)

2. URL Normalization

2.1. 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)

2.1.1. 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

2.1.2. Test N3: Positive overflow

LOAD:  ?ord=1&k=1&w=8192&t=0&d=p

EXPECTED: Address bar changes to w=-8191

3. Next Transitions

3.1. 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)

3.2. 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

3.3. 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.

3.4. 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

4. Prev Transitions

4.1. 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

4.2. 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

4.3. 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.

4.4. 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

5. Auto-Navigation

5.1. 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)

5.2. 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

5.3. 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

5.4. 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

5.5. 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

6. Edge Cases

6.1. 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.

6.2. 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.

6.3. 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

7. 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 + W_MAX % size + size % size - W_MAX 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.

8. 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

9. References