@@ -44,14 +44,14 @@ func TestTumblingWindowPerformance(t *testing.T) {
4444
4545 t .Logf ("缓冲区大小: %d" , bufferSize )
4646 t .Logf ("处理时间: %v" , elapsed )
47- t .Logf ("发送成功: %d" , stats ["sent_count " ])
48- t .Logf ("丢弃数量: %d" , stats ["dropped_count " ])
49- t .Logf ("缓冲区利用率: %d/%d" , stats ["buffer_used " ], stats ["buffer_size " ])
47+ t .Logf ("发送成功: %d" , stats ["sentCount " ])
48+ t .Logf ("丢弃数量: %d" , stats ["droppedCount " ])
49+ t .Logf ("缓冲区利用率: %d/%d" , stats ["bufferUsed " ], stats ["bufferSize " ])
5050
5151 // 验证没有严重的数据丢失
5252 if bufferSize >= 1000 {
53- if stats ["dropped_count " ] > int64 (dataCount / 10 ) { // 允许最多10%的丢失
54- t .Errorf ("丢失数据过多: %d (总数: %d)" , stats ["dropped_count " ], dataCount )
53+ if stats ["droppedCount " ] > int64 (dataCount / 10 ) { // 允许最多10%的丢失
54+ t .Errorf ("丢失数据过多: %d (总数: %d)" , stats ["droppedCount " ], dataCount )
5555 }
5656 }
5757
@@ -101,7 +101,7 @@ func BenchmarkTumblingWindowThroughput(b *testing.B) {
101101
102102 // 获取最终统计
103103 stats := tw .GetStats ()
104- b .Logf ("发送成功: %d, 丢弃: %d" , stats ["sent_count " ], stats ["dropped_count " ])
104+ b .Logf ("发送成功: %d, 丢弃: %d" , stats ["sentCount " ], stats ["droppedCount " ])
105105
106106 tw .Stop ()
107107}
@@ -132,15 +132,15 @@ func TestWindowBufferOverflow(t *testing.T) {
132132 time .Sleep (200 * time .Millisecond )
133133
134134 stats := tw .GetStats ()
135- t .Logf ("缓冲区溢出测试 - 发送: %d, 丢弃: %d" , stats ["sent_count " ], stats ["dropped_count " ])
135+ t .Logf ("缓冲区溢出测试 - 发送: %d, 丢弃: %d" , stats ["sentCount " ], stats ["droppedCount " ])
136136
137137 // 应该有数据被丢弃
138- if stats ["dropped_count " ] == 0 {
138+ if stats ["droppedCount " ] == 0 {
139139 t .Log ("预期会有数据丢弃,但实际没有丢弃" )
140140 }
141141
142142 // 验证系统仍然运行正常(没有阻塞)
143- if stats ["sent_count " ] == 0 {
143+ if stats ["sentCount " ] == 0 {
144144 t .Error ("应该至少发送了一些数据" )
145145 }
146146
0 commit comments