#include "ACEXML/common/XML_Util.h"
#include "ace/OS_main.h"
#include "ace/Time_Value.h"
#include "ace/OS_NS_sys_time.h"
#include "ace/Log_Msg.h"
Go to the source code of this file.
Function Documentation
Definition at line 84 of file test.cpp.
{
ACEXML_String test_strings[NUM_TEST_STRS] = {
ACE_TEXT("\"xxxxx\"xxxxxxxx xx\"xxxxxx xxxxxx\"xxxxxxxxxx xxxxxxxx\"xxxxxx\""),
ACE_TEXT("'xxxxx\'xxxxxxxx' xxxxxxxx xx'xxxxxxxx'xxxxxx xxxxxxx'xxxxxxx'"),
ACE_TEXT("&xxxx&xxxxxxxxx &xxxxxxxx xxxxx&xxxxxxxxxxx xxxx&xxxxxxxxxx&"),
ACE_TEXT(">xx>xxxxxxxxxxx >xxxxxxxx xxxxx>xxxxxxxxxxx xxxxx>xxxxxxxxx>"),
ACE_TEXT("<xxxxx<xxxxxxxx xxxxxxxx <xxxxxxxxxxxxxxx<x xxxxxxxxxxxxxx<"),
ACE_TEXT("&xxxx\"xxxxxxx&xx xxx'xxxxx xx<xxxxxxx>xxxxxxx xx\"xxxxxxxxxxxx>"),
};
if (run_tests(test_strings, MAX_ITERATIONS) != 0)
return 1;
ACE_DEBUG((LM_DEBUG, "Rerun tests with larger strings\n"));
for (int i = 0; i < NUM_TEST_STRS; ++i)
{
for (int j = 0; j < 5; ++j)
{
test_strings[i] += test_strings[i];
}
}
if (run_tests(test_strings, MAX_ITERATIONS / 10) != 0)
return 1;
return 0;
}
static int run_tests |
( |
ACEXML_String |
test_strings[NUM_TEST_STRS], |
|
|
int |
iterations | |
|
) |
| | [static] |
Definition at line 23 of file test.cpp.
{
ACE_Time_Value start = ACE_OS::gettimeofday();
int i = 0;
for (i = 0; i < iterations; ++i)
{
ACEXML_String tmp = ACEXML_escape_string(test_strings[i % NUM_TEST_STRS]);
if (! is_escaped(tmp))
{
ACE_ERROR((LM_ERROR, "Error: Failed to escape string\n"));
return 1;
}
}
ACE_DEBUG((LM_DEBUG, "Test1 took %dms\n", (ACE_OS::gettimeofday() - start).msec()));
ACEXML_String tmp;
start = ACE_OS::gettimeofday();
for (i = 0; i < iterations; ++i)
{
tmp = ACEXML_escape_string(test_strings[i % NUM_TEST_STRS]);
if (! is_escaped(tmp))
{
ACE_ERROR((LM_ERROR, "Error: Failed to escape string\n"));
return 1;
}
}
ACE_DEBUG((LM_DEBUG, "Test2 took %dms\n", (ACE_OS::gettimeofday() - start).msec()));
tmp.clear(1);
start = ACE_OS::gettimeofday();
for (i = 0; i < iterations; ++i)
{
ACEXML_escape_string(test_strings[i % NUM_TEST_STRS], tmp);
if (! is_escaped(tmp))
{
ACE_ERROR((LM_ERROR, "Error: Failed to escape string\n"));
return 1;
}
}
ACE_DEBUG((LM_DEBUG, "Test3 took %dms\n", (ACE_OS::gettimeofday() - start).msec()));
start = ACE_OS::gettimeofday();
for (i = 0; i < iterations; ++i)
{
ACEXML_escape_string(test_strings[i % NUM_TEST_STRS], tmp);
if (! is_escaped(tmp))
{
ACE_ERROR((LM_ERROR, "Error: Failed to escape string\n"));
return 1;
}
}
ACE_DEBUG((LM_DEBUG, "Test4 took %dms\n", (ACE_OS::gettimeofday() - start).msec()));
return 0;
}
Variable Documentation