(t *testing.T)
| 424 | } |
| 425 | |
| 426 | func TestApplyRate(t *testing.T) { |
| 427 | tests := []struct { |
| 428 | name string |
| 429 | preciseAmount *big.Int |
| 430 | rate float64 |
| 431 | expected *big.Int |
| 432 | }{ |
| 433 | { |
| 434 | name: "regular rate", |
| 435 | preciseAmount: Int64ToBigInt(1000), |
| 436 | rate: 1.5, |
| 437 | expected: big.NewInt(1500), |
| 438 | }, |
| 439 | { |
| 440 | name: "zero rate defaults to 1", |
| 441 | preciseAmount: Int64ToBigInt(1000), |
| 442 | rate: 0, |
| 443 | expected: big.NewInt(1000), |
| 444 | }, |
| 445 | { |
| 446 | name: "rate less than 1", |
| 447 | preciseAmount: Int64ToBigInt(1000), |
| 448 | rate: 0.5, |
| 449 | expected: big.NewInt(500), |
| 450 | }, |
| 451 | } |
| 452 | |
| 453 | for _, tt := range tests { |
| 454 | t.Run(tt.name, func(t *testing.T) { |
| 455 | result := ApplyRate(tt.preciseAmount, tt.rate) |
| 456 | assert.Equal(t, tt.expected, result) |
| 457 | }) |
| 458 | } |
| 459 | } |
| 460 | |
| 461 | func TestTransaction_Validate(t *testing.T) { |
| 462 | txn := &Transaction{ |
nothing calls this directly
no test coverage detected