@@ -260,6 +260,8 @@ func TestRandomBinOp(t *testing.T) {
260260 t .Run ("Mod" , func (t * testing.T ) { testRandomOp (t , (* Int ).Mod , bigMod ) })
261261 t .Run ("SDiv" , func (t * testing.T ) { testRandomOp (t , (* Int ).SDiv , bigSDiv ) })
262262 t .Run ("SMod" , func (t * testing.T ) { testRandomOp (t , (* Int ).SMod , bigSMod ) })
263+ t .Run ("DivMod/Div" , func (t * testing.T ) { testRandomOp (t , divModDiv , bigDiv ) })
264+ t .Run ("DivMod/Mod" , func (t * testing.T ) { testRandomOp (t , divModMod , bigMod ) })
263265 t .Run ("udivrem/Div" , func (t * testing.T ) { testRandomOp (t , udivremDiv , bigDiv ) })
264266 t .Run ("udivrem/Mod" , func (t * testing.T ) { testRandomOp (t , udivremMod , bigMod ) })
265267}
@@ -298,6 +300,19 @@ func TestRandomSquare(t *testing.T) {
298300 )
299301}
300302
303+ // divModDiv wraps DivMod and returns quotient only
304+ func divModDiv (z , x , y * Int ) * Int {
305+ var m Int
306+ z .DivMod (x , y , & m )
307+ return z
308+ }
309+
310+ // divModMod wraps DivMod and returns modulus only
311+ func divModMod (z , x , y * Int ) * Int {
312+ new (Int ).DivMod (x , y , z )
313+ return z
314+ }
315+
301316// udivremDiv wraps udivrem and returns quotient
302317func udivremDiv (z , x , y * Int ) * Int {
303318 var quot Int
@@ -1243,6 +1258,8 @@ func TestBinOp(t *testing.T) {
12431258 t .Run ("Mod" , func (t * testing.T ) { proc (t , (* Int ).Mod , bigMod ) })
12441259 t .Run ("SDiv" , func (t * testing.T ) { proc (t , (* Int ).SDiv , bigSDiv ) })
12451260 t .Run ("SMod" , func (t * testing.T ) { proc (t , (* Int ).SMod , bigSMod ) })
1261+ t .Run ("DivMod/Div" , func (t * testing.T ) { proc (t , divModDiv , bigDiv ) })
1262+ t .Run ("DivMod/Mod" , func (t * testing.T ) { proc (t , divModMod , bigMod ) })
12461263 t .Run ("udivrem/Div" , func (t * testing.T ) { proc (t , udivremDiv , bigDiv ) })
12471264 t .Run ("udivrem/Mod" , func (t * testing.T ) { proc (t , udivremMod , bigMod ) })
12481265 t .Run ("Exp" , func (t * testing.T ) { proc (t , (* Int ).Exp , bigExp ) })
0 commit comments