Using the Testfuncs Tool

The testfuncs tool enables you to test an expression in the iWay Functional Language (iFL). It evaluates the expression and returns a result. The testfuncs tool is intended for technical users. To use the testfuncs tool, type the following command:

Tool testfuncs <path to
an xml document>

This tool supports the set subcommand to set a Special Register (SREG) value. The following example shows how to test a SREG with arithmetic:

funcs->set aa 1
stored
funcs->sreg(aa)+2
<superroot [baseNode]>
   <arith [funcNodeMath]>+
      <sreg [funcNodeFunctionSreg]>sreg(aa)
         <p-literal [funcNodeLit]>aa</p-literal>
      </sreg>
      <x-literal [funcNodeLit]>2</x-literal>
   </arith>
</superroot>
3
funcs->

The following example may be more easier to follow:

funcs->_substr('abcde',2,4)
<superroot [baseNode]>
   <substr [funcNodeFunctionStr.substr]>_substr(&apos;abcde&apos;,2,4)
      <p-literal [funcNodeLit]>abcde</p-literal>
      <p-literal [funcNodeLit]>2</p-literal>
      <p-literal [funcNodeLit]>4</p-literal>
   </substr>
</superroot>
cd
funcs->

Each test shows the abstract syntax tree that results from when the function is compiled. Problems with the compilation can usually be understood by analysis of the tree. Some function testing requires use of SREGs. The following command sets the specified SREG to the designated value:

set regname value

The value operand is evaluated, so that a value can, for example, reside in a file. If the value after evaluation begins with a left bracket, the test tool assumes that the value is to be parsed as XML and an XML tree is to be loaded into the named register. Otherwise, the register is set to a string of the input value. To set register one to the value valone, use:

funcs->set one valone
stored

A file in the root named sregdoc.xml contains an XML document. To load it into a SREG named xmldoc, use the following command:

funcs->set xmldoc file('/sregdoc.xml')
stored xml

iWay Software