2024-04-27 07:08:33 +00:00
|
|
|
package xsync_test
|
|
|
|
|
|
|
|
import (
|
2024-06-23 08:24:36 +00:00
|
|
|
. "github.com/mudler/LocalAI/pkg/xsync"
|
2024-04-27 07:08:33 +00:00
|
|
|
|
|
|
|
. "github.com/onsi/ginkgo/v2"
|
|
|
|
. "github.com/onsi/gomega"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ = Describe("SyncMap", func() {
|
|
|
|
|
|
|
|
Context("Syncmap", func() {
|
|
|
|
It("sets and gets", func() {
|
|
|
|
m := NewSyncedMap[string, string]()
|
|
|
|
m.Set("foo", "bar")
|
|
|
|
Expect(m.Get("foo")).To(Equal("bar"))
|
|
|
|
})
|
|
|
|
It("deletes", func() {
|
|
|
|
m := NewSyncedMap[string, string]()
|
|
|
|
m.Set("foo", "bar")
|
|
|
|
m.Delete("foo")
|
|
|
|
Expect(m.Get("foo")).To(Equal(""))
|
|
|
|
Expect(m.Exists("foo")).To(Equal(false))
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|