From 7a91e63e8b6d8538f743ddb058746b94b9272d81 Mon Sep 17 00:00:00 2001 From: Diogo Cordeiro Date: Sat, 24 Nov 2018 16:24:42 +0000 Subject: [PATCH] Add some relevant tests for list_to_polynomial. --- polymani.pl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/polymani.pl b/polymani.pl index 858bb24..6a78207 100644 --- a/polymani.pl +++ b/polymani.pl @@ -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 %