Add some relevant tests for list_to_polynomial.

This commit is contained in:
Diogo Cordeiro 2018-11-24 16:24:42 +00:00
parent e2049d1ab6
commit 7a91e63e8b

View File

@ -641,6 +641,18 @@ list_to_polynomial([T], T).
%% Tests:
%% ?- list_to_polynomial([1, x, x^2], P).
%@ P = x^2+x+1.
%% ?- list_to_polynomial([-1, -x, -x^2], P).
%@ P = -x^2-x-1.
%% ?- list_to_polynomial([1, -x, x^2], P).
%@ P = x^2-x+1.
%% ?- list_to_polynomial([x^2, x, 1], P).
%@ P = 1+x+x^2.
%% ?- list_to_polynomial([a,-e], P).
%@ P = -e+a.
%% ?- list_to_polynomial([], P).
%@ false.
%% ?- list_to_polynomial([a], P).
%@ P = a.
%% negate_term(T, T2) is det
%
@ -696,6 +708,8 @@ scale_polynomial(P, C, S) :-
% Add an atom C to the head of a list L.
%
cons(C, L, [C | L]).
%% Tests:
%% It just trivially works.
%% add_polynomial(+P1:polynomial,+P2:polynomial,-S:polynomial) is det
%