Bug #135

custom user ASSERT issues

Added by Lukas Felber almost 4 years ago.

Status:NewStart date:06 Nov 2013
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

void testFoo() {
    ASSERT_EQUALS_POSITIVE(-1,2);
}

void ASSERT_EQUALS_POSITIVE(int expected, int actual) {
    ASSERT(actual >= 0);
    ASSERT_EQUAL(expected, actual);
}
* no preposition at all (would be nice to have preposition to add testFoo
struct MyTest {
    MyTest(int actual) : actual(actual) {
    }
    void operator() () {
        ASSERT_BETWEN_0_AND_100();
    }
    void ASSERT_BETWEN_0_AND_100() {
        ASSERT_GREATER_EQUAL(0, actual);
        ASSERT_LESS_EQUAL(100, actual);
    }
    int actual;
};
* Preposition to add my custom macro function instead of testFoo ** At least if testFoo is already registered, adding ASSERT_EQUALS_POSITIVE should be omitted.
void testFoo() {
    ASSERT_EQUALS_POSITIVE<-1,2>();
}

template<int expected, int actual>
void ASSERT_EQUALS_POSITIVE() {
    ASSERT(actual >= 0);
    ASSERT_EQUAL(expected, actual);
}
* same as above

Also available in: Atom PDF