Unit Testing

Added a unit testing framework in test.js. Related to #2