Bias Testing and Mitigation in LLM-based Code Generation