unit test for Semaphore

Why are you using a for loop? It will always fail at the first attempt. 

So remove the for loop. Make the test as simple as possible (not simpler). Because people will be reading your test many times and they will be confused when they see it.