/* Test askinteger and asksign -- these are interactive,
 * therefore this script SHOULD NOT be included in testsuite_files.
 *
 * You can run this script via batch("tests/rtest_ask.mac", test);
 * and respond as indicated by the messages.
 * The appropriate inputs are also contained in tests/rtest_ask_input.mac
 * and therefore you can run all tests automatically like this:
 *
 * maxima --batch-string='batch("tests/rtest_ask.mac", test);' < tests/rtest_ask_input.mac
 */

(kill(all),0);
0$

/* commit 3137b946 tried to fix *LOCAL-SIGNS* craziness,
 * but screwed up in its own way. Fixed for good this time?
 * Nicked from mailing list circa 2013-08-28
 */
block (print ("Please enter 'p;' now:"), 0);
0;

integrate(sin(omega*t)*exp(-s*t),t,0,inf);
omega/(s^2+omega^2);

block (print ("Please enter 'p;' now:"), 0);
0;

[asksign (foo), sign (foo), sign (foo)];
[pos, pos, pos];

block (print ("Please enter 'n;' now:"), 0);
0;

[asksign (foo), sign (foo), sign (foo)];
[neg, neg, neg];

block (print ("Please enter 'z;' now:"), 0);
0;

[asksign (foo), sign (foo), sign (foo)];
[zero, zero, zero];

block (print ("Please enter 'p;' now:"), 0);
0;

limit((exp(a*x)-1)/(exp(a*x)+1),x,inf);
1;

block (print ("Please enter 'n;' now:"), 0);
0;

limit((exp(a*x)-1)/(exp(a*x)+1),x,inf);
-1;

block (print ("Please enter 'z;' now:"), 0);
0;

limit((exp(a*x)-1)/(exp(a*x)+1),x,inf);
0;

/* mailing list 2017-11-25: "bug in Laplace transform"
 * root cause is asksign(-a^2) forgot the minus sign,
 * so include some cases to handle that and then the Laplace transform.
 */

(print ("Please enter 'z;' now:"), 0);
0;
asksign (a^2);
zero;

(print ("Please enter 'nz;' now:"), 0);
0;
asksign (a^2);
pos;

(print ("Please enter 'p;' now:"), 0);
0;
asksign (a^3);
pos;

(print ("Please enter 'n;' now:"), 0);
0;
asksign (a^3);
neg;

(print ("Please enter 'z;' now:"), 0);
0;
asksign (a^3);
zero;

(print ("Please enter 'z;' now:"), 0);
0;
asksign (-a^2);
zero;

(print ("Please enter 'nz;' now:"), 0);
0;
asksign (-a^2);
neg;

(print ("Please enter 'p;' now:"), 0);
0;
asksign (-a^3);
neg;

(print ("Please enter 'n;' now:"), 0);
0;
asksign (-a^3);
pos;

(print ("Please enter 'z;' now:"), 0);
0;
asksign (-a^3);
zero;

(print ("Please enter 'z;' now:"), 0);
0;
asksign (a^4);
zero;

(print ("Please enter 'nz;' now:"), 0);
0;
asksign (a^4);
pos;

(print ("Please enter 'p;' now:"), 0);
0;
asksign (a^5);
pos;

(print ("Please enter 'n;' now:"), 0);
0;
asksign (a^5);
neg;

(print ("Please enter 'z;' now:"), 0);
0;
asksign (a^5);
zero;

(print ("Please enter 'z;' now:"), 0);
0;
asksign (-a^4);
zero;

(print ("Please enter 'nz;' now:"), 0);
0;
asksign (-a^4);
neg;

(print ("Please enter 'p;' now:"), 0);
0;
asksign (-a^5);
neg;

(print ("Please enter 'n;' now:"), 0);
0;
asksign (-a^5);
pos;

(print ("Please enter 'z;' now:"), 0);
0;
asksign (-a^5);
zero;

(print ("Please enter 'p;' now:"), 0);
0;
asksign (a*b^2);
pos;

(print ("Please enter 'n;' now:"), 0);
0;
asksign (a*b^2);
neg;

(print ("Please enter 'z;' now:"), 0);
0;
asksign (a*b^2);
zero;

(print ("Please enter 'p;' now:"), 0);
0;
asksign (a*b^3);
pos;

(print ("Please enter 'n;' now:"), 0);
0;
asksign (a*b^3);
neg;

(print ("Please enter 'z;' now:"), 0);
0;
asksign (a*b^3);
zero;

(print ("Please enter 'p;' now:"), 0);
0;
asksign (-a*b^2);
neg;

(print ("Please enter 'n;' now:"), 0);
0;
asksign (-a*b^2);
pos;

(print ("Please enter 'z;' now:"), 0);
0;
asksign (-a*b^2);
zero;

(print ("Please enter 'p;' now:"), 0);
0;
asksign (-a*b^3);
neg;

(print ("Please enter 'n;' now:"), 0);
0;
asksign (-a*b^3);
pos;

(print ("Please enter 'z;' now:"), 0);
0;
asksign (-a*b^3);
zero;

(print ("Please enter 'p;' now:"), 0);
0;
asksign (a*b^4);
pos;

(print ("Please enter 'n;' now:"), 0);
0;
asksign (a*b^4);
neg;

(print ("Please enter 'z;' now:"), 0);
0;
asksign (a*b^4);
zero;

(print ("Please enter 'p;' now:"), 0);
0;
asksign (-a*b^4);
neg;

(print ("Please enter 'n;' now:"), 0);
0;
asksign (-a*b^4);
pos;

(print ("Please enter 'z;' now:"), 0);
0;
asksign (-a*b^4);
zero;

(print ("Please enter 'z;' now:"), 0);
0;
asksign (a^2*b^2);
zero;

(print ("Please enter 'nz;' now:"), 0);
0;
asksign (a^2*b^2);
pos;

(print ("Please enter 'p;' now:"), 0);
0;
asksign (a^2*b^3);
pos;

(print ("Please enter 'n;' now:"), 0);
0;
asksign (a^2*b^3);
neg;

(print ("Please enter 'z;' now:"), 0);
0;
asksign (a^2*b^3);
zero;

(print ("Please enter 'z;' now:"), 0);
0;
asksign (-a^2*b^2);
zero;

(print ("Please enter 'nz;' now:"), 0);
0;
asksign (-a^2*b^2);
neg;

(print ("Please enter 'p;' now:"), 0);
0;
asksign (-a^2*b^3);
neg;

(print ("Please enter 'n;' now:"), 0);
0;
asksign (-a^2*b^3);
pos;

(print ("Please enter 'z;' now:"), 0);
0;
asksign (-a^2*b^3);
zero;

(print ("Please enter 'z;' now:"), 0);
0;
asksign (a^2*b^4);
zero;

(print ("Please enter 'nz;' now:"), 0);
0;
asksign (a^2*b^4);
pos;

(print ("Please enter 'p;' now:"), 0);
0;
asksign (a^2*b^5);
pos;

(print ("Please enter 'n;' now:"), 0);
0;
asksign (a^2*b^5);
neg;

(print ("Please enter 'z;' now:"), 0);
0;
asksign (a^2*b^5);
zero;

(print ("Please enter 'z;' now:"), 0);
0;
asksign (-a^2*b^4);
zero;

(print ("Please enter 'nz;' now:"), 0);
0;
asksign (-a^2*b^4);
neg;

(print ("Please enter 'p;' now:"), 0);
0;
asksign (-a^2*b^5);
neg;

(print ("Please enter 'n;' now:"), 0);
0;
asksign (-a^2*b^5);
pos;

(print ("Please enter 'z;' now:"), 0);
0;
asksign (-a^2*b^5);
zero;

/* here's the Laplace transform that exposed the bug */

(print ("Please enter 'z;' now:"), 0);
0;
laplace (delta (t - x^2), t, s);
1;

(print ("Please enter 'nz;' now:"), 0);
0;
laplace (delta (t - x^2), t, s);
exp(-s*x^2);
