1package englishauction23import (4 "testing"56 "gno.land/p/moul/kit/store/v0"7 "gno.land/p/nt/uassert/v0"8)910// v0 asserted that its own key() padded to width 12, and built pendKey on top11// of it. The auction key is now the store's, which has no width to outgrow;12// pending is only point-read, so its key is the plain decimal id.13func TestKeyAndPendKey(t *testing.T) {14 uassert.True(t, store.ID(2).Key() < store.ID(10).Key())15 uassert.True(t, store.ID(999999999999).Key() < store.ID(1000000000000).Key(),16 "one past v0's width-12 ceiling")1718 addr := address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5")19 uassert.Equal(t, "7:"+addr.String(), pendKey(7, addr))20}2122func TestBlocksLeftAndWinner(t *testing.T) {23 a := &Auction{Item: "vase", EndHeight: 100}2425 // before the deadline, blocks remain and there is no winner yet.26 uassert.Equal(t, int64(40), blocksLeft(a, 60))27 uassert.Equal(t, int64(1), blocksLeft(a, 99))28 uassert.False(t, hasWinner(a))2930 // at/after the deadline, no blocks remain.31 uassert.Equal(t, int64(0), blocksLeft(a, 100))32 uassert.Equal(t, int64(0), blocksLeft(a, 150))3334 // a recorded bid makes it a winner.35 a.HighestBid = 50036 a.HighestBidder = address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5")37 uassert.True(t, hasWinner(a))38}39Bid(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, id int64, amount uint64)
End(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, id int64)
Render(path string) string
Start(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, item string, durationBlocks int64) int64
Withdraw(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, id int64) uint64
Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.
vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.