1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    2% Tests for exception handling predicates
    3
    4%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    5
    6
    7%
    8% List of test suites
    9%
   10
   11test_suites([test_throw]).
   12
   13
   14%
   15% throw/1 and catch/3 tests
   16% - ISO -
   17%
   18
   19db_throw_foo(X) :- Y is X * 2, throw(test(Y)).
   20db_throw_bar(X) :- X = Y, throw(Y).
   21db_throw_coo(X) :- throw(X).
   22db_throw_car(X) :- X = 1, throw(X).
   23
   24test_throw_1(Y) :- catch(db_throw_foo(5), test(Y), true).
   25test_throw_2(Z) :- catch(db_throw_bar(3), Z, true).
   26test_throw_3(C) :- catch(true, C, write(demoen)), throw(bla).
   27test_throw_4(X, Y) :- catch(db_throw_coo(X), Y, true).
   28test_throw_5(X, Y) :- catch(db_throw_car(X), Y, true).
   29
   30throws_exception(test_throw_3)