unit test case for semaphore