Commit f56fd5f9 authored by Marco Bartolini's avatar Marco Bartolini
Browse files

added more procedure tests

parent d2fd9093
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
@@ -82,5 +82,38 @@ TEST_F(TestProcedure, CProcedureList_getProcedure_by_name_with_params)
        << "error: " << (const char*)cpl->getLastError();
    ASSERT_EQ(args, (WORD)1) 
        << "error: " << (const char*)cpl->getLastError();
    ASSERT_EQ(commands[0], IRA::CString("wait=$1"));
}

TEST_F(TestProcedure,
CProcedureList_getProcedure_by_name_with_params_to_ACSStringSeq)
{
    cpl->readAll(false);
    ACS::stringSeq  commands;
    WORD args;
    bool result = cpl->getProcedure("PROCEDURE_WAIT_PARAM", commands, args);
    ASSERT_TRUE(result) 
        << "error: " << (const char*)cpl->getLastError();
    ASSERT_EQ(args, (WORD)1) 
        << "error: " << (const char*)cpl->getLastError();
    IRA::CString line((const char*)commands[0]);
    ASSERT_EQ(line, IRA::CString("wait=$1"));
}

TEST_F(TestProcedure, replace_procedure_parameters)
{
    const char PARAM = '$';
    cpl->readAll(false);
    ACS::stringSeq  commands;
    WORD args;
    cpl->getProcedure("PROCEDURE_WAIT_PARAM", commands, args);
    IRA::CString line((const char*)commands[0]);
    /* This acts as in Parser Lib, this test should be moved there for
     * consistency */
    IRA::CString params[1] = { IRA::CString("10") };
    IRA::CString param_string;
    param_string.Format("%c%d", PARAM, 1);
    line.ReplaceAll((const char*)param_string,(const char*)params[0]); 
    ASSERT_EQ(line, IRA::CString("wait=10"));
}
+0 −11
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="6" failures="0" disabled="0" errors="0" timestamp="2015-04-13T14:39:13" time="0.008" name="AllTests">
  <testsuite name="TestProcedure" tests="6" failures="0" disabled="0" errors="0" time="0.005">
    <testcase name="can_open_procedure_file" status="run" time="0.001" classname="TestProcedure" />
    <testcase name="CProcedureList_constructor" status="run" time="0" classname="TestProcedure" />
    <testcase name="CProcedureList_readAll" status="run" time="0" classname="TestProcedure" />
    <testcase name="CProcedureList_readAll_with_check" status="run" time="0.001" classname="TestProcedure" />
    <testcase name="CProcedureList_getProcedure_by_name" status="run" time="0" classname="TestProcedure" />
    <testcase name="CProcedureList_getProcedure_by_name_with_params" status="run" time="0" classname="TestProcedure" />
  </testsuite>
</testsuites>