[sales] Availability.new -> Availability.init
This commit is contained in:
parent
291c506e0b
commit
76be728f61
|
@ -22,7 +22,7 @@ type
|
||||||
func new*(_: type Sales, market: Market): Sales =
|
func new*(_: type Sales, market: Market): Sales =
|
||||||
Sales(market: market)
|
Sales(market: market)
|
||||||
|
|
||||||
proc new*(_: type Availability,
|
proc init*(_: type Availability,
|
||||||
size: uint64,
|
size: uint64,
|
||||||
duration: uint64,
|
duration: uint64,
|
||||||
minPrice: UInt256): Availability =
|
minPrice: UInt256): Availability =
|
||||||
|
|
|
@ -54,4 +54,4 @@ proc example*(_: type Cid): Cid =
|
||||||
Block.example.cid
|
Block.example.cid
|
||||||
|
|
||||||
proc example*(_: type Availability): Availability =
|
proc example*(_: type Availability): Availability =
|
||||||
Availability.new(uint16.example, uint16.example, uint64.example.u256)
|
Availability.init(uint16.example, uint16.example, uint64.example.u256)
|
||||||
|
|
|
@ -32,12 +32,12 @@ suite "Sales":
|
||||||
check sales.available.len == 0
|
check sales.available.len == 0
|
||||||
|
|
||||||
test "generates unique ids for storage availability":
|
test "generates unique ids for storage availability":
|
||||||
let availability1 = Availability.new(size=1, duration=2, minPrice=3.u256)
|
let availability1 = Availability.init(size=1, duration=2, minPrice=3.u256)
|
||||||
let availability2 = Availability.new(size=1, duration=2, minPrice=3.u256)
|
let availability2 = Availability.init(size=1, duration=2, minPrice=3.u256)
|
||||||
check availability1.id != availability2.id
|
check availability1.id != availability2.id
|
||||||
|
|
||||||
test "offers available storage when matching request comes in":
|
test "offers available storage when matching request comes in":
|
||||||
let availability = Availability.new(size=100, duration=60, minPrice=42.u256)
|
let availability = Availability.init(size=100, duration=60, minPrice=42.u256)
|
||||||
sales.add(availability)
|
sales.add(availability)
|
||||||
sales.start()
|
sales.start()
|
||||||
let request = StorageRequest(duration:60.u256, size:100.u256, maxPrice:42.u256)
|
let request = StorageRequest(duration:60.u256, size:100.u256, maxPrice:42.u256)
|
||||||
|
@ -47,7 +47,7 @@ suite "Sales":
|
||||||
sales.stop()
|
sales.stop()
|
||||||
|
|
||||||
test "ignores request when no matching storage is available":
|
test "ignores request when no matching storage is available":
|
||||||
let availability = Availability.new(size=99, duration=60, minPrice=42.u256)
|
let availability = Availability.init(size=99, duration=60, minPrice=42.u256)
|
||||||
sales.add(availability)
|
sales.add(availability)
|
||||||
sales.start()
|
sales.start()
|
||||||
let request = StorageRequest(duration:60.u256, size:100.u256, maxPrice:42.u256)
|
let request = StorageRequest(duration:60.u256, size:100.u256, maxPrice:42.u256)
|
||||||
|
@ -56,7 +56,7 @@ suite "Sales":
|
||||||
sales.stop()
|
sales.stop()
|
||||||
|
|
||||||
test "makes storage unavailable when offer is submitted":
|
test "makes storage unavailable when offer is submitted":
|
||||||
let availability = Availability.new(size=100, duration=60, minPrice=42.u256)
|
let availability = Availability.init(size=100, duration=60, minPrice=42.u256)
|
||||||
sales.add(availability)
|
sales.add(availability)
|
||||||
sales.start()
|
sales.start()
|
||||||
let request = StorageRequest(duration:60.u256, size:100.u256, maxPrice:42.u256)
|
let request = StorageRequest(duration:60.u256, size:100.u256, maxPrice:42.u256)
|
||||||
|
|
Loading…
Reference in New Issue