Skip to content

feature request: UNSIGNED_LONGS_WITHIN #1883

@mtfurlan

Description

@mtfurlan

On a few occasions I've written functions like:

void assert_within(uint16_t expected, uint16_t actual, uint16_t tolerance, const char* text)
{
    char buf[64];
    if(abs(expected-actual) > tolerance) {
        snprintf(buf, ARRAY_SIZE(buf), "%s outside tolerance, expected within %d of %d, got %d", text, tolerance, expected, actual);
        FAIL_TEXT_C(buf);
    }
}

It would be nice for within, or less/greater than to be native cpputest assertions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions