util_test.go 727 Bytes
package test

import (
	"crypto/ecdsa"
	"example.com/m/conf"
	"example.com/m/utils"
	"math/big"
	"reflect"
	"testing"
)

func TestGenerateRandomNumber(t *testing.T) {
	type args struct {
		privateKey *ecdsa.PrivateKey
		length     int64
	}
	tests := []struct {
		name string
		args args
		want *big.Int
	}{
		// TODO: Add test cases.
		{
			"randomPrvTest",
			args{
				privateKey: conf.GetConfig().SignPrivateKey,
				length:     2,
			},
			big.NewInt(1),
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := utils.GenerateRandomNumber(tt.args.privateKey, tt.args.length); !reflect.DeepEqual(got, tt.want) {
				t.Errorf("GenerateRandomNumber() = %v, want %v", got, tt.want)
			}
		})
	}
}