1. A method, comprising: in a memory device operating in a testing mode, receiving a vector to be written to the memory device; writing the vector to the memory device only if the vector belongs to a predefined set of test vectors; and if the vector does not belong to the set of test vectors, converting the vector to one of the test vectors by selecting a subset of bits of the vector and replacing remaining bits of the vector with periodic replications of the selected subset, and writing the converted vector to the memory device.