fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

at main 1.1 kB View raw
1// Licensed under the Apache License, Version 2.0 (the "License"); 2// you may not use this file except in compliance with the License. 3// You may obtain a copy of the License at 4// 5// http://www.apache.org/licenses/LICENSE-2.0 6// 7// Unless required by applicable law or agreed to in writing, software 8// distributed under the License is distributed on an "AS IS" BASIS, 9// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10// See the License for the specific language governing permissions and 11// limitations under the License. 12 13package index 14 15import ( 16 "reflect" 17 "testing" 18) 19 20func TestMatchSize(t *testing.T) { 21 cases := []struct { 22 v any 23 size int 24 }{{ 25 v: candidateMatch{}, 26 size: 80, 27 }, { 28 v: candidateChunk{}, 29 size: 40, 30 }} 31 for _, c := range cases { 32 got := reflect.TypeOf(c.v).Size() 33 if int(got) != c.size { 34 t.Errorf(`sizeof struct %T has changed from %d to %d. 35These are match structs that occur a lot in memory, so we optimize size. 36When changing, please ensure there isn't unnecessary padding via the 37tool fieldalignment then update this test.`, c.v, c.size, got) 38 } 39 } 40}