you should be able to write a simple test program to just check that behaviour.
BTW you miss a break in the second if.