Update Swig to latest version

The swig definitions have been totally rewritten to the latest version
as of time of commit.

See: http://paularmstrong.github.io/swig/docs/api/ for how the API
should work.

I have also updated the tests to hopefully catch any obvious issues.