Modular JavaScript validation framework for Granado Espada IPF tool implementations.
- Project Testing Strategy - Testing philosophy, types, and coverage
- Testing Framework Architecture - Technical architecture and implementation
This testing framework validates our open-source IPF tools against the original Windows tools (iz.exe, ez.exe, etc.) using hash-based comparison. The framework ensures 100% compatibility without distributing proprietary IPF files.
cd testing
npm installnpm testThis will:
- Extract all test IPF files (ai.ipf, item_texture.ipf, ui.ipf)
- Optimize ui.ipf and compare with reference
- Create IPF from extracted files and compare with reference
- Generate hashes from our output
- Compare with reference hashes from original tools
- Report validation results
# Run extraction tests only
npm run test:extraction
# Run optimization tests only
npm run test:optimization
# Run all tests (extraction + optimization)
npm test
# Generate reference hashes (requires original Windows tools)
npm run generate
# Generate reference hashes from original tool extractions
# Note: This saves hashes to test_hashes/tools/extraction/original_hashes.jsonThe testing framework uses a three-directory structure:
-
extraction/original_hashes.json: Reference hashes from original Windows tools (iz.exe + ez.exe)
- Generated by:
npm run generate - Source:
reference_original/directory - Purpose: Ground truth for validation
- Generated by:
-
extraction/our_hashes.json: Hashes from our Go IPF extractor
- Generated by:
npm test - Source:
reference_our/directory (temporary) - Purpose: Record our tool's output for regression testing
- Note: Hashes always preserved, extracted files cleaned unless
--keepflag used
- Generated by:
Future Scalability: As additional tools are implemented (conversion, addition), the structure will expand:
test_hashes/tools/
├── extraction/
│ ├── original_hashes.json
│ └── our_hashes.json
├── optimization/
│ ├── original_hashes.json
│ └── our_hashes.json
├── creation/
│ ├── original_hashes.json
│ └── our_hashes.json
└── conversion/
├── original_hashes.json
└── our_hashes.json
Contains extractions from original Windows tools:
small_original/- ai.ipf extracted by iz.exe + ez.exemedium_original/- item_texture.ipf extracted by iz.exe + ez.exelarge_original/- ui.ipf extracted by iz.exe + ez.exe
Purpose: Source of truth for validation. Regenerated only when re-running original tools.
Contains extractions from our Go IPF extractor:
small_our/- ai.ipf extracted by our toolmedium_our/- item_texture.ipf extracted by our toollarge_our/- ui.ipf extracted by our tool
Purpose: Temporary storage for validation. Files are cleaned up after test runs unless --keep flag is used. Hashes are always preserved in test_hashes/tools/extraction/our_hashes.json.
The framework validates against three test files:
| Name | Size | Files | Strategy |
|---|---|---|---|
| ai.ipf | 4.3K | 4 | Full hash |
| item_texture.ipf | 191MB | 3,063 | Sampling |
| ui.ipf | 877MB | 11,567 | Sampling |
For detailed hash strategy explanation, see Project Testing Strategy.
Generate reference hash databases (requires original Windows tools).
npm run generate [options]
Options:
--ipf-path, -i <path> Path to IPF files directory
--output-dir, -o <path> Output directory for hash databases
--verbose, -v Enable detailed output
--help, -h Show helpRun all tests (extraction + optimization).
npm test
# or
npm run test
Options:
--verbose, -v Enable detailed output
--keep Keep extracted/optimized files for debugging (otherwise cleaned up)
--help, -h Show help messageProcess:
- Extract all test IPF files using our Go tool
- Optimize ui.ipf and compare with reference
- Save hashes to
test_hashes/tools/extraction/our_hashes.jsonandtest_hashes/tools/optimization/our_hashes.json - Compare against reference hashes from original tools
- Clean up extracted files from
reference_our/(unless--keepflag used)
Run extraction validation test only.
npm run test:extraction [options]
Options:
--verbose, -v Enable detailed output
--keep Keep extracted files for debugging (otherwise cleaned up)
--help, -h Show help messageRun optimization validation test only.
npm run test:optimization [options]
Options:
--verbose, -v Enable detailed output
--quiet, -q Suppress console output
--help, -h Show help messageRun creation validation test only.
npm run test:creation [options]
Options:
--verbose, -v Enable detailed output
--keep Keep temp files for debugging
--help, -h Show help messageThe framework is designed for CI/CD integration:
# Run all tests (non-zero exit code on failure)
npm test
# Run extraction tests only
npm run test:extraction
# Run optimization tests only
npm run test:optimization
# Run creation tests only
npm run test:creationTo regenerate reference hashes:
- Ensure original Windows tools are available (iz.exe, ez.exe, oz.exe)
- Run the generate command:
npm run generate --verboseThis will:
- Run original tools on all test files
- Generate reference hash databases
- Save to
test_hashes/tools/extraction/original_hashes.jsonandtest_hashes/tools/optimization/original_hashes.json
- Add IPF file to
test_files/directory - Update
TEST_FILESconfiguration insrc/config.js - Generate reference hashes:
npm run generate - Validate:
npm test
Error: IPF file not found
Solution: Ensure the Go binary is built:
cd src/golang
go build -o build/ipf-extractor ./cmd/ipf-extractorError: EACCES: permission denied
Solution: Make binary executable:
chmod +x src/golang/build/ipf-extractorError: Command timed out
Solution: Increase timeout in src/config.js:
EXECUTION_TIMEOUT: 1200000, // 20 minutes✗ large: Hash mismatch
Solution: Verify:
- Go binary is latest version
- Reference hashes are up to date
- No file corruption in test files
MIT License - See LICENSE file for details.