static void DumpTree(le_cfg_IteratorRef_t iterRef, size_t indent) { if (le_arg_NumArgs() == 1) { return; } static char strBuffer[STR_SIZE] = { 0 }; do { size_t i; for (i = 0; i < indent; i++) { printf(" "); } le_cfg_GetNodeName(iterRef, "", strBuffer, STR_SIZE); le_cfg_nodeType_t type = le_cfg_GetNodeType(iterRef, ""); switch (type) { case LE_CFG_TYPE_STEM: printf("%s/\n", strBuffer); le_cfg_GoToFirstChild(iterRef); DumpTree(iterRef, indent + 2); le_cfg_GoToParent(iterRef); break; case LE_CFG_TYPE_EMPTY: printf("%s~~\n", strBuffer); break; default: printf("%s<%s> == ", strBuffer, NodeTypeStr(iterRef)); le_cfg_GetString(iterRef, "", strBuffer, STR_SIZE, ""); printf("%s\n", strBuffer); break; } } while (le_cfg_GoToNextSibling(iterRef) == LE_OK); }
//-------------------------------------------------------------------------------------------------- void _le_test_Init ( void ) { Mutex = le_mutex_CreateNonRecursive("UnitTestMutex"); NumFailures = 0; PassThrough = false; int i = le_arg_NumArgs() - 1; for (; i >= 0; i--) { char buf[sizeof(PassThroughArgLongForm)]; // Check the command line arguments for the PassThroughArgs strings. if ( (le_arg_GetArg(i, buf, sizeof(PassThroughArgLongForm)) == LE_OK) && ((strcmp(buf, PassThroughArg) == 0) || (strcmp(buf, PassThroughArgLongForm) == 0)) ) { PassThrough = true; } } }
static void TestNumberOfArgs(void) { LE_DEBUG("The number of command line arguments: %zd", le_arg_NumArgs()); LE_ASSERT(le_arg_NumArgs() == 4); }