Skip to content

Commit 9a5379e

Browse files
committed
Slightly cleaner tests
1 parent ea31c3f commit 9a5379e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

riemann/counterexample_search.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package riemann
22

33
import (
44
"errors"
5+
"fmt"
56
"math"
67
)
78

@@ -15,7 +16,7 @@ func WitnessValue(n int64, pds int64) float64 {
1516
divSum, err = pds, nil
1617
}
1718
if err != nil {
18-
panic("Error calculating DivisorSum")
19+
panic(fmt.Sprintf("Error calculating DivisorSum for %d", n))
1920
}
2021

2122
return float64(divSum) / float64(denom)

riemann/counterexample_search_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var _ = Describe("CounterExample Search", func() {
2929
})
3030

3131
It("should panic if asked to find witnesses for cases where DivisorSum cannot be found", func() {
32-
Expect(func() { riemann.WitnessValue(-1, -1) }).To(PanicWith("Error calculating DivisorSum"))
32+
Expect(func() { riemann.WitnessValue(-1, -1) }).To(PanicWith("Error calculating DivisorSum for -1"))
3333
})
3434

3535
It("should search successfully", func() {
@@ -41,11 +41,12 @@ var _ = Describe("CounterExample Search", func() {
4141
})
4242

4343
It("should find best witness successfully", func() {
44-
count_till := int64(100000)
45-
output, witnessVal := riemann.BestWitness(count_till, 5041)
44+
count_till := int64(100_000)
45+
46+
output, witnessVal := riemann.BestWitness(count_till, 11000)
4647
fmt.Println("\nCurrent Best till", humanize.Comma(int64(count_till)), "is", output, "at value", witnessVal)
4748

48-
Expect(output).To(Equal(int64(10080)))
49+
Expect(output).To(Equal(int64(55440)))
4950
})
5051

5152
It("Should compute riemann sums correctly", func() {

0 commit comments

Comments
 (0)