Skip to content

Commit

Permalink
🔍 test(egcd): Test edge case abs(a) === abs(b).
Browse files Browse the repository at this point in the history
  • Loading branch information
make-github-pseudonymous-again committed Jul 30, 2020
1 parent 58f144b commit 3ed2966
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions test/src/Integer/egcd.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,38 @@ test( macro , ZZ.$1() , ZZ.$1() , {
v: ZZ.$_1() ,
} ) ;

test( macro , ZZ.$1() , ZZ.$_1() , {
gcd: ZZ.$1() ,
x: ZZ.$0() ,
y: ZZ.$_1() ,
u: ZZ.$1() ,
v: ZZ.$1() ,
} ) ;

test( macro , ZZ.$_1() , ZZ.$1() , {
gcd: ZZ.$1() ,
x: ZZ.$0() ,
y: ZZ.$1() ,
u: ZZ.$_1() ,
v: ZZ.$_1() ,
} ) ;

test( macro , ZZ.$_1() , ZZ.$_1() , {
gcd: ZZ.$1() ,
x: ZZ.$0() ,
y: ZZ.$_1() ,
u: ZZ.$_1() ,
v: ZZ.$1() ,
} ) ;

test( macro , ZZ.from(2) , ZZ.from(2) , {
gcd: ZZ.from(2) ,
x: ZZ.$0() ,
y: ZZ.$1() ,
u: ZZ.$1() ,
v: ZZ.$_1() ,
} ) ;

test( macro , ZZ.from(2) , ZZ.from(3) , {
gcd: ZZ.$1() ,
x: ZZ.$_1() ,
Expand All @@ -95,6 +127,14 @@ test( macro , ZZ.from(2) , ZZ.from(4) , {
v: ZZ.from(1) ,
} ) ;

test( macro , ZZ.from(73218321) , ZZ.from(73218321) , {
gcd: ZZ.from(73218321) ,
x: ZZ.$0() ,
y: ZZ.$1() ,
u: ZZ.$1() ,
v: ZZ.$_1() ,
} ) ;

test( macro ,
ZZ.from('240') ,
ZZ.from('46') ,
Expand Down Expand Up @@ -308,4 +348,16 @@ test( macro ,
}
) ;

test( macro ,
ZZ.from('27464428722379302537066207419729547039001666019484342119914191943374771553192802830064910464708682216') ,
ZZ.from('27464428722379302537066207419729547039001666019484342119914191943374771553192802830064910464708682216') ,
{
gcd: ZZ.from('27464428722379302537066207419729547039001666019484342119914191943374771553192802830064910464708682216') ,
x: ZZ.$0() ,
y: ZZ.$1() ,
u: ZZ.$1() ,
v: ZZ.$_1() ,
}
) ;

// test generated with https://github.com/aureooms-research/gcd

0 comments on commit 3ed2966

Please sign in to comment.