| 259 | } |
| 260 | |
| 261 | func TestStatic_Kind(t *testing.T) { |
| 262 | tests := []struct { |
| 263 | arg any |
| 264 | ok bool |
| 265 | }{ |
| 266 | // supported values |
| 267 | {arg: KindUnspecified, ok: true}, |
| 268 | {arg: KindInternal, ok: true}, |
| 269 | {arg: KindClient, ok: true}, |
| 270 | {arg: KindServer, ok: true}, |
| 271 | {arg: KindProducer, ok: true}, |
| 272 | {arg: KindConsumer, ok: true}, |
| 273 | // unsupported values |
| 274 | {arg: 1}, |
| 275 | {arg: 3.14}, |
| 276 | {arg: "test"}, |
| 277 | {arg: true}, |
| 278 | {arg: StatusOk}, |
| 279 | {arg: []int{1, 2, 3}}, |
| 280 | {arg: []float64{1.0, 2.2}}, |
| 281 | {arg: []bool{true, true}}, |
| 282 | {arg: []string{"aa", "bb"}}, |
| 283 | } |
| 284 | |
| 285 | for _, tt := range tests { |
| 286 | t.Run(testName(tt.arg), func(t *testing.T) { |
| 287 | static := newStatic(tt.arg) |
| 288 | k, ok := static.Kind() |
| 289 | |
| 290 | require.Equal(t, tt.ok, ok) |
| 291 | if tt.ok { |
| 292 | assert.Equal(t, tt.arg, k) |
| 293 | } |
| 294 | }) |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | func TestStatic_IntArray(t *testing.T) { |
| 299 | tests := []struct { |