/*
 * @topic T00290 The <tt>assert()</tt> for proactive debugging
 * @brief Program demonstrates the use of <tt>assert()</tt>
*/

// Uncomment the following line to disable asserts
//#define NDEBUG
#include <cassert>
#include <iostream>

int main()
{
    int sd = 99999999;

    // this assert will fail:
    assert( sd == 12345678 );

    sd = 12345678;
    // this assert will succeed:
    assert( sd == 12345678 );

    // Do not wrap function calls in asserts:
    // if function modifies some data, all of it is
    // lost if asserts are disabled by NDEBUG.

    // *** INCORRECT ***
    assert( result = validate( sd ) );

    // Correct:
    bool result = validate( sd );
    assert( result == true );

    return 0;
}