Debian Codegraph @

search/search_test.go

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 package main
2
3 import (
4 "math/big"
5 "reflect"
6 "testing"
7 )
8
9 func BenchmarkNextSiec(b *testing.B) {
10 M := new(big.Int)
11 M.SetString("100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 16)
12 b.ResetTimer()
13 for i := 1; i < b.N; i++ {
14 nextSiec(M)
15 }
16 }
17
18 func Test_nextSiec(t *testing.T) {
19 type args struct {
20 M *big.Int
21 }
22 tests := []struct {
23 name string
24 args args
25 wantT *big.Int
26 wantQ *big.Int
27 }{
28 {
29 name: "10^10",
30 args: args{M: big.NewInt(10000000000)},
31 wantT: big.NewInt(200001),
32 wantQ: big.NewInt(10000100003),
33 },
34 }
35 for _, tt := range tests {
36 t.Run(tt.name, func(t *testing.T) {
37 gotT, gotQ := nextSiec(tt.args.M)
38 if !reflect.DeepEqual(gotT, tt.wantT) {
39 t.Errorf("nextSiec() gotT = %v, want %v", gotT, tt.wantT)
40 }
41 if !reflect.DeepEqual(gotQ, tt.wantQ) {
42 t.Errorf("nextSiec() gotQ = %v, want %v", gotQ, tt.wantQ)
43 }
44 })
45 }
46 }