VIP 👤
🏠 Trang chủ
Benchmark
📊 Tất cả benchmark 🦖 Khủng long v1 🦖 Khủng long v2 ✅ Ứng dụng To-Do List 🎨 Trang tự do sáng tạo 🎯 FSACB - Trình diễn cuối cùng 🌍 Benchmark dịch thuật
Mô hình
🏆 Top 10 mô hình 🆓 Mô hình miễn phí 📋 Tất cả mô hình ⚙️ Kilo Code
Tài nguyên
💬 Thư viện prompt 📖 Thuật ngữ AI 🔗 Liên kết hữu ích 🔌 API và bộ định tuyến AI
hard

Unit Test Generation

#testing #coding #quality-assurance

Write unit tests to validate edge cases for a specific function.

Write a comprehensive set of unit tests using a standard testing framework for the following function. Ensure to cover edge cases such as empty input, negative numbers, and null values: function calculateDiscount(price, discountPercentage) { if (!price || price < 0) return 0; return price - (price * (discountPercentage / 100)); }