mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-23 13:00:34 +02:00
2004-03-26 Eric Hanchrow <offby1@blarg.net>
* tests/numbers.test (modulo-expt): New tests.
This commit is contained in:
parent
23d77957a4
commit
24360e11b0
1 changed files with 40 additions and 0 deletions
|
@ -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
|
||||
;;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue