Update comments and documentation for clarity and consistency across files
This commit is contained in:
+13
-13
@@ -8,7 +8,7 @@
|
||||
#include <vector>
|
||||
|
||||
// =============================================================================
|
||||
// 1) 无符号整数 + 跨字节位宽
|
||||
// 1) Unsigned integers + cross-byte bit widths
|
||||
// =============================================================================
|
||||
|
||||
#define UINT_FIELDS(BSF) \
|
||||
@@ -52,7 +52,7 @@ TEST_CASE("unsigned integers with cross-byte bit widths") {
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// 2) 有符号整数:正、负、边界、位宽截取与符号扩展
|
||||
// 2) Signed integers: positive, negative, boundary, bit width truncation and sign extension
|
||||
// =============================================================================
|
||||
|
||||
#define INT_FIELDS(BSF) \
|
||||
@@ -148,7 +148,7 @@ TEST_CASE("signed integers: boundary values") {
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// 3) bool:单 bit 与多 bit
|
||||
// 3) bool: single bit and multi-bit
|
||||
// =============================================================================
|
||||
|
||||
#define BOOL_FIELDS(BSF) \
|
||||
@@ -175,7 +175,7 @@ TEST_CASE("bool fields: single and multi-bit") {
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// 4) float / double:含特殊值
|
||||
// 4) float / double: with special values
|
||||
// =============================================================================
|
||||
|
||||
#define FLOAT_FIELDS(BSF) \
|
||||
@@ -233,7 +233,7 @@ TEST_CASE("float and double: special values (inf, nan, -0, subnormal)") {
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// 5) 嵌套结构体
|
||||
// 5) Nested structures
|
||||
// =============================================================================
|
||||
|
||||
#define INNER_FIELDS(BSF) \
|
||||
@@ -267,7 +267,7 @@ TEST_CASE("nested structs") {
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// 6) 定长数组(自然位宽 / 自定义位宽)
|
||||
// 6) Fixed-length arrays (natural bit width / custom bit width)
|
||||
// =============================================================================
|
||||
|
||||
#define ARR_NATURAL_FIELDS(BSF) \
|
||||
@@ -329,7 +329,7 @@ TEST_CASE("arrays: packed with custom bit widths") {
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// 7) HEX 与 bytes 双向转换
|
||||
// 7) Bidirectional HEX and bytes conversion
|
||||
// =============================================================================
|
||||
|
||||
TEST_CASE("hex roundtrip: upper and lowercase") {
|
||||
@@ -352,7 +352,7 @@ TEST_CASE("hex roundtrip: upper and lowercase") {
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// 8) 字节序:手工验证 MSB-first 的位排布
|
||||
// 8) Byte order: manual verification of MSB-first bit layout
|
||||
// =============================================================================
|
||||
|
||||
TEST_CASE("byte order: MSB-first layout verification") {
|
||||
@@ -378,7 +378,7 @@ TEST_CASE("byte order: MSB-first layout verification") {
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// 9) 边界与异常
|
||||
// 9) Boundary and error handling
|
||||
// =============================================================================
|
||||
|
||||
TEST_CASE("error handling: buffer too small") {
|
||||
@@ -404,7 +404,7 @@ TEST_CASE("error handling: hex parsing errors") {
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// 10) 真实协议示例:IPv4 头部前 12 字节
|
||||
// 10) Real protocol example: first 12 bytes of IPv4 header
|
||||
// =============================================================================
|
||||
|
||||
#define IPV4_FIELDS(BSF) \
|
||||
@@ -453,7 +453,7 @@ TEST_CASE("real protocol: IPv4 header layout") {
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// 11) 综合压力:所有标量类型 + 嵌套 + 数组 一次往返
|
||||
// 11) Comprehensive stress: all scalar types + nested + arrays round trip
|
||||
// =============================================================================
|
||||
|
||||
#define ALL_INNER_FIELDS(BSF) BSF##_F(std::int32_t, a) BSF##_F(double, b)
|
||||
@@ -535,7 +535,7 @@ TEST_CASE("comprehensive: all types combined stress test") {
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// 12) 用户提供 span 的零分配路径
|
||||
// 12) User-provided buffer: zero-allocation path
|
||||
// =============================================================================
|
||||
|
||||
TEST_CASE("user-provided buffer: zero-allocation path") {
|
||||
@@ -558,7 +558,7 @@ TEST_CASE("user-provided buffer: zero-allocation path") {
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// 13) constexpr 编译期序列化
|
||||
// 13) constexpr compile-time serialization
|
||||
// =============================================================================
|
||||
|
||||
constexpr UnsignedPkt make_pkt() {
|
||||
|
||||
Reference in New Issue
Block a user