Skip to content

Add comprehensive test cases for cuddSolve.c#89

Merged
doganulus merged 3 commits into4.0.0from
copilot/add-test-cases-cuddsolve
Dec 1, 2025
Merged

Add comprehensive test cases for cuddSolve.c#89
doganulus merged 3 commits into4.0.0from
copilot/add-test-cases-cuddsolve

Conversation

Copy link
Copy Markdown

Copilot AI commented Nov 30, 2025

Adds test coverage for the boolean equation solver module (cuddSolve.c), which was previously at 0% coverage.

Changes

  • Basic equation solving: Tests for XOR, AND, OR operations with single and multiple unknowns
  • Constant equations: F=0 (always satisfiable) and F=1 (never satisfiable) cases
  • Edge cases: Y=1 (no unknowns), ITE structures, complemented edges
  • Solution verification: Correct solutions, incorrect solutions, constant solutions, multiple substitutions
  • Stress tests: Large number of unknowns (10+), complex multi-level equations

Coverage

  • Achieved: 68% line coverage (65/95 lines), 100% function coverage
  • Uncovered: 30 lines of error-handling branches (NULL returns from internal CUDD functions, memory allocation failures, timeout handlers) - these require mocking or special infrastructure to trigger

Example Test

SECTION("Solve simple equation x XOR y = 0") {
    DdNode *x = Cudd_bddNewVar(manager);
    DdNode *y = Cudd_bddNewVar(manager);
    Cudd_Ref(x);
    Cudd_Ref(y);
    
    DdNode *F = Cudd_bddXor(manager, x, y);
    DdNode **G = (DdNode **)malloc(sizeof(DdNode *) * 1);
    int *yIndex = nullptr;
    
    DdNode *consistency = Cudd_SolveEqn(manager, F, Y, G, &yIndex, 1);
    DdNode *verification = Cudd_VerifySol(manager, F, G, yIndex, 1);
    // Solution substituted back into F should yield 0
}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Complete test cases for src/cuddSolve.c and target 90% coverage for the source file.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits November 30, 2025 18:17
Co-authored-by: doganulus <1174212+doganulus@users.noreply.github.com>
Co-authored-by: doganulus <1174212+doganulus@users.noreply.github.com>
Copilot AI changed the title [WIP] Complete test cases for src/cuddSolve.c with 90% coverage Add comprehensive test cases for cuddSolve.c Nov 30, 2025
Copilot AI requested a review from doganulus November 30, 2025 18:27
@doganulus doganulus marked this pull request as ready for review December 1, 2025 05:16
@doganulus doganulus merged commit 956a107 into 4.0.0 Dec 1, 2025
37 of 74 checks passed
@doganulus doganulus deleted the copilot/add-test-cases-cuddsolve branch December 5, 2025 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants