equalityPredicate = function(type, var1, var2) {
    'use strict';
    var typedPredicate =
        goog.testing.asserts.primitiveRoughEqualityPredicates_[type];
    if (!typedPredicate) {
      return goog.testing.asserts.EQUALITY_PREDICATE_CANT_PROCESS;
    }
    var equal = typedPredicate(var1, var2, tolerance);
    return equal ? goog.testing.asserts.EQUALITY_PREDICATE_VARS_ARE_EQUAL :
                   goog.testing.asserts.getDefaultErrorMsg_(var1, var2) +
            ' which was more than ' + tolerance + ' away';
  }
Similar to assertObjectEquals above, but accepts a tolerance margin.

@param {*} a Assertion message or comparison object.
@param {*} b Comparison object.
@param {*} c Comparison object or tolerance.
@param {*=} opt_d Tolerance, if an assertion message was provided.