<?xml version="1.0" encoding="UTF-8"?>
<Mission xmlns="Tethys"
       xmlns:Control="Tethys/Control"
       xmlns:Guidance="Tethys/Guidance" 
       xmlns:Units="Tethys/Units"
       xmlns:Universal="Tethys/Universal"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="Tethys http://okeanids.mbari.org/tethys/Xml/Tethys.xsd
                           Tethys/Control http://okeanids.mbari.org/tethys/Xml/Control.xsd
                           Tethys/Guidance http://okeanids.mbari.org/tethys/Xml/Guidance.xsd
                           Tethys/Units http://okeanids.mbari.org/tethys/Xml/Units.xsd
                           Tethys/Universal http://okeanids.mbari.org/tethys/Xml/Universal.xsd"
       Id="TestMission">

<!--
TEST_WITH_VALGRIND
TEST_CODE_START

passed = True

TEST_CODE_END
-->

    <DefineArg Name="True"><True/></DefineArg>

    <DefineArg Name="False"><False/></DefineArg>

    <DefineArg Name="One"><Units:count/><Value>1</Value></DefineArg>

    <DefineArg Name="Two"><Units:count/><Value>2</Value></DefineArg>

<!-- Define Eight as 2 * ( 2 + 2 ) -->

    <DefineArg Name="Eight"><Arg Name="Two"/><Mult><Arg Name="Two"/><Add><Arg Name="Two"/></Add></Mult></DefineArg>

    <Aggregate>

        <When>
            <True/>
        </When>

        <Syslog>Ok with Units:bool Value:1</Syslog>

        <Guidance:Wait>
            <Sequence/>
            <Timeout Duration="P2M" />
        </Guidance:Wait>

    </Aggregate>

    <Aggregate>

        <When>
            <False/>
        </When>

        <Syslog Severity="Critical">Should not see this with Units:bool Value:0</Syslog>

    </Aggregate>

    <Aggregate>

        <When>
            <True/>
            <Eq><True/></Eq>
        </When>

        <Syslog>Ok with Units:bool Value:1 EQ Units:bool Value:1</Syslog>

        <Guidance:Wait>
            <Sequence/>
            <Timeout Duration="P2M" />
        </Guidance:Wait>

    </Aggregate>

    <Aggregate>

        <When>
            <True/>
            <Eq><False/></Eq>
        </When>

        <Syslog Severity="Critical">Should not see this with Units:bool Value:1 EQ Units:bool Value:0</Syslog>

    </Aggregate>

    <Aggregate>

        <When>
            <True/>
        </When>

        <Syslog>Ok with True</Syslog>

        <Guidance:Wait>
            <Sequence/>
            <Timeout Duration="P2M" />
        </Guidance:Wait>

    </Aggregate>

    <Aggregate>

        <When>
            <False/>
        </When>

        <Syslog Severity="Critical">Should not see this with with False</Syslog>

    </Aggregate>

    <Aggregate>

        <When>
            <Not><False/></Not>
        </When>

        <Syslog>Ok with Not False</Syslog>

        <Guidance:Wait>
            <Sequence/>
            <Timeout Duration="P2M" />
        </Guidance:Wait>

    </Aggregate>

    <Aggregate>

        <When>
            <Not><True/></Not>
        </When>

        <Syslog Severity="Critical">Should not see this with with Not True</Syslog>

    </Aggregate>

    <Aggregate>

        <When>
            <True/>
            <Eq><True/></Eq>
        </When>

        <Syslog>Ok with True Eq True</Syslog>

        <Guidance:Wait>
            <Sequence/>
            <Timeout Duration="P2M" />
        </Guidance:Wait>

    </Aggregate>

    <Aggregate>

        <When>
            <True/>
            <Eq><False/></Eq>
        </When>

        <Syslog Severity="Critical">Should not see this with True Eq False</Syslog>

    </Aggregate>

    <Aggregate>

        <When>
            <True/>
            <Ne><False/></Ne>
        </When>

        <Syslog>Ok with True Ne False</Syslog>

        <Guidance:Wait>
            <Sequence/>
            <Timeout Duration="P2M" />
        </Guidance:Wait>

    </Aggregate>

    <Aggregate>

        <When>
            <False/>
            <Ne><False/></Ne>
        </When>

        <Syslog Severity="Critical">Should not see this with False Ne False</Syslog>

    </Aggregate>

    <Aggregate>

        <When>
            <False/>
            <Ne><True/></Ne>
        </When>

        <Syslog>Ok with False Ne True</Syslog>

        <Guidance:Wait>
            <Sequence/>
            <Timeout Duration="P2M" />
        </Guidance:Wait>

    </Aggregate>

    <Aggregate>

        <When>
            <True/>
            <Ne><True/></Ne>
        </When>

        <Syslog Severity="Critical">Should not see this with True Ne True</Syslog>

    </Aggregate>

    <Aggregate>

        <When>
            <Arg Name="True"/>
        </When>

        <Syslog>Ok with Arg Name="True"</Syslog>

        <Guidance:Wait>
            <Sequence/>
            <Timeout Duration="P2M" />
        </Guidance:Wait>

    </Aggregate>

    <Aggregate>

        <When>
            <Arg Name="False"/>
        </When>

        <Syslog Severity="Critical">Should not see this with Arg Name="False"</Syslog>

    </Aggregate>

    <Aggregate>

        <When>
            <Arg Name="One"/>
            <Add><Arg Name="One"/></Add>

            <Eq><Arg Name="Two"/></Eq>
        </When>

        <Syslog>Ok with Args 1 + 1 = 2</Syslog>

        <Guidance:Wait>
            <Sequence/>
            <Timeout Duration="P2M" />
        </Guidance:Wait>

    </Aggregate>

    <Aggregate>

        <When>
            <Arg Name="Two"/>
            <Eq><Arg Name="One"/><Add><Arg Name="One"/></Add></Eq>
        </When>

        <Syslog>Ok with Args 2 = 1 + 1</Syslog>

        <Guidance:Wait>
            <Sequence/>
            <Timeout Duration="P2M" />
        </Guidance:Wait>

    </Aggregate>

    <Aggregate>

        <When>
            <Arg Name="One"/>
            <Add><Units:count/><Value>3</Value></Add>

            <Mult><Arg Name="Two"/></Mult>

            <Eq><Arg Name="Eight"/></Eq>
        </When>

        <Syslog>Ok with( Arg 1 + Value 3 ) * Arg 2 = Arg 8</Syslog>

        <Guidance:Wait>
            <Sequence/>
            <Timeout Duration="P2M" />
        </Guidance:Wait>

    </Aggregate>

    <Aggregate>

        <When>
            <Universal:platform_buoyancy_position/>
            <Mult><Units:meter/><Value>0.5</Value></Mult>

            <Eq><Universal:platform_buoyancy_position/><Div><Units:meter/><Value>2</Value></Div></Eq>
        </When>

        <Syslog>Ok with ( buoyancy * 0.5 ) = ( buoyancy / 2 )</Syslog>

        <Guidance:Wait>
            <Sequence/>
            <Timeout Duration="P2M" />
        </Guidance:Wait>

    </Aggregate>

    <Syslog Severity="None"/>

</Mission>
