Separate test case generation from test function.
Freq maps string to its frequency.