Improve unit tests for factor graph objects.