go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/cv/internal/cvtesting/saferesembletest/types.go (about)

     1  // Copyright 2021 The LUCI Authors.
     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 saferesembletest exists to test better cvtesting.SafeShouldResemble
    16  package saferesembletest
    17  
    18  import (
    19  	"time"
    20  
    21  	"google.golang.org/protobuf/types/known/timestamppb"
    22  )
    23  
    24  type NoProtos struct {
    25  	a int
    26  	A time.Time
    27  }
    28  
    29  func NewNoProtos(a int, A time.Time) NoProtos {
    30  	return NoProtos{a: a, A: A}
    31  }
    32  
    33  type WithPrivateProto struct {
    34  	A int
    35  	b string
    36  	t *timestamppb.Timestamp
    37  }
    38  
    39  func NewWithPrivateProto(A int, b string, t *timestamppb.Timestamp) WithPrivateProto {
    40  	return WithPrivateProto{A: A, b: b, t: t}
    41  }
    42  
    43  type WithInnerStructNoProto struct {
    44  	X int
    45  	y string
    46  	I NoProtos
    47  }
    48  
    49  func NewWithInnerStructNoProto(X int, y string, I NoProtos) WithInnerStructNoProto {
    50  	return WithInnerStructNoProto{X: X, y: y, I: I}
    51  }
    52  
    53  type WithInnerStructHasProto struct {
    54  	X int
    55  	y string
    56  	I WithPrivateProto
    57  }
    58  
    59  func NewWithInnerStructHasProto(X int, y string, I WithPrivateProto) WithInnerStructHasProto {
    60  	return WithInnerStructHasProto{X: X, y: y, I: I}
    61  }
    62  
    63  type WithPrivateInnerStructNoProto struct {
    64  	X int
    65  	y string
    66  	i NoProtos
    67  }
    68  
    69  func NewWithPrivateInnerStructNoProto(X int, y string, i NoProtos) WithPrivateInnerStructNoProto {
    70  	return WithPrivateInnerStructNoProto{X: X, y: y, i: i}
    71  }
    72  
    73  type WithPrivateStructHasProto struct {
    74  	X int
    75  	y string
    76  	i WithPrivateProto
    77  }
    78  
    79  func NewWithPrivateStructHasProto(X int, y string, i WithPrivateProto) WithPrivateStructHasProto {
    80  	return WithPrivateStructHasProto{X: X, y: y, i: i}
    81  }
    82  
    83  type WithInnerStructSliceNoProto struct {
    84  	X  int
    85  	y  string
    86  	Is []NoProtos
    87  }
    88  
    89  func NewWithInnerStructSliceNoProto(X int, y string, Is []NoProtos) WithInnerStructSliceNoProto {
    90  	return WithInnerStructSliceNoProto{X: X, y: y, Is: Is}
    91  }
    92  
    93  type WithInnerStructSliceHasProto struct {
    94  	X  int
    95  	y  string
    96  	Is []WithPrivateProto
    97  }
    98  
    99  func NewWithInnerStructSliceHasProto(X int, y string, Is []WithPrivateProto) WithInnerStructSliceHasProto {
   100  	return WithInnerStructSliceHasProto{X: X, y: y, Is: Is}
   101  }
   102  
   103  type WithPrivateInnerStructSliceNoProto struct {
   104  	X  int
   105  	y  string
   106  	is []NoProtos
   107  }
   108  
   109  func NewWithPrivateInnerStructSliceNoProto(X int, y string, is []NoProtos) WithPrivateInnerStructSliceNoProto {
   110  	return WithPrivateInnerStructSliceNoProto{X: X, y: y, is: is}
   111  }
   112  
   113  type WithPrivateInnerStructSliceHasProto struct {
   114  	X  int
   115  	y  string
   116  	is []WithPrivateProto
   117  }
   118  
   119  func NewWithPrivateInnerStructSliceHasProto(X int, y string, is []WithPrivateProto) WithPrivateInnerStructSliceHasProto {
   120  	return WithPrivateInnerStructSliceHasProto{X: X, y: y, is: is}
   121  }