package models

import (
	_ "github.com/go-sql-driver/mysql"
	"github.com/iwind/TeaGo/dbs"
	"runtime"
	"testing"
)

func TestIPListDAO_IncreaseVersion(t *testing.T) {
	dbs.NotifyReady()

	dao := NewIPListDAO()
	version, err := dao.IncreaseVersion()
	if err != nil {
		t.Fatal(err)
	}
	t.Log("version:", version)
}

func BenchmarkIPListDAO_IncreaseVersion(b *testing.B) {
	runtime.GOMAXPROCS(1)

	dbs.NotifyReady()

	dao := NewIPListDAO()
	for i := 0; i < b.N; i++ {
		_, _ = dao.IncreaseVersion()
	}
}
