(t *testing.T)
| 672 | } |
| 673 | |
| 674 | func TestLimiter_minNonZero(t *testing.T) { |
| 675 | t.Parallel() |
| 676 | |
| 677 | tests := map[string]struct { |
| 678 | first int |
| 679 | second int |
| 680 | expected int |
| 681 | }{ |
| 682 | "both zero": { |
| 683 | first: 0, |
| 684 | second: 0, |
| 685 | expected: 0, |
| 686 | }, |
| 687 | "first is zero": { |
| 688 | first: 0, |
| 689 | second: 1, |
| 690 | expected: 1, |
| 691 | }, |
| 692 | "second is zero": { |
| 693 | first: 1, |
| 694 | second: 0, |
| 695 | expected: 1, |
| 696 | }, |
| 697 | "both non zero, second > first": { |
| 698 | first: 1, |
| 699 | second: 2, |
| 700 | expected: 1, |
| 701 | }, |
| 702 | "both non zero, first > second": { |
| 703 | first: 2, |
| 704 | second: 1, |
| 705 | expected: 1, |
| 706 | }, |
| 707 | } |
| 708 | |
| 709 | for testName, testData := range tests { |
| 710 | |
| 711 | t.Run(testName, func(t *testing.T) { |
| 712 | assert.Equal(t, testData.expected, minNonZero(testData.first, testData.second)) |
| 713 | }) |
| 714 | } |
| 715 | } |
| 716 | |
| 717 | type ringCountMock struct { |
| 718 | mock.Mock |
nothing calls this directly
no test coverage detected