1package set 2 3// testRules is a rules implementation that is used for testing. It only 4// accepts ints as values, and it has a Hash function that just returns the 5// given value modulo 16 so that we can easily and dependably test the 6// situation where two non-equivalent values have the same hash value. 7type testRules struct{} 8 9func (r testRules) Hash(val interface{}) int { 10 return val.(int) % 16 11} 12 13func (r testRules) Equivalent(val1 interface{}, val2 interface{}) bool { 14 return val1 == val2 15} 16 17func (r testRules) SameRules(other Rules) bool { 18 return r == other // true if "other" is also a testRules 19} 20