24 lines
340 B
Go
24 lines
340 B
Go
package mdb
|
|
|
|
import (
|
|
"sync"
|
|
"testing"
|
|
)
|
|
|
|
func TestDatabase(t *testing.T) {
|
|
testWithDB(t, "multiple writers", func(t *testing.T, db *DB) {
|
|
wg := sync.WaitGroup{}
|
|
N := 64
|
|
wg.Add(64)
|
|
for i := 0; i < N; i++ {
|
|
go func() {
|
|
defer wg.Done()
|
|
for j := 0; j < 1024; j++ {
|
|
db.RandAction()
|
|
}
|
|
}()
|
|
}
|
|
wg.Wait()
|
|
})
|
|
}
|