Skip to content

Commit

Permalink
Add some tests for LcmInt
Browse files Browse the repository at this point in the history
  • Loading branch information
markuspf authored and ChrisJefferson committed Dec 17, 2017
1 parent 02f1dac commit 531edb4
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions tst/testinstall/intarith.tst
Original file line number Diff line number Diff line change
Expand Up @@ -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: <left> must be an integer (not a boolean or fail)
gap> LcmInt(1,fail);
Error, LcmInt: <right> 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
#
Expand Down

0 comments on commit 531edb4

Please sign in to comment.