added a testCases.R to demonstrate how to use the functions