This page has no translation to 日本語 yet. The original English version is below. If you’d like to help, great! See how to translate a documentation page in the contribution guide.

Tabtest Reference

Each tabtest is represented as a table, where:

  • the first row contains pin labels or the special time flow name
  • all subsequent rows contain cells with some input and expected output values. See literals section for details.
  • each row is one test case that executes within one transaction of a XOD program
  • if the tested node contains some state inside it will be shared between all test cases

Literals #

Generally, literals for tabtests are the same that are used in the Inspector. But also there are few special literals for tabtests only.

Numbers #

Literal Meaning Description
23, -76 Integers
0.035, -29.7054 Floats
NaN NaN It's "valid" Number, that can be produced sometimes. For example, by diving zero by zero.
Inf, -Inf Infinities Note, that these Numbers are bigger or smaller even than maximum or minimum possible values of type uint32.
0.123~, -384.7583~ Approximate floats Special literals for tabtests and for expected outputs only. Since we're dealing with floats in the XOD some math can give us float numbers like 0.49999999999 or sometimes the same calculation may give us 0.50000000001, but both of them expected as 0.5. Alternatively, another one example: -384.75833333 can be expected as -384.7583. So when you put a tilde at the end of the number it tells to test runner with desired precision we want to test: 0.5~ or -384.7583~. All the next numbers are rounded.

Strings #

Literal Meaning Description
"Hello, World!" String Note that string should be enquoted
"He said: \"Hello\"" String with quotes To use quotes inside string escape them with backslashes

Booleans #

Literal Meaning Description
true True
false False

Pulses #

Literal Meaning Description
pulse Send or Expect Pulse If pulse is defined for input it means that we send pulse. For output — expecting pulse in this transaction.
no-pulse Do not send or expect no pulse If no-pulse is defined for input it means that we do not send pulse. For output — expecting there will be no pulse in this transaction.

Time flow column #

Name the column: __time(ms)

Values can be non-negative integers.

If you test something with defer nodes inside, do not forget to increment the time on each test case or defer node on the execution of the next test case will think that is the same transaction and won’t fire the output pulse or output-value.

Found a typo or mistake? Want to improve the text? Edit this page on GitHub and open a pull request. If you have a complex proposal or you want to discuss the content, feel free to start a new thread on XOD forum.