Skip to content

Instantly share code, notes, and snippets.

@gilligan gilligan/add.js Secret
Created Dec 10, 2015

Embed
What would you like to do?
var R = require('..');
var eq = require('./shared/eq');
var jsc = require("jsverify");
describe('add', function() {
it('adds together two numbers', function() {
eq(R.add(3, 7), 10);
});
it('is curried', function() {
var incr = R.add(1);
eq(incr(42), 43);
});
describe('properties', function () {
jsc.property("commutative", "integer", "integer", function (a, b) {
return R.add(a,b) === R.add(b,a);
});
jsc.property("associative", "integer", "integer", "integer", function (a, b, c) {
return R.add(a, R.add(b, c)) === R.add(R.add(a, b), c);
});
jsc.property("unit element", "integer" , function (a) {
return R.add(a, 0) === a;
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.