add unit and functional tests