Skip to content

test: 完善测试用例#13

Merged
CPythoner merged 1 commit into
masterfrom
test/add-more-tests
Apr 3, 2026
Merged

test: 完善测试用例#13
CPythoner merged 1 commit into
masterfrom
test/add-more-tests

Conversation

@CPythoner

Copy link
Copy Markdown
Owner

测试用例完善

新增测试用例

本次更新将测试用例从 5 个增加到 40 个,断言从 23 个增加到 110 个。

测试覆盖范围

类别 测试用例数 说明
构造函数 3 默认、指定容量、从数组
自动扩容 1 检查扩容机制
基础读写 1 所有类型的读写
状态管理 5 flip, compact, clear, mark, reset, rewind
剩余检查 2 remaining, hasRemaining
位置限制 2 position, limit 设置
索引读取 7 所有类型的索引读取
索引写入 7 所有类型的索引写入
移动语义 2 移动构造、移动赋值
其他功能 3 duplicate, equals, printInfo
边界情况 4 空缓冲区、越界、大容量、链式操作
异常处理 1 bad_alloc 异常
类型特征 1 noexcept 移动构造

测试结果

All tests passed (110 assertions in 40 test cases)

测试统计

  • 测试用例数: 40
  • 断言数: 110
  • 通过率: 100%

新增测试用例:
- 构造函数测试(默认、指定容量、从数组)
- 自动扩容测试
- 基础读写测试
- flip、compact、clear 测试
- mark/reset/discardMark 测试
- rewind 测试
- remaining/hasRemaining 测试
- position/limit 设置测试
- 索引读写测试(所有类型)
- 移动语义测试(移动构造、移动赋值)
- duplicate 测试
- equals 测试
- 边界情况测试
- 异常处理测试
- 类型特征测试

共 40 个测试用例,110 个断言
@CPythoner CPythoner merged commit f233b45 into master Apr 3, 2026
6 checks passed
@CPythoner CPythoner deleted the test/add-more-tests branch April 4, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant