1package ldap 2 3import ( 4 "reflect" 5 "testing" 6) 7 8// TestNewEntry tests that repeated calls to NewEntry return the same value with the same input 9func TestNewEntry(t *testing.T) { 10 dn := "testDN" 11 attributes := map[string][]string{ 12 "alpha": {"value"}, 13 "beta": {"value"}, 14 "gamma": {"value"}, 15 "delta": {"value"}, 16 "epsilon": {"value"}, 17 } 18 executedEntry := NewEntry(dn, attributes) 19 20 iteration := 0 21 for { 22 if iteration == 100 { 23 break 24 } 25 testEntry := NewEntry(dn, attributes) 26 if !reflect.DeepEqual(executedEntry, testEntry) { 27 t.Fatalf("subsequent calls to NewEntry did not yield the same result:\n\texpected:\n\t%s\n\tgot:\n\t%s\n", executedEntry, testEntry) 28 } 29 iteration = iteration + 1 30 } 31} 32