github.com/weaviate/weaviate@v1.24.6/entities/schema/backward_compat_test.go (about) 1 // _ _ 2 // __ _____ __ ___ ___ __ _| |_ ___ 3 // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ 4 // \ V V / __/ (_| |\ V /| | (_| | || __/ 5 // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| 6 // 7 // Copyright © 2016 - 2024 Weaviate B.V. All rights reserved. 8 // 9 // CONTACT: hello@weaviate.io 10 // 11 12 package schema 13 14 import ( 15 "testing" 16 ) 17 18 func TestIsArrayDataType(t *testing.T) { 19 type args struct { 20 dt []string 21 } 22 tests := []struct { 23 name string 24 args args 25 want bool 26 }{ 27 { 28 name: "is string array", 29 args: args{ 30 dt: DataTypeTextArray.PropString(), 31 }, 32 want: true, 33 }, 34 { 35 name: "is not string array", 36 args: args{ 37 dt: DataTypeText.PropString(), 38 }, 39 want: false, 40 }, 41 { 42 name: "is text array", 43 args: args{ 44 dt: []string{"text[]"}, 45 }, 46 want: true, 47 }, 48 { 49 name: "is not text array", 50 args: args{ 51 dt: []string{"text"}, 52 }, 53 want: false, 54 }, 55 { 56 name: "is number array", 57 args: args{ 58 dt: []string{"number[]"}, 59 }, 60 want: true, 61 }, 62 { 63 name: "is not number array", 64 args: args{ 65 dt: []string{"number"}, 66 }, 67 want: false, 68 }, 69 { 70 name: "is int array", 71 args: args{ 72 dt: []string{"int[]"}, 73 }, 74 want: true, 75 }, 76 { 77 name: "is not int array", 78 args: args{ 79 dt: []string{"int"}, 80 }, 81 want: false, 82 }, 83 { 84 name: "is not uuid array", 85 args: args{ 86 dt: []string{"uuid"}, 87 }, 88 want: false, 89 }, 90 { 91 name: "is uuid array", 92 args: args{ 93 dt: []string{"uuid[]"}, 94 }, 95 want: true, 96 }, 97 } 98 for _, tt := range tests { 99 t.Run(tt.name, func(t *testing.T) { 100 if got := IsArrayDataType(tt.args.dt); got != tt.want { 101 t.Errorf("IsArrayDataType() = %v, want %v", got, tt.want) 102 } 103 }) 104 } 105 }