Commit 9ca8078
committed
test: Add comprehensive tests for existing util functions
## Test Coverage Improvements
### Coverage Increase
- Overall command package coverage: 22.6% → 35.1% (+55%)
- All util.go functions now have 95-100% coverage
### New Tests Added
- **TestParseCidr**: IPv4/IPv6 CIDR expansion with edge cases
- **TestIpInc**: IP address increment functionality
- **TestFile2hostnames**: File parsing with comments, URLs, protocols
- **TestParseHostnames**: Integration testing of all parsing steps
- **TestParseHostnamesIntegration**: End-to-end workflow testing
### Test Features
- Comprehensive edge case coverage
- Temporary file handling for file-based tests
- IPv4 and IPv6 CIDR notation testing
- Comment parsing and URL preservation
- Protocol prefix support validation
- Error handling for invalid inputs
- Integration testing of bracket + CIDR expansion
### Quality Assurance
- All 75+ test cases passing
- Zero-padding validation
- Character range testing (a-z, A-Z)
- File I/O error handling
- Mixed valid/invalid input scenarios
This brings the util functions from 0% to near-perfect test coverage,
ensuring reliability for the bracket expansion feature and existing
network target processing functionality.1 parent 36d604a commit 9ca8078
3 files changed
Lines changed: 1109 additions & 0 deletions
0 commit comments