add more tests and reorganize the code that chooses the vector quantization inner loop