patterndb,test: Fixed checking on message values.
patterndb,test: Added test rule and test case for conditions when no context present.
patterndb,test: Fixed test for calculating context-length.

This test is a tricky one. When we have a rule and a corresponding context,
and an action attached to the rule which emits a new message,
when the fields of the new message is set, the message will be temporary
part of this context. So when we use the context-length template function
in a message which is currently emitted, the actual context length
will be one message larger than you expect.