uuid v7 time is only unix milliseconds, so uuid1.Time() == uuid2.Time() is right, but uuid1 must != uuid2
(t *testing.T)
| 847 | // uuid v7 time is only unix milliseconds, so |
| 848 | // uuid1.Time() == uuid2.Time() is right, but uuid1 must != uuid2 |
| 849 | func TestVersion7_pooled(t *testing.T) { |
| 850 | SetRand(nil) |
| 851 | EnableRandPool() |
| 852 | defer DisableRandPool() |
| 853 | |
| 854 | m := make(map[string]bool) |
| 855 | for x := 1; x < 128; x++ { |
| 856 | uuid, err := NewV7() |
| 857 | if err != nil { |
| 858 | t.Fatalf("could not create UUID: %v", err) |
| 859 | } |
| 860 | s := uuid.String() |
| 861 | if m[s] { |
| 862 | t.Errorf("NewV7 returned duplicated UUID %s", s) |
| 863 | } |
| 864 | m[s] = true |
| 865 | if v := uuid.Version(); v != 7 { |
| 866 | t.Errorf("UUID of version %s", v) |
| 867 | } |
| 868 | if uuid.Variant() != RFC4122 { |
| 869 | t.Errorf("UUID is variant %d", uuid.Variant()) |
| 870 | } |
| 871 | } |
| 872 | } |
| 873 | |
| 874 | func TestVersion7FromReader(t *testing.T) { |
| 875 | myString := "8059ddhdle77cb52" |
nothing calls this directly
no test coverage detected