Code organization

Rule text consists of a set of clauses detailed in the tables below. Square brackets (“[” and “]”) indicate optional elements.

querytest main()
  <statements>
end
Define the criteria for a query to be accepted. There must be exactly one querytest with the name “main”. If you don’t wish to specify any query tests then this can contain a single pass statement.
querytest <name>([<identifier>, ...])
  <statements>
end
Define additional query sub-tests which can be called from querytest main().
tabletest main()
  <statements>
end
Define the criteria for the output table to be published. There must be exactly one tabletest with the name “main”. If you don’t wish to specify any table tests then this can contain a single pass statement.
The statements will usually involve calls to other table tests. pass and/or fail statements are used to stop execution and indicate whether the output table should be published or not. The last statement must be a pass or a fail statement which indicates whether the table is published or not by default.
tabletest <name>(<identifier>, ...)
  <statements>
end
Define additional table sub-tests which can be called from tabletest main().
tabledef <name>
for <ident-cat> in <ident-base>.cats
  <statements>
end
A tabledef clause defines a derived table named <name> from the output table slice being checked. It is constructed on first use. The for loop shown is a mandatory part of the syntax.
<name> is a filtered view of table <ident-base> with some variable categories removed. <ident-cat> is set to each category in turn and then the statements are executed. A pass or fail statement (with a condition if specified evaluating to true) which that loop iteration being terminated and that category being included or excluded respectively.
tableprops <ident> [,<ident>...]
for <cell-ident> in <table-ident>.cells
  <statements>
end
A tableprops clause defines one or more constant integer properties which are evaluated on first use for each output table (slice). The for loop shown is a mandatory part of the syntax.
The enclosed statements are executed once per output table slice being checked, but only on first use of any of the specified identifiers. The statements compute values for the identifiers listed
( <ident> ... ). The values of the identifiers are immutable after the statements in the definition have been executed.