generated from UofSC-Fall-2022-Math-587-001/homework7
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhw8_test.go
65 lines (59 loc) · 1.2 KB
/
hw8_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package hw8
import (
"fmt"
"testing"
)
func Test1(t *testing.T) {
N := 10
b := 3
_ , err := Pollard(N,b)
s := fmt.Sprint(err)
if s != "Test Failed" {
t.Errorf("The test should fail with N = %d, b = %d",N,b)
}
}
func Test2(t *testing.T) {
N := 10
b := 4
got , err := Pollard(N,b)
want := 5
if err != nil {
t.Errorf("The test should work but you returned the error: %q",err)
}
if got != want {
t.Errorf("You return %d as the common prime but it is %d.",got,want)
}
}
func Test3(t *testing.T) {
N := 11
b := 100
_ , err := Pollard(N,b)
s := fmt.Sprint(err)
if s != "Test Failed" {
t.Errorf("The test should fail with N = %d, b = %d",N,b)
}
}
func Test4(t *testing.T) {
N := 61685147
b := 45
got , err := Pollard(N,b)
want := 7841
if err != nil {
t.Errorf("The test should work but you returned the error: %q",err)
}
if got != want {
t.Errorf("You return %d as the common prime but it is %d.",got,want)
}
}
func Test5(t *testing.T) {
N := 58972723
b := 100
got , err := Pollard(N,b)
want := 7481
if err != nil {
t.Errorf("The test should work but you returned the error: %q",err)
}
if got != want {
t.Errorf("You return %d as the common prime but it is %d.",got,want)
}
}