generated from okp4/template-oss
-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #585 from okp4/test/block
Test/block
- Loading branch information
Showing
8 changed files
with
317 additions
and
124 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
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
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
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,48 @@ | ||
Feature: block_height/1 | ||
This feature is to test the block_height/2 predicate. | ||
|
||
@great_for_documentation | ||
Scenario: Retrieve the block height of the current block. | ||
This scenario demonstrates how to retrieve the block height of the current block. | ||
|
||
Given a block with the following header: | ||
| Height | 100 | | ||
|
||
Given the query: | ||
""" prolog | ||
block_height(Height). | ||
""" | ||
When the query is run | ||
Then the answer we get is: | ||
""" yaml | ||
has_more: false | ||
variables: ["Height"] | ||
results: | ||
- substitutions: | ||
- variable: Height | ||
expression: "100" | ||
""" | ||
|
||
@great_for_documentation | ||
Scenario: Check that the block height is greater than a certain value. | ||
This scenario demonstrates how to check that the block height is greater than 100. This predicate is useful for | ||
governance which requires a certain block height to be reached before a certain action is taken. | ||
|
||
Given a block with the following header: | ||
| Height | 101 | | ||
|
||
Given the query: | ||
""" prolog | ||
block_height(Height), | ||
Height > 100. | ||
""" | ||
When the query is run | ||
Then the answer we get is: | ||
""" yaml | ||
has_more: false | ||
variables: ["Height"] | ||
results: | ||
- substitutions: | ||
- variable: Height | ||
expression: "101" | ||
""" |
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,49 @@ | ||
Feature: block_time/1 | ||
This feature is to test the block_time/2 predicate. | ||
|
||
@great_for_documentation | ||
Scenario: Retrieve the block time of the current block. | ||
This scenario demonstrates how to retrieve the block time of the current block. | ||
|
||
Given a block with the following header: | ||
| Time | 1709550216 | | ||
|
||
Given the query: | ||
""" prolog | ||
block_time(Time). | ||
""" | ||
When the query is run | ||
Then the answer we get is: | ||
""" yaml | ||
has_more: false | ||
variables: ["Time"] | ||
results: | ||
- substitutions: | ||
- variable: Time | ||
expression: "1709550216" | ||
""" | ||
|
||
@great_for_documentation | ||
Scenario: Check that the block time is greater than a certain time. | ||
This scenario demonstrates how to check that the block time is greater than 1709550216 seconds (Monday 4 March 2024 11:03:36 GMT) | ||
using the `block_time/1` predicate. This predicate is useful for governance which requires a certain block time to be | ||
reached before a certain action is taken. | ||
|
||
Given a block with the following header: | ||
| Time | 1709550217 | | ||
|
||
Given the query: | ||
""" prolog | ||
block_time(Time), | ||
Time > 1709550216. | ||
""" | ||
When the query is run | ||
Then the answer we get is: | ||
""" yaml | ||
has_more: false | ||
variables: ["Time"] | ||
results: | ||
- substitutions: | ||
- variable: Time | ||
expression: "1709550217" | ||
""" |
Oops, something went wrong.