a scan chain including a plurality of pairs of a selector and a flipflop arranged in cascade, wherein the scan chain performs a capture mode in which in response to a scan enable signal the flipflop captures data from an internal circuit in synchronization with a predetermined clock and a shift mode in which in response to the scan enable signal, one of the data stored in the flipflop and test dat