Merge pull request #1014 from leogdion + Added tests