Better tests for Query???Text()

This commit is contained in:
Dmitry-Me 2017-08-02 18:05:23 +03:00
parent 02d2764fd7
commit 43c019d44e
1 changed files with 31 additions and 15 deletions

View File

@ -1442,24 +1442,40 @@ int main( int argc, const char ** argv )
const XMLElement* pointElement = doc.RootElement(); const XMLElement* pointElement = doc.RootElement();
int intValue = 0; {
unsigned unsignedValue = 0; int intValue = 0;
float floatValue = 0; XMLError queryResult = pointElement->FirstChildElement( "y" )->QueryIntText( &intValue );
double doubleValue = 0; XMLTest( "QueryIntText result", XML_SUCCESS, queryResult, false );
bool boolValue = false; XMLTest( "QueryIntText", 1, intValue, false );
}
pointElement->FirstChildElement( "y" )->QueryIntText( &intValue ); {
pointElement->FirstChildElement( "y" )->QueryUnsignedText( &unsignedValue ); unsigned unsignedValue = 0;
pointElement->FirstChildElement( "x" )->QueryFloatText( &floatValue ); XMLError queryResult = pointElement->FirstChildElement( "y" )->QueryUnsignedText( &unsignedValue );
pointElement->FirstChildElement( "x" )->QueryDoubleText( &doubleValue ); XMLTest( "QueryUnsignedText result", XML_SUCCESS, queryResult, false );
pointElement->FirstChildElement( "valid" )->QueryBoolText( &boolValue ); XMLTest( "QueryUnsignedText", (unsigned)1, unsignedValue, false );
}
{
float floatValue = 0;
XMLError queryResult = pointElement->FirstChildElement( "x" )->QueryFloatText( &floatValue );
XMLTest( "QueryFloatText result", XML_SUCCESS, queryResult, false );
XMLTest( "QueryFloatText", 1.2f, floatValue, false );
}
XMLTest( "QueryIntText", 1, intValue, false ); {
XMLTest( "QueryUnsignedText", (unsigned)1, unsignedValue, false ); double doubleValue = 0;
XMLTest( "QueryFloatText", 1.2f, floatValue, false ); XMLError queryResult = pointElement->FirstChildElement( "x" )->QueryDoubleText( &doubleValue );
XMLTest( "QueryDoubleText", 1.2, doubleValue, false ); XMLTest( "QueryDoubleText result", XML_SUCCESS, queryResult, false );
XMLTest( "QueryBoolText", true, boolValue, false ); XMLTest( "QueryDoubleText", 1.2, doubleValue, false );
}
{
bool boolValue = false;
XMLError queryResult = pointElement->FirstChildElement( "valid" )->QueryBoolText( &boolValue );
XMLTest( "QueryBoolText result", XML_SUCCESS, queryResult, false );
XMLTest( "QueryBoolText", true, boolValue, false );
}
} }
{ {