init monlet repo with stage 0-2 (docs, contract, agent MVP)
This commit is contained in:
20
agent/internal/eventid/eventid_test.go
Normal file
20
agent/internal/eventid/eventid_test.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package eventid
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var pattern = regexp.MustCompile(`^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$`)
|
||||
|
||||
func TestNewMatchesContract(t *testing.T) {
|
||||
for i := 0; i < 100; i++ {
|
||||
id, err := New()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !pattern.MatchString(id) {
|
||||
t.Fatalf("invalid UUIDv7: %q", id)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user