Added not isnan asserts.
Add belief propagation test case.