File tree 1 file changed +2
-2
lines changed
1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -198,9 +198,9 @@ static int lept_parse_value(lept_context* c, lept_value* v) {
198
198
199
199
此外我们谈及,重构与单元测试是互相依赖的软件开发技术,适当地运用可提升软件的品质。之后的单元还会有相关的话题。
200
200
201
- 1 . 重构合并 ` lept_parse_null() ` 、` lept_parse_false() ` 、` lept_parse_true ` 为 ` lept_parse_literal() ` 。
201
+ 1 . 重构合并 ` lept_parse_null() ` 、` lept_parse_false() ` 、` lept_parse_true() ` 为 ` lept_parse_literal() ` 。
202
202
2 . 加入 [ 维基百科双精度浮点数] ( https://en.wikipedia.org/wiki/Double-precision_floating-point_format#Double-precision_examples ) 的一些边界值至单元测试,如 min subnormal positive double、max double 等。
203
- 3 . 去掉 ` test_parse_invalid_value() ` 和 ` test_parse_root_not_singular ` 中的 ` #if 0 ... #endif ` ,执行测试,证实测试失败。按 JSON number 的语法在 lept_parse_number() 校验,不符合标准的程况返回 ` LEPT_PARSE_INVALID_VALUE ` 错误码。
203
+ 3 . 去掉 ` test_parse_invalid_value() ` 和 ` test_parse_root_not_singular() ` 中的 ` #if 0 ... #endif ` ,执行测试,证实测试失败。按 JSON number 的语法在 lept_parse_number() 校验,不符合标准的情况返回 ` LEPT_PARSE_INVALID_VALUE ` 错误码。
204
204
4 . 去掉 ` test_parse_number_too_big ` 中的 ` #if 0 ... #endif ` ,执行测试,证实测试失败。仔细阅读 [ ` strtod() ` ] ( https://en.cppreference.com/w/c/string/byte/strtof ) ,看看怎样从返回值得知数值是否过大,以返回 ` LEPT_PARSE_NUMBER_TOO_BIG ` 错误码。(提示:这里需要 ` #include ` 额外两个标准库头文件。)
205
205
206
206
以上最重要的是第 3 条题目,就是要校验 JSON 的数字语法。建议可使用以下两个宏去简化一下代码:
You can’t perform that action at this time.
0 commit comments