var instrument = (location.search && location.search.indexOf("instrument=true") !== -1);
Contract.load("MyClass.js", instrument, function(){
try {
var myClass = new MyClass({
mode: "multiply"
});
var result = myClass.publicMethod(34, 5, 3);
}
catch (ex) {
alert(ex.message);
}
});
When run without instrumentation this will not create any exceptions, but when run with instrumentation an erroneous postcondition will come into play.
The offending code is
Contract.guarantees(function(result){
return result === 0;
}, "Result must be > 0");