From 13118fea92787076f8212d2e9fc0edffca9061ce Mon Sep 17 00:00:00 2001 From: Markus Pfeiffer Date: Wed, 13 Dec 2017 21:27:58 +0000 Subject: [PATCH] Add some tests for LcmInt --- tst/testinstall/intarith.tst | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tst/testinstall/intarith.tst b/tst/testinstall/intarith.tst index b1cb05d557..d2f7c41d96 100644 --- a/tst/testinstall/intarith.tst +++ b/tst/testinstall/intarith.tst @@ -444,6 +444,51 @@ gap> GcdInt(-2^60, -2^60); gap> GcdInt(-2^28, -2^28); 268435456 +# +# LcmInt +# +gap> List(dataNonZero, x -> LcmInt(bigNeg, x)); +[ 10000000000000000000100000000000000000000, 100000000000000000000, + 100000000000000000000, 100000000000000000000, 100000000000000000000, + 100000000000000000000, 100000000000000000000, + 10000000000000000000100000000000000000000 ] +gap> List(dataNonZero, x -> LcmInt(smlNeg, x)); +[ 1000000000000000000010000, 100000000000000000000, 10000, 10000, 10000, + 10000, 100000000000000000000, 1000000000000000000010000 ] +gap> List(dataNonZero, x -> LcmInt(smlPos, x)); +[ 1000000000000000000010000, 100000000000000000000, 10000, 10000, 10000, + 10000, 100000000000000000000, 1000000000000000000010000 ] +gap> List(dataNonZero, x -> LcmInt(bigPos, x)); +[ 10000000000000000000100000000000000000000, 100000000000000000000, + 100000000000000000000, 100000000000000000000, 100000000000000000000, + 100000000000000000000, 100000000000000000000, + 10000000000000000000100000000000000000000 ] + +# +gap> g:=3^10*257;; a:=g*991;; b:=g*1601;; +gap> LcmInt(2^20*a, 2^30*b) = 2^30*3^10*257*991*1601; +true +gap> LcmInt(2^80*a, 2^40*b) = 2^80*3^10*257*991*1601; +true +gap> LcmInt(2^80*a, 2^90*b) = 2^90*3^10*257*991*1601; +true + +# check symmetry +gap> ForAll(data, x -> ForAll(data, y -> LcmInt(x,y) = LcmInt(y,x))); +true + +# +gap> LcmInt(fail,1); +Error, LcmInt: must be an integer (not a boolean or fail) +gap> LcmInt(1,fail); +Error, LcmInt: must be an integer (not a boolean or fail) + +# corner cases +gap> LcmInt(-2^60, -2^60); +1152921504606846976 +gap> LcmInt(-2^28, -2^28); +268435456 + # # AInvInt #