(t *testing.T)
| 815 | } |
| 816 | |
| 817 | func TestFindLargestDecimal(t *testing.T) { |
| 818 | t.Run("Find largest", func(t *testing.T) { |
| 819 | amounts := map[string]decimal.Decimal{ |
| 820 | "a": decimal.NewFromFloat(100.50), |
| 821 | "b": decimal.NewFromFloat(200.75), |
| 822 | "c": decimal.NewFromFloat(50.25), |
| 823 | } |
| 824 | key, amount := findLargestDecimal(amounts) |
| 825 | assert.Equal(t, "b", key) |
| 826 | assert.True(t, amount.Equal(decimal.NewFromFloat(200.75))) |
| 827 | }) |
| 828 | |
| 829 | t.Run("Single element", func(t *testing.T) { |
| 830 | amounts := map[string]decimal.Decimal{ |
| 831 | "only": decimal.NewFromFloat(123.45), |
| 832 | } |
| 833 | key, amount := findLargestDecimal(amounts) |
| 834 | assert.Equal(t, "only", key) |
| 835 | assert.True(t, amount.Equal(decimal.NewFromFloat(123.45))) |
| 836 | }) |
| 837 | |
| 838 | t.Run("Empty map", func(t *testing.T) { |
| 839 | amounts := map[string]decimal.Decimal{} |
| 840 | key, amount := findLargestDecimal(amounts) |
| 841 | assert.Equal(t, "", key) |
| 842 | assert.True(t, amount.IsZero()) |
| 843 | }) |
| 844 | } |
| 845 | |
| 846 | func TestHandleZeroAmount(t *testing.T) { |
| 847 | t.Run("Multiple distributions", func(t *testing.T) { |
nothing calls this directly
no test coverage detected