Skip to content

IntIsOdd

Description

Test whether the integer’s value is odd.

Parameters

Name Direction Description
value in Integer to inspect.

Success

Returns true when the integer is odd.

Failure

Returns false when the integer is even (including zero).

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    bool IntIsOdd(const Int *value) {
        return int_is_odd(value);
    }
        // 10 implies even), so the strip loop below would do nothing - skip it and
        // its divisor/quotient allocations entirely.
        if (IntIsOdd(&value->significand)) {
            return;
        }
    // Real code returns false cleanly; the mutant crashes -> distinguishable.
    bool test_m27_is_odd_zero_no_abort(void) {
        WriteFmt("Testing IntIsOdd(0) returns false without aborting\n");
    
        DefaultAllocator alloc = DefaultAllocatorInit();
        Int zero = IntInit(&alloc.base);
    
        bool result = (IntIsOdd(&zero) == false);
    
        IntDeinit(&zero);
    
        bool result = IntIsEven(&even);
        result      = result && !IntIsOdd(&even);
        result      = result && IntIsOdd(&odd);
        result      = result && !IntIsEven(&odd);
        bool result = IntIsEven(&even);
        result      = result && !IntIsOdd(&even);
        result      = result && IntIsOdd(&odd);
        result      = result && !IntIsEven(&odd);
Last updated on