func TestUtilityBinaryRelation(t *testing.T) { s := set.New() s.Add("one") s.Add("two") s.Add("three") ub := NewUtilityBinaryRelationOn(s, u) if !relation.Reflexive(ub) { t.Errorf("Our UtilityBinaryRelation should be reflexive") } if !relation.Complete(ub) { t.Errorf("Our UtilityBinaryRelation should be complete") } if !relation.Transitive(ub) { t.Errorf("Our UtilityBinaryRelation should be transitive") } if !Rational(Preference(ub)) { t.Errorf("Our UtilityBinaryRelation should be rational! -- von Neumann-Morgenstern") } }
func BenchmarkTransitive(b *testing.B) { for n := 0; n < b.N; n++ { if relation.Transitive(lessEqual) != true { b.Fatalf("The less than or equal to relation should be transitive") } } }