1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    2% Tests for unification operators
    3
    4%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    5
    6
    7%
    8% List of test suites
    9%
   10
   11test_suites([test_unif, test_notunif]).
   12
   13
   14%
   15% =/2 test
   16% - ISO -
   17%
   18
   19test_unif_1 :- '='(1, 1).
   20test_unif_2(X) :- '='(X, 1).
   21test_unif_3(X, Y) :- '='(X, Y).
   22test_unif_4 :- '='(_, _).
   23test_unif_5(X, Y) :- '='(X, Y), '='(X, abc).
   24test_unif_6(X, Y) :- '='(f(X, def), f(def, Y)).
   25test_unif_7 :- '='(1, 2).
   26test_unif_8 :- '='(1, 1.0).
   27test_unif_9(X) :- '='(g(X), f(f(X))).
   28test_unif_10(X) :- '='(f(X, 1), f(a(X))).
   29test_unif_11(X, Y) :- '='(f(X, Y, X), f(a(X), a(Y), Y, 2)).
   30test_unif_12(X) :- '='(X, a(X)). % Undefined behavior
   31test_unif_13(X) :- '='(f(X, 1), f(a(X), 2)). % Undefined behavior
   32test_unif_14(X) :- '='(f(1, X, 1), f(2, a(X), 2)). % Undefined behavior
   33test_unif_15(X) :- '='(f(1, X), f(2, a(X))). % Undefined behavior
   34test_unif_16(X, Y) :- '='(f(X, Y, X, 1), f(a(X), a(Y), Y, 2)). % Undefined behavior
   35
   36test_unif_1b :- 1 = 1.
   37test_unif_2b(X) :- X = 1.
   38test_unif_3b(X, Y) :- X = Y.
   39test_unif_4b :- _ = _.
   40test_unif_5b(X, Y) :- X = Y, X = abc.
   41test_unif_6b(X, Y) :- f(X, def) = f(def, Y).
   42test_unif_7b :- 1 = 2.
   43test_unif_8b :- 1 = 1.0.
   44test_unif_9b(X) :- g(X) = f(f(X)).
   45test_unif_10b(X) :- f(X, 1) = f(a(X)).
   46test_unif_11b(X, Y) :- f(X, Y, X) = f(a(X), a(Y), Y, 2).
   47test_unif_12b(X) :- X = a(X). % Undefined behavior
   48test_unif_13b(X) :- f(X, 1) = f(a(X), 2). % Undefined behavior
   49test_unif_14b(X) :- f(1, X, 1) = f(2, a(X), 2). % Undefined behavior
   50test_unif_15b(X) :- f(1, X) = f(2, a(X)). % Undefined behavior
   51test_unif_16b(X, Y) :- f(X, Y, X, 1) = f(a(X), a(Y), Y, 2). % Undefined behavior
   52
   53
   54%
   55% \=/2 test
   56% - ISO -
   57%
   58
   59test_notunif_1 :- '\\='(1, 1).
   60test_notunif_2(X) :- '\\='(X, 1).
   61test_notunif_3(X, Y) :- '\\='(X, Y).
   62test_notunif_4 :- '\\='(_, _).
   63test_notunif_5(X, Y) :- '\\='(X, Y), '\\='(X, abc).
   64test_notunif_6(X, Y) :- '\\='(f(X, def), f(def, Y)).
   65test_notunif_7 :- '\\='(1, 2).
   66test_notunif_8 :- '\\='(1, 1.0).
   67test_notunif_9(X) :- '\\='(g(X), f(f(X))).
   68test_notunif_10(X) :- '\\='(f(X, 1), f(a(X))).
   69test_notunif_11(X, Y) :- '\\='(f(X, Y, X), f(a(X), a(Y), Y, 2)).
   70test_notunif_12(X) :- '\\='(X, a(X)). % Undefined behavior
   71test_notunif_13(X) :- '\\='(f(X, 1), f(a(X), 2)). % Undefined behavior
   72test_notunif_14(X) :- '\\='(f(1, X, 1), f(2, a(X), 2)). % Undefined behavior
   73test_notunif_15(X) :- '\\='(f(1, X), f(2, a(X))). % Undefined behavior
   74test_notunif_16(X, Y) :- '\\='(f(X, Y, X, 1), f(a(X), a(Y), Y, 2)). % Undefined behavior
   75
   76test_notunif_1b :- 1 \= 1.
   77test_notunif_2b(X) :- X \= 1.
   78test_notunif_3b(X, Y) :- X \= Y.
   79test_notunif_4b :- _ \= _.
   80test_notunif_5b(X, Y) :- X \= Y, X \= abc.
   81test_notunif_6b(X, Y) :- f(X, def) \= f(def, Y).
   82test_notunif_7b :- 1 \= 2.
   83test_notunif_8b :- 1 \= 1.0.
   84test_notunif_9b(X) :- g(X) \= f(f(X)).
   85test_notunif_10b(X) :- f(X, 1) \= f(a(X)).
   86test_notunif_11b(X, Y) :- f(X, Y, X) \= f(a(X), a(Y), Y, 2).
   87test_notunif_12b(X) :- X \= a(X). % Undefined behavior
   88test_notunif_13b(X) :- f(X, 1) \= f(a(X), 2). % Undefined behavior
   89test_notunif_14b(X) :- f(1, X, 1) \= f(2, a(X), 2). % Undefined behavior
   90test_notunif_15b(X) :- f(1, X) \= f(2, a(X)). % Undefined behavior
   91test_notunif_16b(X, Y) :- f(X, Y, X, 1) \= f(a(X), a(Y), Y, 2). % Undefined behavior