@@ -12,12 +12,13 @@ import (
1212func TestIntegrationWithSimulator (t * testing.T ) {
1313 // 配置模拟器连接
1414 cfg := map [string ]any {
15- "ip" : "127.0.0.1" ,
16- "port" : 44818 ,
17- "slot" : 0 ,
18- "timeout" : 3000 ,
19- "maxRetries" : 3 ,
20- "retryInterval" : 100 ,
15+ "ip" : "127.0.0.1" ,
16+ "port" : 44818 ,
17+ "slot" : 0 ,
18+ "timeout" : 3000 ,
19+ "maxRetries" : 3 ,
20+ "retryInterval" : 100 ,
21+ "connection_type" : "cip" ,
2122 }
2223
2324 // 创建传输层
@@ -172,7 +173,7 @@ func testSinglePointWrite(t *testing.T, scheduler *ENIPScheduler) {
172173 {"WriteInt" , "Program:MainProgram.IntTag" , "INT" , 12345 },
173174 {"WriteDint" , "Program:MainProgram.DintTag" , "DINT" , 987654321 },
174175 {"WriteReal" , "Program:MainProgram.RealTag" , "REAL" , float32 (2.71828 )},
175- {"WriteString" , "Program:MainProgram.StringTag" , "STRING" , "Test Message " },
176+ {"WriteString" , "Program:MainProgram.StringTag" , "STRING" , "Hi " },
176177 }
177178
178179 for _ , tc := range testCases {
@@ -259,11 +260,11 @@ func testArrayRead(t *testing.T, scheduler *ENIPScheduler) {
259260// TestConnectionReconnect 测试连接断开后自动重连
260261func TestConnectionReconnect (t * testing.T ) {
261262 cfg := map [string ]any {
262- "ip" : "127.0.0.1" ,
263- "port" : 44818 ,
264- "slot" : 0 ,
265- "timeout" : 2000 ,
266- "maxRetries" : 2 ,
263+ "ip" : "127.0.0.1" ,
264+ "port" : 44818 ,
265+ "slot" : 0 ,
266+ "timeout" : 2000 ,
267+ "maxRetries" : 2 ,
267268 "retryInterval" : 500 ,
268269 }
269270
@@ -298,4 +299,4 @@ func TestConnectionReconnect(t *testing.T) {
298299
299300 t .Log ("Reconnection successful" )
300301 defer transport .Disconnect ()
301- }
302+ }
0 commit comments