What is CrossHair
mainCrossHair is an analysis tool for Python that blurs the line between testing and type systems. It works by repeatedly calling functions with symbolic inputs, using an SMT solver (a theorem prover) to explore execution paths and find counterexamples to your code's logic.
Key capabilities include:
- Contract Verification: Automatically finding counterexamples for functions that have type annotations and defined contracts.
- Unit Test Generation: Using the
coverfeature to generate unit tests. - Behavioral Comparison: Using
diffbehaviorto find differences in behavior between two functions. - Symbolic Reasoning: Supports built-in types, user-defined classes, and much of the Python standard library.
- Hypothesis Integration: Can be used as an optional backend for the Hypothesis property-based testing tool.