Skip to content

Commit

Permalink
test: rename & improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
ccamel committed Jan 9, 2023
1 parent 2b7e7bc commit da7c1c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 62 deletions.
58 changes: 0 additions & 58 deletions x/logic/predicate/block.test.go

This file was deleted.

9 changes: 5 additions & 4 deletions x/logic/predicate/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ func TestBlock(t *testing.T) {
{header: tmproto.Header{Height: 102}, implication: `block_height(102)`, ok: true},
{header: tmproto.Header{Height: 905}, implication: `block_height(102)`, ok: false},
{header: tmproto.Header{Height: 102}, implication: `block_height(X), X == 102`, ok: true},
{header: tmproto.Header{Height: 102}, implication: `block_height(X), X == 905`, ok: true},
{header: tmproto.Header{Time: time.Unix(1494505756, 0)}, implication: `block_time(102)`, ok: true},
{header: tmproto.Header{Time: time.Unix(1494505757, 0)}, implication: `block_time(102)`, ok: false},
{header: tmproto.Header{Height: 102}, implication: `block_height(X), X == 905`, ok: false},
{header: tmproto.Header{Time: time.Unix(1494505756, 0)}, implication: `block_time(1494505756)`, ok: true},
{header: tmproto.Header{Time: time.Unix(1494505757, 0)}, implication: `block_time(1494505756)`, ok: false},
{header: tmproto.Header{Time: time.Unix(1494505756, 0)}, implication: `block_time(X), X == 1494505756`, ok: true},
{header: tmproto.Header{Time: time.Unix(1494505756, 0)}, implication: `block_time(X), X == 1494505757`, ok: true},
{header: tmproto.Header{Time: time.Unix(1494505756, 0)}, implication: `block_time(X), X == 1494505757`, ok: false},
}
for _, tc := range cases {
convey.Convey(fmt.Sprintf("Given the clause body: %s", tc.implication), t, func() {
Expand All @@ -41,6 +41,7 @@ func TestBlock(t *testing.T) {
convey.Convey("and a vm", func() {
vm := testutil.NewVMMust(ctx)
vm.Register1(engine.NewAtom("block_height"), BlockHeight(ctx))
vm.Register1(engine.NewAtom("block_time"), BlockTime(ctx))
testutil.CompileMust(vm, ctx, fmt.Sprintf("test :- %s.", tc.implication))

convey.Convey("When the predicate is called", func() {
Expand Down

0 comments on commit da7c1c2

Please sign in to comment.