Skip to content

Add comprehensive tests for cuddSign.c achieving 86.5% coverage#83

Merged
doganulus merged 3 commits into4.0.0from
copilot/add-test-cases-for-cuddsign
Nov 30, 2025
Merged

Add comprehensive tests for cuddSign.c achieving 86.5% coverage#83
doganulus merged 3 commits into4.0.0from
copilot/add-test-cases-for-cuddsign

Conversation

Copy link
Copy Markdown

Copilot AI commented Nov 30, 2025

Added test cases for Cudd_CofMinterm function in src/cuddSign.c targeting 90% coverage. Achieved 86.5% line coverage (64/74 lines) and 100% function coverage.

Test Coverage

  • Constant functions: DD_ONE, DD_ZERO with single variable
  • Variable combinations: Single, two, and multi-variable (3-8 vars) functions
  • Boolean operations: AND, OR, XOR compositions
  • BDD structures: Complemented edges, shared nodes (ref > 1), ref=1 cleanup paths
  • Edge cases: Skipped variable levels, ITE functions, ADD constants
  • Recursion paths: Loop coverage in ddCofMintermAux, cache insertion paths

Uncovered Lines (13.5%)

The remaining 10 lines are memory allocation failure handlers:

  • st_init_table failure (lines 119, 121-122)
  • ALLOC failures (lines 142, 225-226)
  • st_add_direct OOM (lines 276-277)

These require memory mocking infrastructure to test.

Example Test

TEST_CASE("Cudd_CofMinterm - Two variables", "[cuddSign]") {
    DdManager *manager = Cudd_Init(0, 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0);
    DdNode *x = Cudd_bddNewVar(manager);
    DdNode *y = Cudd_bddNewVar(manager);
    Cudd_Ref(x); Cudd_Ref(y);

    DdNode *f = Cudd_bddAnd(manager, x, y);
    Cudd_Ref(f);

    double *result = Cudd_CofMinterm(manager, f);
    REQUIRE(result[Cudd_ReadSize(manager)] == Catch::Approx(0.25)); // 1/4 minterms

    FREE(result);
    // cleanup...
}

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/cuddSign.c and target 90% coverage for the source file.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 30, 2025 07:43
Co-authored-by: doganulus <1174212+doganulus@users.noreply.github.com>
…ents

Co-authored-by: doganulus <1174212+doganulus@users.noreply.github.com>
Copilot AI changed the title [WIP] Add test cases for src/cuddSign.c to achieve 90% coverage Add comprehensive tests for cuddSign.c achieving 86.5% coverage Nov 30, 2025
Copilot AI requested a review from doganulus November 30, 2025 07:52
@doganulus doganulus marked this pull request as ready for review November 30, 2025 11:19
@doganulus doganulus merged commit 1e19f70 into 4.0.0 Nov 30, 2025
37 of 74 checks passed
@doganulus doganulus deleted the copilot/add-test-cases-for-cuddsign branch November 30, 2025 19:39
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