The core protocol of WoopChain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
woop/utils/utils_test.go

29 lines
557 B

package utils
import "testing"
func TestConvertIntoInts(t *testing.T) {
data := "1,2,3,4"
res := ConvertIntoInts(data)
if len(res) != 4 {
t.Errorf("Array length parsed incorrect.")
}
for id, value := range res {
if value != id+1 {
t.Errorf("Parsing incorrect.")
}
}
}
func TestConvertFixedDataIntoByteArray(t *testing.T) {
res := ConvertFixedDataIntoByteArray(int16(3))
if len(res) != 2 {
t.Errorf("Conversion incorrect.")
}
res = ConvertFixedDataIntoByteArray(int32(3))
if len(res) != 4 {
t.Errorf("Conversion incorrect.")
}
}