1 Star 0 Fork 0

muicx / quickfix

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
fix_string_test.go 844 Bytes
一键复制 编辑 原始数据 按行查看 历史
Chris Busbey 提交于 2016-02-05 09:05 . message cap, removed cruft
package quickfix
import (
"bytes"
"testing"
)
func TestFIXStringWrite(t *testing.T) {
var tests = []struct {
field FIXString
val []byte
}{
{"CWB", []byte("CWB")},
}
for _, test := range tests {
b := test.field.Write()
if !bytes.Equal(b, test.val) {
t.Errorf("got %v; want %v", b, test.val)
}
}
}
func TestFIXStringRead(t *testing.T) {
var tests = []struct {
bytes []byte
value string
expectError bool
}{
{[]byte("blah"), "blah", false},
}
for _, test := range tests {
var field FIXString
err := field.Read(test.bytes)
if test.expectError && err == nil {
t.Errorf("Expected error for %v", test.bytes)
} else if !test.expectError && err != nil {
t.Errorf("UnExpected '%v'", err)
}
if string(field) != test.value {
t.Errorf("got %v want %v", field, test.value)
}
}
}
Go
1
https://gitee.com/bradhuang/quickfixgo.git
git@gitee.com:bradhuang/quickfixgo.git
bradhuang
quickfixgo
quickfix
dependabot/go_modules/github.com/mattn/go-sqlite3-1.14.9

搜索帮助