Skip to content
Snippets Groups Projects
max-test-tout-en-un.cpp 448 B
Newer Older
Nicolas M. Thiéry's avatar
Nicolas M. Thiéry committed
#include <iostream>
using namespace std;

/** Infrastructure minimale de test **/
#define CHECK(test) if (!(test)) cerr << "Test failed in file " << __FILE__ << " line " << __LINE__ << ": " #test << endl

int monMax(int a, int b) {
    if ( a >= b )
        return a;
    else
        return b;
}

void monMaxTest() {
    CHECK( monMax(2,3) == 3 );
    CHECK( monMax(5,2) == 5 );
    CHECK( monMax(1,1) == 1 );
}

int main() {
    monMaxTest();
}