Skip to content

Commit 645d80e

Browse files
authored
Merge pull request #232 from zwy4896/master
fix typo
2 parents 1f83060 + a24629e commit 645d80e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tutorial02/tutorial02.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ static int lept_parse_value(lept_context* c, lept_value* v) {
198198

199199
此外我们谈及,重构与单元测试是互相依赖的软件开发技术,适当地运用可提升软件的品质。之后的单元还会有相关的话题。
200200

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()`
202202
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` 错误码。
204204
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` 额外两个标准库头文件。)
205205

206206
以上最重要的是第 3 条题目,就是要校验 JSON 的数字语法。建议可使用以下两个宏去简化一下代码:

0 commit comments

Comments
 (0)