mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-07-05 19:28:45 +00:00
v1.0.0
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package kcp_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "github.com/xtls/xray-core/v1/transport/internet/kcp"
|
||||
)
|
||||
|
||||
func TestKCPPacketReader(t *testing.T) {
|
||||
reader := KCPPacketReader{
|
||||
Security: &SimpleAuthenticator{},
|
||||
}
|
||||
|
||||
testCases := []struct {
|
||||
Input []byte
|
||||
Output []Segment
|
||||
}{
|
||||
{
|
||||
Input: []byte{},
|
||||
Output: nil,
|
||||
},
|
||||
{
|
||||
Input: []byte{1},
|
||||
Output: nil,
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
seg := reader.Read(testCase.Input)
|
||||
if testCase.Output == nil && seg != nil {
|
||||
t.Errorf("Expect nothing returned, but actually %v", seg)
|
||||
} else if testCase.Output != nil && seg == nil {
|
||||
t.Errorf("Expect some output, but got nil")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user