cast/TEST.md

16 lines
917 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 测试报告 (Test Report)
## 覆盖场景 (Coverage Scenarios)
- **核心类型转换**: `Int64`, `Uint64`, `Float64`, `Bool`, `String`,包括边界值、零值及非法字符串输入。
- **复合类型处理**: `Ints`, `Strings` 自动解析 JSON 字符串或直接转换。
- **JSON/YAML 互转**: 深度结构体映射,处理大写 Key 自动修复,支持自定义 `keepKey` tag。
- **JSON 类型修复**: 通过 `makeJsonType` 对 Map 键进行强制转换以符合 JSON 规范。
- **指针与接口**: `RealValue` 处理多级指针与接口解包。
- **高性能实用函数**: `UniqueAppend` (支持 $O(n)$ 去重)`If` (泛型三元)`SplitArgs` (支持引用格式)。
## 性能基准 (Benchmark Results - Intel(R) Core(TM) i9)
- `If`: ~0.25 ns/op
- `Int64`: ~18.4 ns/op
- `ToJson`: ~623.9 ns/op
- `UniqueAppend`: 在大数据量下的 $O(n)$ 时间复杂度,通过 map 查重优化。