test a function that counts the number of occurrences of a substring in a string