知识卡片
语法合法仍需领域范围校验
Atoi失败时应提示并终止,确保游戏没有启动;但解析成功只证明可表示为整数,0、负人数或极大值仍可能不符合游戏要求。应在Start前验证允许范围,并区分扫描失败、数字语法错误与领域错误。原章修复非数字输入,没有完整实现这些边界。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
- · Time
原书出处 · 1 处
- Time · 查看原书依据
layerPrompt) numberOfPlayers, _ := strconv.Atoi(cli.readLine()) cli.scheduleBlindAlerts(numberOfPlayers) userInput := cli.readLine() cli.playerStore.R
参考来源
- 位置:《通过测试学习 Go 编程》Time,spine027(book-sources;extracted/通过测试学习 Go 编程/_epub-src/OEBPS/Text/26.html)。
- 结论依据:原文先忽略Atoi错误后补检查,仅展示pies失败样例。
- 原始内容:layerPrompt) numberOfPlayers, _ := strconv.Atoi(cli.readLine()) cli.scheduleBlindAlerts(numberOfPlayers) userInput := cli.readLine() cli.playerStore.R