gh-14 Test coil.Reserved assignment
This commit is contained in:
parent
480279e2f5
commit
b8929f6211
|
@ -2,15 +2,15 @@ package pingvinKL
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
"strconv"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewCoil(t *testing.T) {
|
||||
data := readCsvLines("../coils.csv")
|
||||
addr := data[1][0]
|
||||
symbol := data[1][0]
|
||||
description := data[1][0]
|
||||
symbol := data[1][1]
|
||||
description := data[1][2]
|
||||
|
||||
coil := newCoil(addr, symbol, description)
|
||||
typ := fmt.Sprintf("%T", coil)
|
||||
|
@ -51,4 +51,29 @@ func TestNewCoil(t *testing.T) {
|
|||
if coil.Value != false {
|
||||
t.Errorf("coil.Value is %t, expecting false", coil.Value)
|
||||
}
|
||||
// Assert Reserved is bool and true
|
||||
reservedtype := fmt.Sprintf("%T", coil.Reserved)
|
||||
if reservedtype != "bool" {
|
||||
t.Errorf("coil.Reserved is of type %s, expecting bool", typ)
|
||||
}
|
||||
if coil.Reserved != false {
|
||||
t.Errorf("coil.Reserved is %t, expecting false", coil.Reserved)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewReservedCoil(t *testing.T) {
|
||||
data := readCsvLines("../coils.csv")
|
||||
addr := data[3][0]
|
||||
symbol := data[3][1]
|
||||
description := data[3][2]
|
||||
|
||||
coil := newCoil(addr, symbol, description)
|
||||
// Assert Reserved is bool and true
|
||||
typ := fmt.Sprintf("%T", coil.Reserved)
|
||||
if typ != "bool" {
|
||||
t.Errorf("coil.Reserved is of type %s, expecting bool", typ)
|
||||
}
|
||||
if coil.Reserved != true {
|
||||
t.Errorf("coil.Reserved is %t, expecting true", coil.Reserved)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue