render_example_test.gno
1.24 Kb · 46 lines
1package heapdemo
2
3// ExampleRender pins the realm's Render output as a testable example.
4func ExampleRender() {
5 print(Render(""))
6 // Output:
7 // # Binary Heap
8 //
9 // A priority queue, demoing the [`p/moul/x/daily/heap`](/p/nym-moultest123/x/daily/heap/v0) library.
10 //
11 // ## The workload
12 //
13 // | job | priority |
14 // |---|---|
15 // | send email | 5 |
16 // | pay invoice | 1 |
17 // | backup db | 3 |
18 // | rotate keys | 1 |
19 // | clear cache | 9 |
20 //
21 // ## Min-heap — lowest priority first
22 //
23 // | # | job | priority |
24 // |---|---|---|
25 // | 1 | pay invoice | 1 |
26 // | 2 | rotate keys | 1 |
27 // | 3 | backup db | 3 |
28 // | 4 | send email | 5 |
29 // | 5 | clear cache | 9 |
30 //
31 // ## Max-heap — highest priority first
32 //
33 // | # | job | priority |
34 // |---|---|---|
35 // | 1 | clear cache | 9 |
36 // | 2 | send email | 5 |
37 // | 3 | backup db | 3 |
38 // | 4 | pay invoice | 1 |
39 // | 5 | rotate keys | 1 |
40 //
41 // ## Ties
42 //
43 // `pay invoice` and `rotate keys` share priority 1. Both heaps pop them **oldest-first**: the tiebreak is insertion order and does *not* invert with the heap kind.
44 //
45 // > Without a total order, two nodes could pop equal-priority items in different sequences and render different pages — a consensus bug, not a cosmetic one.
46}