Skip to content

IntIsOne

Description

Test whether the integer equals one.

Parameters

Name Direction Description
value in Integer to inspect.

Success

Returns true when the integer equals one.

Failure

Returns false otherwise.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    bool IntIsOne(const Int *value) {
        return int_is_one(value);
    }
    // Real code returns true; the mutant returns false -> distinguishable.
    bool test_m27_is_one_of_one(void) {
        WriteFmt("Testing IntIsOne(1) returns true\n");
    
        DefaultAllocator alloc = DefaultAllocatorInit();
        Int one = IntFrom(1, &alloc.base);
    
        bool result = (IntIsOne(&one) == true);
    
        IntDeinit(&one);
    
    bool test_int_is_one(void) {
        WriteFmt("Testing IntIsOne\n");
    
        DefaultAllocator alloc = DefaultAllocatorInit();
        Int two = IntFrom(2, &alloc.base);
    
        bool result = IntIsOne(&one);
        result      = result && !IntIsOne(&two);
    
        bool result = IntIsOne(&one);
        result      = result && !IntIsOne(&two);
    
        IntDeinit(&one);
Last updated on