Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

render_example_test.gno

0.97 Kb · 27 lines
 1package crc32demo
 2
 3// ExampleRender pins the realm's root Render output as a testable example.
 4// The `123456789` row is the standard CRC-32 check value, so this example
 5// doubles as a conformance test for the library.
 6func ExampleRender() {
 7	print(Render(""))
 8	// Output:
 9	// # CRC-32
10	//
11	// The IEEE checksum behind zip, gzip and PNG, demoing the [`p/moul/x/daily/crc32`](/p/moul/x/daily/crc32/v0) library.
12	//
13	// | input | crc32 |
14	// |---|---|
15	// | _(empty)_ | `00000000` |
16	// | `a` | `e8b7be43` |
17	// | `abc` | `352441c2` |
18	// | `123456789` | `cbf43926` |
19	// | `hello world` | `0d4a1185` |
20	// | `hello worle` | `7a4d2113` |
21	//
22	// `123456789` → `cbf43926` is the standard CRC-32 check value, so this table doubles as a conformance test.
23	//
24	// > The last two rows differ by one letter and share no digits: that avalanche is the point.
25	//
26	// > A CRC detects **accidents**, not tampering — it is linear, so a matching message is easy to craft. Never authenticate with it.
27}