Skip to content

Instantly share code, notes, and snippets.

@codedmart
Created March 2, 2016 18:12
Show Gist options
  • Save codedmart/1dc7e38ab7d64aea6465 to your computer and use it in GitHub Desktop.
Save codedmart/1dc7e38ab7d64aea6465 to your computer and use it in GitHub Desktop.
var assert = require('assert')
var inversions = require('Inversions').inversions
var list = require('Data.List')
describe('The inversion counting function', function() {
it('should find an inversion', function () {
assert.equal(inversions(list.Cons.create(1)(list.Cons.create(2)(list.Cons.create(3)(list.Cons.create(4)(list.Nil.value))))), 0)
assert.equal(inversions(list.Cons.create(2)(list.Cons.create(1)(list.Cons.create(3)(list.Cons.create(4)(list.Nil.value))))), 1)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment