debugging DefaltApplyJitter, adding tests

This commit is contained in:
2026-02-26 19:55:48 -05:00
parent b4edee4292
commit 8cefae503f
4 changed files with 79 additions and 13 deletions
+2
View File
@@ -93,6 +93,8 @@ func Fibonacci(n int64) int64 {
case n >= int64(len(TheFibonacciSequence)):
panic(fmt.Sprintf("invalid input: %d overflows int64\n",
n))
case n < 0:
panic(fmt.Sprintf("invalid input: %d would cause index out of range panic\n", n))
default:
return TheFibonacciSequence[n]
}
-8
View File
@@ -2,19 +2,12 @@ package fibonacci
import (
"context"
"fmt"
"math/big"
"testing"
"time"
"code.wmdillon.com/wmdillon/backoff/utilities"
)
func wouldOverflow(a, b int64) (product int64, overflows bool) {
results := new(big.Int).Mul(big.NewInt(a), big.NewInt(b))
return results.Int64(), results.IsInt64()
}
func fibonacci(n int64) int64 {
switch {
case n <= 0:
@@ -129,7 +122,6 @@ func TestFibonacciPauseLimit(t *testing.T) {
t.Fatalf("error for %d: expected value in range %s - %s; got %s\n", input, min, max, got)
}
}
fmt.Printf("finished\n")
}
func TestFibonacciBackoffAfter(t *testing.T) {