test_doc
函数
test_utilities_iniparser_suite

测试IniParser 更多...

函数

 BOOST_AUTO_TEST_CASE (test_IniParser_read)
 测试IniParser读取文件操作
更多...
 
 BOOST_AUTO_TEST_CASE (test_IniParser_hasSection)
 
 BOOST_AUTO_TEST_CASE (test_IniParser_hasOption)
 
 BOOST_AUTO_TEST_CASE (test_IniParser_getSectionList)
 
 BOOST_AUTO_TEST_CASE (test_IniParser_getOptionList)
 
 BOOST_AUTO_TEST_CASE (test_IniParser_get)
 
 BOOST_AUTO_TEST_CASE (test_IniParser_getInt)
 
 BOOST_AUTO_TEST_CASE (test_IniParser_getFloat)
 
 BOOST_AUTO_TEST_CASE (test_IniParser_getDouble)
 
 BOOST_AUTO_TEST_CASE (test_IniParser_getBool)
 

详细描述

测试IniParser

函数说明

BOOST_AUTO_TEST_CASE ( test_IniParser_read  )

测试IniParser读取文件操作

检测点
  • 读取文件不存在
  • 错误的文件格式:缺少section,抛出logic_error异常
  • 错误的文件格式:section行格式错误,缺少"]",如:"[section "
  • 错误的文件格式:section行格式错误,缺少"]",如:"[section;xx] "
  • 错误的文件格式:key=value行格式错误,缺少key,如:"= value "
  • 错误的文件格式:key=value行格式错误,缺少value,如:"key="
  • 错误的文件格式:非注释行,即不包含section,也不包含key=value,如:"key"
  • 除注释和空行外,仅存在唯一有效行,并且是section行
  • 其他正常情况,在其他成员函数如:get、hasSection、hasOption中测试

在文件 test_iniparser.cpp35 行定义.

BOOST_AUTO_TEST_CASE ( test_IniParser_hasSection  )
检测点
  • 存在指定的section
  • 不存在指定section

在文件 test_iniparser.cpp95 行定义.

BOOST_AUTO_TEST_CASE ( test_IniParser_hasOption  )
检测点
  • 存在指定section和option
  • 存在指定section,但不存在相应的option
  • 不存在指定的section

在文件 test_iniparser.cpp116 行定义.

BOOST_AUTO_TEST_CASE ( test_IniParser_getSectionList  )
检测点
  • 存在section,可正常读取
  • 不存在任何sction的情况

在文件 test_iniparser.cpp141 行定义.

BOOST_AUTO_TEST_CASE ( test_IniParser_getOptionList  )
检测点
  • 指定的section下不存在任何option
  • 指定的section下,存在1个option
  • 指定的section下,存在多个option

在文件 test_iniparser.cpp171 行定义.

BOOST_AUTO_TEST_CASE ( test_IniParser_get  )
检测点
  • 存在指定section和option, 并且无缺省值
  • 存在指定section和option, 并且指定了缺省值
  • 存在指定section,但不存在相应的option,并且无缺省值
  • 存在指定section,但不存在相应的option,但指定了缺省值
  • 不存在指定的section,并且无缺省值
  • 不存在指定的section,但指定了缺省值

在文件 test_iniparser.cpp204 行定义.

BOOST_AUTO_TEST_CASE ( test_IniParser_getInt  )
检测点
  • 存在指定section和option, 并且无缺省值
  • 存在指定section和option, 并且指定了有效缺省值
  • 存在指定section和option,但对应的值无法转换为int类型
  • 存在指定section和option, 但指定了无效缺省值(无法转换到int类型),应抛出异常
  • 存在指定section,但不存在相应的option,并且无缺省值
  • 存在指定section,但不存在相应的option,但指定了有效缺省值
  • 存在指定section,但不存在相应的option,但指定了无效缺省值(无法转换到int类型)
  • 不存在指定的section,并且无缺省值
  • 不存在指定的section,但指定了有效缺省值

在文件 test_iniparser.cpp239 行定义.

BOOST_AUTO_TEST_CASE ( test_IniParser_getFloat  )
检测点
  • 存在指定section和option, 并且无缺省值
  • 存在指定section和option, 并且指定了有效缺省值
  • 存在指定section和option,但对应的值无法转换为int类型
  • 存在指定section和option, 但指定了无效缺省值(无法转换到int类型),应抛出异常
  • 存在指定section,但不存在相应的option,并且无缺省值
  • 存在指定section,但不存在相应的option,但指定了有效缺省值
  • 存在指定section,但不存在相应的option,但指定了无效缺省值(无法转换到int类型)
  • 不存在指定的section,并且无缺省值
  • 不存在指定的section,但指定了有效缺省值
  • 测试值为-3.4e-38和3.4e+38的情况
  • 测试超出float范围的数据:3.41+38。注:MSVC使用中,超出float范围的数据不会抛出异常,而是转换为INF

在文件 test_iniparser.cpp286 行定义.

BOOST_AUTO_TEST_CASE ( test_IniParser_getDouble  )
检测点
  • 存在指定section和option, 并且无缺省值
  • 存在指定section和option, 并且指定了有效缺省值
  • 存在指定section和option,但对应的值无法转换为int类型
  • 存在指定section和option, 但指定了无效缺省值(无法转换到int类型),应抛出异常
  • 存在指定section,但不存在相应的option,并且无缺省值
  • 存在指定section,但不存在相应的option,但指定了有效缺省值
  • 存在指定section,但不存在相应的option,但指定了无效缺省值(无法转换到int类型)
  • 不存在指定的section,并且无缺省值
  • 不存在指定的section,但指定了有效缺省值

在文件 test_iniparser.cpp342 行定义.

BOOST_AUTO_TEST_CASE ( test_IniParser_getBool  )
检测点
  • 存在指定section和option, 并且无缺省值,对应值分别为1|0|true|yes|on|false|no|off(含不同大小写)
  • 存在指定section和option, 并且指定了有效缺省值
  • 存在指定section和option,但对应的值无法转换为bool类型
  • 存在指定section和option, 但指定了无效缺省值(无法转换到bool类型),应抛出异常
  • 存在指定section,但不存在相应的option,并且无缺省值
  • 存在指定section,但不存在相应的option,但指定了有效缺省值(0|1|true|false|yes|no|on|off)(含不同大小写)
  • 存在指定section,但不存在相应的option,但指定了无效缺省值(无法转换到bool类型)
  • 不存在指定的section,并且无缺省值
  • 不存在指定的section,但指定了有效缺省值

在文件 test_iniparser.cpp389 行定义.