github.com/haraldrudell/parl@v0.4.176/unique-id_test.go (about) 1 /* 2 © 2022–present Harald Rudell <harald.rudell@gmail.com> (https://haraldrudell.github.io/haraldrudell/) 3 ISC License 4 */ 5 6 package parl 7 8 import "testing" 9 10 func TestUniqueID(t *testing.T) { 11 //t.Fail() 12 expect1 := "1" 13 expect2 := "2" 14 15 type myType string 16 var generator UniqueID[myType] 17 var actual myType 18 19 actual = generator.ID() 20 21 // parl.myType "1" 22 t.Logf("%T %[1]q", actual) 23 if actual != myType(expect1) { 24 t.Errorf("actual 1: %q exp %q", actual, expect1) 25 } 26 27 actual = generator.ID() 28 29 if actual != myType(expect2) { 30 t.Errorf("actual 1: %q exp %q", actual, expect2) 31 } 32 }