-
-
Save gilligan/0e4ac7fb3ecc8b6e2141 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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