1 Star 1 Fork 0

tdus / godror

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
data_test.go 1.16 KB
一键复制 编辑 Web IDE 原始数据 按行查看 历史
// Copyright 2020 The Godror Authors
//
//
// SPDX-License-Identifier: UPL-1.0 OR Apache-2.0
package godror
import (
"testing"
"time"
)
func TestDataSetGet(t *testing.T) {
var d Data
for _, want := range []time.Time{time.Now(), time.Time{}} {
d.SetTime(want)
if got := d.GetTime(); got != want && got.Format(time.RFC3339) != want.Format(time.RFC3339) {
t.Errorf("set %v, got %v", want, got)
}
}
for _, want := range []bool{true, false} {
d.SetBool(want)
if got := d.GetBool(); got != want {
t.Errorf("set %v, got %v", want, got)
}
}
for _, want := range []string{"árvíztűrő tükörfúrógép", "\x00", ""} {
d.SetBytes([]byte(want))
if got := string(d.GetBytes()); got != want {
t.Errorf("set %v, got %v", want, got)
}
}
for _, want := range []float64{3.14, -42} {
d.SetFloat32(float32(want))
if got := d.GetFloat32(); got != float32(want) {
t.Errorf("set %v, got %v", want, got)
}
d.SetInt64(int64(want * 100))
if got := d.GetInt64(); got != int64(want*100) {
t.Errorf("set %v, got %v", want*100, got)
}
d.SetFloat64(want)
if got := d.GetFloat64(); got != want {
t.Errorf("set %v, got %v", want, got)
}
}
}
1
https://gitee.com/tdus/godror.git
git@gitee.com:tdus/godror.git
tdus
godror
godror
master

搜索帮助

14c37bed 8189591 565d56ea 8189591