It should detect 4 cases as below(refer to red color font):