41 lines
703 B
Go
41 lines
703 B
Go
/*
|
|||
|
|
* Copyright (c) 2025 Beijing Hardman Automation Equipment Co., LTD. All rights reserved.
|
||
|
|
*
|
||
|
|
* Project: adapter
|
||
|
|
* File: address_test.go
|
||
|
|
* Last: 2025-05-17 15:27:01
|
||
|
|
* Author: wangcheng@bj-hardman.com
|
||
|
|
*/
|
||
|
|
|
||
|
|
package preload
|
||
|
|
|
||
|
|
import (
|
||
|
|
"testing"
|
||
|
|
|
||
|
|
"bjhardman.cn/bjhardman/goplc/s7"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestAddress(t *testing.T) {
|
||
|
|
addr := MAddress{
|
||
|
|
LineId: 1,
|
||
|
|
Name: "ttt",
|
||
|
|
Desc: "xxx",
|
||
|
|
Addr: s7.Address{
|
||
|
|
Area: "M",
|
||
|
|
DBNumber: 0,
|
||
|
|
DataType: "",
|
||
|
|
Offset: 100,
|
||
|
|
BitOffset: 0,
|
||
|
|
},
|
||
|
|
}
|
||
|
|
|
||
|
|
t.Log(addr.String())
|
||
|
|
t.Log(addr.Address())
|
||
|
|
addr.Addr.Add(0, 1)
|
||
|
|
t.Log(addr.String())
|
||
|
|
t.Log(addr.Address())
|
||
|
|
t.Log(addr.Addr.Add(0, 1))
|
||
|
|
t.Log(addr.String())
|
||
|
|
t.Log(addr.Address())
|
||
|
|
}
|