github.com/matrixorigin/matrixone@v1.2.0/pkg/vectorize/moarray/internal_test.go (about) 1 // Copyright 2023 Matrix Origin 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package moarray 16 17 //func TestNormalizeMoArray(t *testing.T) { 18 // type args struct { 19 // vector []float64 20 // } 21 // tests := []struct { 22 // name string 23 // args args 24 // want []float64 25 // }{ 26 // { 27 // name: "Test1", 28 // args: args{ 29 // vector: []float64{1, 2, 3}, 30 // }, 31 // want: []float64{0.2672612419124244, 0.5345224838248488, 0.8017837257372732}, 32 // }, 33 // { 34 // name: "Test2", 35 // args: args{ 36 // vector: []float64{-1, 2, 3}, 37 // }, 38 // want: []float64{-0.2672612419124244, 0.5345224838248488, 0.8017837257372732}, 39 // }, 40 // { 41 // name: "Test3", 42 // args: args{ 43 // vector: []float64{0, 0, 0}, 44 // }, 45 // want: []float64{0, 0, 0}, 46 // }, 47 // { 48 // name: "Test4", 49 // args: args{ 50 // vector: []float64{10, 3.333333333333333, 4, 5}, 51 // }, 52 // want: []float64{0.8108108108108107, 0.27027027027027023, 0.3243243243243243, 0.4054054054054054}, 53 // }, 54 // { 55 // name: "Test5", 56 // args: args{ 57 // vector: []float64{1, 2, 3.6666666666666665, 4.666666666666666}, 58 // }, 59 // want: []float64{0.15767649936829103, 0.31535299873658207, 0.5781471643504005, 0.7358236637186913}, 60 // }, 61 // } 62 // for _, tt := range tests { 63 // t.Run(tt.name, func(t *testing.T) { 64 // if got := NormalizeMoVecf64(tt.args.vector); !assertx.InEpsilonF64Slice(tt.want, got) { 65 // t.Errorf("NormalizeMoVecf64() = %v, want %v", got, tt.want) 66 // } 67 // }) 68 // } 69 //}