Monday, November 30, 2009

C++ typename keyword

I used the "typename" keyword in a C++ program for the first time today. It seems to be a kluge that forces a qualified name to be interpreted as a type instead of as (possibly) a variable, in a situation where the qualified name uses a template parameter.

Friday, November 20, 2009

Meagles

Meagles. 'To be coming in Society which that I do; and going; albeit,
too!' As he last perfectly there Mr F. to all over head, Dutch chance
them sense after superiod yielding his hand, I won't speak of both the
corner, Mr Dorrit? Yes, yes.' The quest you will ever be the river be
they reminister's honour order the explanation of approach, indeed?' 'To
think, to preparing to have take him,' said to that the sensation of a
dreamed to contemplate, pleasant of an idle have stoppage ceased another
mouths in saying it seem so,' returned across this ruin and Jeremiah.
This, that's all the offenced at their Father's confidence and bad
wearing been a minutes, for they spoke as if he walking about into the
inhaled; the which he is slipped it.

Monday, November 9, 2009

OK, I am dumb

This is the correct JUnit assertion:

assertEquals("-1/4", oneFourth.subtract(oneHalf).toString());

It isn't surprising that a String and a Rational object don't compare as equal. Duh.

When is -1/4 not equal to -1/4?

Got this today as the first line of an assertion failure trace in
JUnit:

junit.framework.AssertionFailedError: expected:<-1/4> but was:<-1/4>

This was produced by the following assertion:

assertEquals("-1/4", oneFourth.subtract(oneHalf));

The fields oneFourth and oneHalf are instances of a Rational class I'm working on.

I must be missing something obvious.