-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
269 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package main | ||
|
||
import ( | ||
"std" | ||
|
||
boards2 "gno.land/r/nt/boards2/v1" | ||
) | ||
|
||
const owner = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1 | ||
|
||
var ( | ||
bid boards2.BoardID | ||
tid boards2.PostID | ||
) | ||
|
||
func init() { | ||
std.TestSetOriginCaller(owner) | ||
bid = boards2.CreateBoard("test123") | ||
tid = boards2.CreateThread(bid, "foo", "bar") | ||
|
||
boards2.FreezeBoard(bid) | ||
} | ||
|
||
func main() { | ||
// Attempt to freeze a thread on frozen board | ||
boards2.FreezeThread(bid, tid) | ||
} | ||
|
||
// Error: | ||
// board is frozen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package main | ||
|
||
import ( | ||
"std" | ||
|
||
boards2 "gno.land/r/nt/boards2/v1" | ||
) | ||
|
||
const owner = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1 | ||
|
||
var ( | ||
bid boards2.BoardID | ||
tid boards2.PostID | ||
) | ||
|
||
func init() { | ||
std.TestSetOriginCaller(owner) | ||
bid = boards2.CreateBoard("test123") | ||
tid = boards2.CreateThread(bid, "foo", "bar") | ||
|
||
boards2.FreezeThread(bid, tid) | ||
} | ||
|
||
func main() { | ||
// Attempt to freeze a frozen thread | ||
boards2.FreezeThread(bid, tid) | ||
} | ||
|
||
// Error: | ||
// thread is frozen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package main | ||
|
||
import ( | ||
"std" | ||
|
||
boards2 "gno.land/r/nt/boards2/v1" | ||
) | ||
|
||
const owner = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1 | ||
|
||
var ( | ||
bid boards2.BoardID | ||
tid boards2.PostID | ||
) | ||
|
||
func init() { | ||
std.TestSetOriginCaller(owner) | ||
bid = boards2.CreateBoard("test123") | ||
tid = boards2.CreateThread(bid, "foo", "bar") | ||
} | ||
|
||
func main() { | ||
println(boards2.IsThreadFrozen(bid, tid)) | ||
boards2.FreezeThread(bid, tid) | ||
println(boards2.IsThreadFrozen(bid, tid)) | ||
} | ||
|
||
// Output: | ||
// false | ||
// true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package main | ||
|
||
import ( | ||
"std" | ||
|
||
boards2 "gno.land/r/nt/boards2/v1" | ||
) | ||
|
||
const owner = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1 | ||
|
||
var ( | ||
bid boards2.BoardID | ||
tid boards2.PostID | ||
) | ||
|
||
func init() { | ||
std.TestSetOriginCaller(owner) | ||
bid = boards2.CreateBoard("test123") | ||
tid = boards2.CreateThread(bid, "foo", "bar") | ||
boards2.FreezeThread(bid, tid) | ||
} | ||
|
||
func main() { | ||
// cannot reply to a frozen thread | ||
boards2.CreateReply(bid, tid, 0, "foobar") | ||
} | ||
|
||
// Error: | ||
// thread is frozen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package main | ||
|
||
import ( | ||
"std" | ||
|
||
boards2 "gno.land/r/nt/boards2/v1" | ||
) | ||
|
||
const owner = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1 | ||
|
||
var ( | ||
bid boards2.BoardID | ||
tid boards2.PostID | ||
rid boards2.PostID | ||
) | ||
|
||
func init() { | ||
std.TestSetOriginCaller(owner) | ||
bid = boards2.CreateBoard("test123") | ||
tid = boards2.CreateThread(bid, "foo", "bar") | ||
rid = boards2.CreateReply(bid, tid, 0, "reply") | ||
|
||
boards2.FreezeThread(bid, tid) | ||
} | ||
|
||
func main() { | ||
// Attempt to freeze a reply on frozen thread | ||
boards2.FreezeReply(bid, tid, rid) | ||
} | ||
|
||
// Error: | ||
// thread is frozen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package main | ||
|
||
import ( | ||
"std" | ||
|
||
boards2 "gno.land/r/nt/boards2/v1" | ||
) | ||
|
||
const owner = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1 | ||
|
||
var ( | ||
bid boards2.BoardID | ||
tid boards2.PostID | ||
rid boards2.PostID | ||
) | ||
|
||
func init() { | ||
std.TestSetOriginCaller(owner) | ||
bid = boards2.CreateBoard("test123") | ||
tid = boards2.CreateThread(bid, "foo", "bar") | ||
rid = boards2.CreateReply(bid, tid, 0, "reply") | ||
|
||
boards2.FreezeReply(bid, tid, rid) | ||
} | ||
|
||
func main() { | ||
// Attempt to freeze already frozen reply | ||
boards2.FreezeReply(bid, tid, rid) | ||
} | ||
|
||
// Error: | ||
// reply is frozen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package main | ||
|
||
import ( | ||
"std" | ||
|
||
boards2 "gno.land/r/nt/boards2/v1" | ||
) | ||
|
||
const owner = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1 | ||
|
||
var ( | ||
bid boards2.BoardID | ||
tid boards2.PostID | ||
rid boards2.PostID | ||
) | ||
|
||
func init() { | ||
std.TestSetOriginCaller(owner) | ||
bid = boards2.CreateBoard("test123") | ||
tid = boards2.CreateThread(bid, "foo", "bar") | ||
rid = boards2.CreateReply(bid, tid, 0, "reply") | ||
} | ||
|
||
func main() { | ||
// reply frozen | ||
println(boards2.IsReplyFrozen(bid, tid, rid)) | ||
boards2.FreezeReply(bid, tid, rid) | ||
println(boards2.IsReplyFrozen(bid, tid, rid)) | ||
boards2.UnfreezeReply(bid, tid, rid) | ||
println(boards2.IsReplyFrozen(bid, tid, rid)) | ||
|
||
// thread frozen | ||
boards2.FreezeThread(bid, tid) | ||
println(boards2.IsReplyFrozen(bid, tid, rid)) | ||
boards2.UnfreezeThread(bid, tid) | ||
println(boards2.IsReplyFrozen(bid, tid, rid)) | ||
|
||
// board frozen | ||
boards2.FreezeBoard(bid) | ||
println(boards2.IsReplyFrozen(bid, tid, rid)) | ||
boards2.UnfreezeBoard(bid) | ||
println(boards2.IsReplyFrozen(bid, tid, rid)) | ||
} | ||
|
||
// Output: | ||
// false | ||
// true | ||
// false | ||
// true | ||
// false | ||
// true | ||
// false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package main | ||
|
||
import ( | ||
"std" | ||
|
||
boards2 "gno.land/r/nt/boards2/v1" | ||
) | ||
|
||
const owner = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1 | ||
|
||
var ( | ||
bid boards2.BoardID | ||
tid boards2.PostID | ||
rid boards2.PostID | ||
) | ||
|
||
func init() { | ||
std.TestSetOriginCaller(owner) | ||
bid = boards2.CreateBoard("test123") | ||
tid = boards2.CreateThread(bid, "foo", "bar") | ||
rid = boards2.CreateReply(bid, tid, 0, "reply") | ||
} | ||
|
||
func main() { | ||
// unfrozen thread - should work | ||
r2 := boards2.CreateReply(bid, tid, rid, "child 1") | ||
|
||
// frozen thread - can't reply | ||
boards2.FreezeReply(bid, tid, rid) | ||
boards2.CreateReply(bid, tid, r2, "child 2") | ||
} | ||
|
||
// Error: | ||
// reply is frozen |