Andrei Alexandrescu wrote: > On 1/5/11 8:54 PM, Ary Borenszweig wrote: > >I prefer assert, assertFalse, assertEqual and assertNotEqual. > > > >Compare this: > >assertPredicate!"a< b"(1 + 1, 3); > > > >To this: > >assert(1 + 1< 3) > > > >Or to this: > > > >assertLess(1 + 1, 3) > > > >Ok, the first one is more generic. But so the error message for the > >assertion failure will be more generic, when you want exactly the opposite > >to happen. > >Plus your brain has to think more to read it (starting from the point that > >it's longer). > > > >assertPredicate!"<"(1 + 1, 3) reminds me of polish notation, which is very > >good for machines but not very good for humans. > > One problem with using distinct names is the explosion thereof. > Google unittests have EXPECT_EQ, EXPECT_NE, EXPECT_LT, EXPECT_GT, > EXPECT_LE, EXPECT_GE, EXPECT_TRUE, EXPECT_FALSE and probably others. > I was able to write these from memory because I used to know > Fortran, which uses the same two-letter conventions for comparisons. > At that point I think we can say, wait a minute, why not use the > respective symbols which are impossible to forget?
I partly share this. But there may be users who are not that deeply into the template stuff. Even though they miss a lot. I'd like to have testing easy and assertEqual is easy. I mean Jonathan started with those names. When I look now at the documentation the name assertPred alone does not tell much. I feel a bit lost. Why not define an alias? I mean there are people who master assertPred. Why not giving others a slow start using assertEqual and friends. Jens