Skip to content

Commit

Permalink
Go modules support (#1)
Browse files Browse the repository at this point in the history
* Convert to go modules

* update imports in test subpackage to use fork

* checkpoint
  • Loading branch information
Chris Roche authored Sep 15, 2020
1 parent d52462b commit 1c4ed59
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 8 deletions.
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/crossnokaye/modbus

go 1.15

require github.com/goburrow/serial v0.1.0
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/goburrow/serial v0.1.0 h1:v2T1SQa/dlUqQiYIT8+Cu7YolfqAi3K96UmhwYyuSrA=
github.com/goburrow/serial v0.1.0/go.mod h1:sAiqG0nRVswsm1C97xsttiYCzSLBmUZ/VSlVLZJ8haA=
2 changes: 1 addition & 1 deletion test/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
System testing for [modbus library](https://github.com/goburrow/modbus)
System testing for [modbus library](https://github.com/crossnokaye/modbus)

Modbus simulator
----------------
Expand Down
2 changes: 1 addition & 1 deletion test/asciiclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"os"
"testing"

"github.com/goburrow/modbus"
"github.com/crossnokaye/modbus"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions test/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package test
import (
"testing"

"github.com/goburrow/modbus"
"github.com/crossnokaye/modbus"
)

func ClientTestReadCoils(t *testing.T, client modbus.Client) {
Expand Down Expand Up @@ -67,7 +67,7 @@ func ClientTestWriteSingleCoil(t *testing.T, client modbus.Client) {

func ClientTestWriteSingleRegister(t *testing.T, client modbus.Client) {
// Write register 2 to 00 03 hex
address := uint16(0x0001)
address := uint32(0x0001)
value := uint16(0x0003)
results, err := client.WriteSingleRegister(address, value)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion test/rtuclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"os"
"testing"

"github.com/goburrow/modbus"
"github.com/crossnokaye/modbus"
)

const (
Expand Down
6 changes: 3 additions & 3 deletions test/tcpclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ import (
"testing"
"time"

"github.com/goburrow/modbus"
"github.com/crossnokaye/modbus"
)

const (
tcpDevice = "localhost:5020"
)

func TestTCPClient(t *testing.T) {
client := modbus.TCPClient(tcpDevice)
client := modbus.TCPClient(tcpDevice, time.Second, time.Second)
ClientTestAll(t, client)
}

func TestTCPClientAdvancedUsage(t *testing.T) {
handler := modbus.NewTCPClientHandler(tcpDevice)
handler := modbus.NewTCPClientHandler(tcpDevice, time.Second, time.Second)
handler.Timeout = 5 * time.Second
handler.SlaveId = 1
handler.Logger = log.New(os.Stdout, "tcp: ", log.LstdFlags)
Expand Down

0 comments on commit 1c4ed59

Please sign in to comment.