Exploring modeling and testing of NAND flash memories