Beispiel #1
0
void KGT_GetNextSectionTest::TestGetNextSection_11()
{
    int nResult = false;
    int nRetCode = false;

    IIniFile *piIniFile = NULL;
    char *szArgv[] = {
        "KG_GoddessD.exe"
    };
    int nArgc = sizeof(szArgv) / sizeof(szArgv[0]);
    char *pszSection = "Version";
    char szNextSection[IIniFile::INI_MAX_SUPPORT_SECTION_AND_KEY_SIZE];
    szNextSection[0] = '\0';

    KG_CASE_INFO("非空值下一个section", "KG_Ini_SectionMap没有记录");

    piIniFile = g_OpenIniFileFromArguments(nArgc, szArgv);
    KG_PROCESS_ERROR(piIniFile);

    nRetCode = piIniFile->GetNextSection(pszSection, szNextSection);
    KG_PROCESS_ERROR(!nRetCode);
    szNextSection[sizeof(szNextSection) - 1] = '\0';

    KG_PROCESS_ERROR(szNextSection[0] == '\0');

    nResult = true;
Exit0:
    KG_COM_RELEASE(piIniFile);
    CPPUNIT_ASSERT(nResult);
}
Beispiel #2
0
void KGT_GetNextSectionTest::TestGetNextSection_06()
{
    int nResult = false;
    int nRetCode = false;

    IIniFile *piIniFile = NULL;
    char *szArgv[] = {
        "KG_GoddessD.exe", 
        "--AVersion.version=2", 
        "--BDatabase.user=root", 
        "--CNameServer.user=root", 
        "--DLogServer.user=root"
    };
    int nArgc = sizeof(szArgv) / sizeof(szArgv[0]);
    char *pszSection = "EGoddessServer";
    char szNextSection[IIniFile::INI_MAX_SUPPORT_SECTION_AND_KEY_SIZE];
    szNextSection[0] = '\0';

    KG_CASE_INFO("不存在的记录的下一个section", "KG_Ini_SectionMap有多条记录");

    piIniFile = g_OpenIniFileFromArguments(nArgc, szArgv);
    KG_PROCESS_ERROR(piIniFile);

    nRetCode = piIniFile->GetNextSection(pszSection, szNextSection);
    KG_PROCESS_ERROR(!nRetCode);
    szNextSection[sizeof(szNextSection) - 1] = '\0';

    KG_PROCESS_ERROR(szNextSection[0] == '\0');    //szNextSection保持不变

    nResult = true;
Exit0:
    KG_COM_RELEASE(piIniFile);
    CPPUNIT_ASSERT(nResult);
}