Count number of tests correctly

also reindent code
Merge pull request #110 from tjhei/cmake_improvements

Count number of tests correctly