@@ -747,11 +747,12 @@ func TestMODMUL(t *testing.T) {
747747func TestMODPOW (t * testing.T ) {
748748 prog := makeProgram (opcode .MODPOW )
749749 t .Run ("good, positive base" , getTestFuncForVM (prog , 1 , 3 , 4 , 5 ))
750- t .Run ("good, negative base" , getTestFuncForVM (prog , 2 , - 3 , 5 , 5 ))
750+ t .Run ("good, negative base" , getTestFuncForVM (prog , - 3 , - 3 , 5 , 5 ))
751751 t .Run ("good, positive base, negative mod" , getTestFuncForVM (prog , 1 , 3 , 4 , - 5 ))
752- t .Run ("good, negative base, negative mod" , getTestFuncForVM (prog , 2 , - 3 , 5 , - 5 ))
752+ t .Run ("good, negative base, negative mod" , getTestFuncForVM (prog , - 3 , - 3 , 5 , - 5 ))
753753 t .Run ("bad, big negative exponent" , getTestFuncForVM (prog , nil , 3 , - 2 , 5 ))
754754 t .Run ("bad, zero modulus" , getTestFuncForVM (prog , nil , 3 , 4 , 0 ))
755+ t .Run ("zero result, negative base, even exponent" , getTestFuncForVM (prog , 0 , - 2 , 3 , 8 ))
755756
756757 t .Run ("inverse compatibility" , func (t * testing.T ) { // Tests are taken from C# node.
757758 t .Run ("bad mod" , getTestFuncForVM (prog , nil , 1 , - 1 , 0 ))
@@ -760,6 +761,7 @@ func TestMODPOW(t *testing.T) {
760761 t .Run ("bad base" , getTestFuncForVM (prog , nil , 0 , - 1 , 1 ))
761762 t .Run ("no inverse exists" , getTestFuncForVM (prog , nil , math .MaxUint16 , - 1 , math .MaxUint8 ))
762763 t .Run ("good" , getTestFuncForVM (prog , 52 , 19 , - 1 , 141 ))
764+ t .Run ("good" , getTestFuncForVM (prog , 1 , 5 , - 1 , 4 ))
763765 })
764766}
765767
0 commit comments