mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-01 11:29:48 +08:00
a55f739608
Signed-off-by: SimFG <bang.fu@zilliz.com> Signed-off-by: SimFG <bang.fu@zilliz.com>
60 lines
1.0 KiB
Go
60 lines
1.0 KiB
Go
package planparserv2
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/milvus-io/milvus-proto/go-api/schemapb"
|
|
)
|
|
|
|
func Test_relationalCompatible(t *testing.T) {
|
|
type args struct {
|
|
t1 schemapb.DataType
|
|
t2 schemapb.DataType
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want bool
|
|
}{
|
|
{
|
|
// both.
|
|
args: args{
|
|
t1: schemapb.DataType_VarChar,
|
|
t2: schemapb.DataType_VarChar,
|
|
},
|
|
want: true,
|
|
},
|
|
{
|
|
// neither.
|
|
args: args{
|
|
t1: schemapb.DataType_Float,
|
|
t2: schemapb.DataType_Float,
|
|
},
|
|
want: true,
|
|
},
|
|
{
|
|
// in-compatible.
|
|
args: args{
|
|
t1: schemapb.DataType_Float,
|
|
t2: schemapb.DataType_VarChar,
|
|
},
|
|
want: false,
|
|
},
|
|
{
|
|
// in-compatible.
|
|
args: args{
|
|
t1: schemapb.DataType_VarChar,
|
|
t2: schemapb.DataType_Float,
|
|
},
|
|
want: false,
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := relationalCompatible(tt.args.t1, tt.args.t2); got != tt.want {
|
|
t.Errorf("relationalCompatible() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|