(t *testing.T)
| 442 | } |
| 443 | |
| 444 | func TestMathResolve(t *testing.T) { |
| 445 | two := int64(2) |
| 446 | |
| 447 | type args struct { |
| 448 | mathType v1beta1.MathTransformType |
| 449 | multiplier *int64 |
| 450 | clampMin *int64 |
| 451 | clampMax *int64 |
| 452 | i any |
| 453 | } |
| 454 | type want struct { |
| 455 | o any |
| 456 | err error |
| 457 | } |
| 458 | |
| 459 | cases := map[string]struct { |
| 460 | args |
| 461 | want |
| 462 | }{ |
| 463 | "InvalidType": { |
| 464 | args: args{ |
| 465 | mathType: "bad", |
| 466 | i: 25, |
| 467 | }, |
| 468 | want: want{ |
| 469 | err: &field.Error{ |
| 470 | Type: field.ErrorTypeInvalid, |
| 471 | Field: "type", |
| 472 | }, |
| 473 | }, |
| 474 | }, |
| 475 | "NonNumberInput": { |
| 476 | args: args{ |
| 477 | mathType: v1beta1.MathTransformTypeMultiply, |
| 478 | multiplier: &two, |
| 479 | i: "ola", |
| 480 | }, |
| 481 | want: want{ |
| 482 | err: errors.Errorf(errFmtMathInputNonNumber, "ola"), |
| 483 | }, |
| 484 | }, |
| 485 | "MultiplyNoConfig": { |
| 486 | args: args{ |
| 487 | mathType: v1beta1.MathTransformTypeMultiply, |
| 488 | i: 25, |
| 489 | }, |
| 490 | want: want{ |
| 491 | err: &field.Error{ |
| 492 | Type: field.ErrorTypeRequired, |
| 493 | Field: "multiply", |
| 494 | }, |
| 495 | }, |
| 496 | }, |
| 497 | "MultiplySuccess": { |
| 498 | args: args{ |
| 499 | mathType: v1beta1.MathTransformTypeMultiply, |
| 500 | multiplier: &two, |
| 501 | i: 3, |
nothing calls this directly
no test coverage detected