func Test_CheckErrorThrottling(t *testing.T) {
	throttleTimeSec := time.Duration(2)
	otpUser, hotp := addDefaultOtpUserGetHotp(t, throttleTimeSec)
	for i := 0; i < 10; i++ {
		refTime := time.Now()
		otpUser.setBlockedState(false)                                           
		factor := time.Duration(i+1) * throttleTimeSec                           
		ok, err := otpUser.verifyOtpUserCodeHelper(wrongCode, HotpType, factor)  
		if err != nil {
			t.Error("Test fail, err:", err)
		}
		throttleTimer, err := otpUser.getOtpUserThrottlingTimer(TotpType)
		if err != nil {
			t.Error("Test fail, err:", err)
		} else {
			expected := time.Now().Add(time.Duration(factor) * time.Second)
			if throttleTimer.After(expected) {
				fmt.Printf("Test failed, expected the throttle value to be lower than %v, but the return throttling value was %v. Time now is %v and factor is%v\n",
					expected, throttleTimer, time.Now(), factor)
				t.Errorf("Test failed, expected the throttle value to be lower than %v, but the returned throttling value was %v",
					expected, throttleTimer)
			}
			if i == 0 {  
				code, _ := hotp.AtCount(hotp.Count)
				codeOk, _ := otpUser.VerifyOtpUserCode(code, HotpType)  
				if codeOk {
					t.Error("Test fail, Time:", time.Now(), ", OTP shuld not be checked before:", throttleTimer)
				}
				codeOk, err = otpUser.verifyOtpUserCodeHelper(code, HotpType, factor)
				if debug {
					fmt.Println("Calculated code = ", code, ", match = ", ok)
				}
				if !codeOk || err != nil {
					t.Errorf("Test fail, expected to be throttle for: %vs, checked after %v, err: %v",
						throttleTimeSec, time.Now().Unix()-refTime.Unix(), err)
				}
				if codeOk {  
					hotp.Next()
				}
			}
		}
	}
}
Check that the throttling counter delay count as expected (2^num of unsuccessfull retries)
and the next time the code is checked is after the throttling time pass
package otp
import (
	"fmt"
	"testing"
	"time"
	defs "github.com/ibm-security-innovation/libsecurity-go/defs"
)
const (
	wrongCode = "1234"
)
func testGenerateOtpUser(t *testing.T, thrTimeSec time.Duration) *UserInfoOtp {
	otpUser, err := NewOtpUser(BaseSecret, true, false, defaultThrottlingLen, thrTimeSec, manuelUnblockSec, defaultHotpWindowsSize, defaultTotpWindowsSizeSec, defaultStartCounter)
	if err != nil {
		t.Errorf("Test fail, can't generate otpUser, error: %v", err)
		t.FailNow()
	}
	return otpUser
}
func addDefaultOtpUserGetHotp(t *testing.T, throttleTimeSec time.Duration) (*UserInfoOtp, *Hotp) {
	otpUser := testGenerateOtpUser(t, throttleTimeSec)
	hotp := testGetHotp(t)
	return otpUser, hotp
}
func addDefaultOtpUserGetTotp(t *testing.T, throttleTimeSec time.Duration) (*UserInfoOtp, *Totp) {
	otpUser := testGenerateOtpUser(t, throttleTimeSec)
	totp := testGetTotp(t)
	return otpUser, totp
}