From 24360e11b0c62654ab58fa72c53904f1140b740d Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Thu, 25 Mar 2004 21:46:35 +0000 Subject: [PATCH] 2004-03-26 Eric Hanchrow * tests/numbers.test (modulo-expt): New tests. --- test-suite/tests/numbers.test | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/test-suite/tests/numbers.test b/test-suite/tests/numbers.test index 5b49d0370..ab70a590a 100644 --- a/test-suite/tests/numbers.test +++ b/test-suite/tests/numbers.test @@ -767,6 +767,46 @@ ) +;;; +;;; modulo-expt +;;; + +(with-test-prefix "modulo-expt" + (pass-if (= 1 (modulo-expt 17 23 47))) + + (pass-if (= 1 (modulo-expt 17 -23 47))) + + (pass-if (= 17 (modulo-expt 17 -22 47))) + + (pass-if (= 36 (modulo-expt 17 22 47))) + + (pass-if (= 183658794479969134816674175082294846241553725240 (modulo-expt 111122223333444455556666 111122223333444455556666 1153478690012629968439432872520758982731022934717))) + + (pass-if-exception + "Proper exception with 0 modulus" + (cons 'numerical-overflow "") + (modulo-expt 17 23 0)) + + (pass-if-exception + "Proper exception when result not invertible" + (cons 'numerical-overflow "") + (modulo-expt 10 -1 48)) + + (pass-if-exception + "Proper exception with wrong type argument" + (cons 'wrong-type-arg "") + (modulo-expt "Sam" 23 10)) + + (pass-if-exception + "Proper exception with wrong type argument" + (cons 'wrong-type-arg "") + (modulo-expt 17 9.9 10)) + + (pass-if-exception + "Proper exception with wrong type argument" + (cons 'wrong-type-arg "") + (modulo-expt 17 23 'Ethel))) + ;;; ;;; gcd ;;;