Skip to main content

test

Description

test is a table operator that allows you to write unit tests for symbols in your Gramble code, checking whether the grammar outputs are compatible with the test specifications. It can be a sibling to a symbol or to another table operator and applies to the symbol above it.

Usage examples

In this example, the grammar produced by the symbol Verb consists of six entries (each of the two Root forms concatenated with each of the three Suffix forms). If we want to confirm that the output of Verb contains an entry with the text "calls" as well as an entry with the text form "jumping", we can write a test for it:

Root =textroot
callcall
jumpjump
 
Suffix = texttense
s3SG.PRES
edPAST
ingPRES.PROG
 
Verb =embedembed
RootSuffix
 
test:text
calls
jumping

We can include any fields from the symbol in our test, for example:

test:texttense
calls3SG.PRES
jumpingPRES.PROG

The test can be run by going to the Gramble dropdown menu and selecting either "Run all unit tests on sheet" or by first selecting the cell of the sheet containing the symbol and then going to the dropdown and selecting an option to just run tests for that symbol or reachable from that symbol.

When the test runs in a Google Sheet, any rows that pass it (i.e., the entry in that row can be generated successfuly from the given symbol) will be highlighted in green. Any that fail, where the entry could not be generated, will be highlighted in red with a note saying "TEST FAILED: The grammar above has no outputs compatible with this specification."

For examples of how to run a test to confirm that a form is not in the entries generated by a grammar, see the testnot page.