CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-crosshair-tool

Analyze Python code for correctness using symbolic execution and SMT solving to automatically find counterexamples for functions with type annotations and contracts.

86

1.24x
Overview
Eval results
Files

task.mdevals/scenario-5/

Function Behavior Comparator

Build a tool that compares two Python function implementations to find inputs where they behave differently.

Capabilities

Detect return value differences

  • Given two functions with different arithmetic logic, find an input where return values differ @test
  • Given two string processing functions with different logic, discover an input string that produces different outputs @test

Detect exception differences

  • Given two functions where one raises an exception and the other doesn't, find the input that triggers this difference @test

Report discovered differences

  • When a difference is found, the result includes the input arguments that caused the difference @test
  • When no difference is found within the timeout, return a result indicating this @test

Implementation

@generates

API

def compare_functions(func1, func2, timeout=5.0):
    """
    Compare two functions to find inputs where they behave differently.

    Args:
        func1: First function to compare
        func2: Second function to compare
        timeout: Maximum time in seconds to search for differences

    Returns:
        dict with keys:
            - 'found': bool, True if a difference was discovered
            - 'input': dict mapping argument names to values (present if found=True)
            - 'difference_type': str, one of 'return_value' or 'exception' (present if found=True)

    Example:
        result = compare_functions(version1, version2, timeout=10.0)
        if result['found']:
            print(f"Functions differ on input: {result['input']}")
    """
    pass

Dependencies { .dependencies }

crosshair-tool { .dependency }

Provides symbolic execution and behavioral difference detection capabilities.

Install with Tessl CLI

npx tessl i tessl/pypi-crosshair-tool

tile.json