A Comprehensive Test and Diagnostic Strategy for TCAMs