# Copyright 2001 Dave Abrahams 
# Distributed under the Boost Software License, Version 1.0. 
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 

# Evaluates [ rulename arg1... : arg2... : ... : argN... ] and compares the
# result to expected-results. If there is a mismatch, prints an error message
# and exits.
rule assert-equal ( expected-results *
    : rulename a1 * :  a2 * : a3 * : a4 * : a5 * : a6 * : a7 * : a8 * : a9 * )
{

    local results = [ $(rulename) $(a1) : $(a2) : $(a3)
                        : $(a4) : $(a5) : $(a6) : $(a7) : $(a8) ] ;
                      
    if $(results) != $(expected-results)
    {
        EXIT ******ASSERTION FAILURE******* "
    [ $(rulename) " $(a1)
        ": "$(a2[1]) $(a2[2-])
        ": "$(a3[1]) $(a3[2-])
        ": "$(a4[1]) $(a4[2-])
        ": "$(a5[1]) $(a5[2-])
        ": "$(a6[1]) $(a6[2-])
        ": "$(a7[1]) $(a7[2-])
        ": "$(a8[1]) $(a8[2-]) "]
expected:
    (" $(expected-results) ")
result was:
    (" $(results) ")"
       ;
    
    }
}
