test for countWords method