2024-07-27 14:15:25 +08:00
|
|
|
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud .
|
2023-07-20 14:25:42 +08:00
|
|
|
|
|
|
|
|
package models_test
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
2024-07-27 14:15:25 +08:00
|
|
|
|
|
|
|
|
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
2023-07-20 14:25:42 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestNewSysLockerIncrement(t *testing.T) {
|
|
|
|
|
var increment = models.NewSysLockerIncrement(10)
|
|
|
|
|
increment.Push("key", 1, 10)
|
|
|
|
|
t.Log(increment.MaxValue("key"))
|
|
|
|
|
for i := 0; i < 11; i++ {
|
|
|
|
|
result, value := increment.Pop("key")
|
|
|
|
|
t.Log(i, "=>", result, value)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for i := 0; i < 11; i++ {
|
|
|
|
|
result, value := increment.Pop("key1")
|
|
|
|
|
t.Log(i, "=>", result, value)
|
|
|
|
|
}
|
|
|
|
|
}
|