Skip to content

Commit

Permalink
fixed subtle bug in testDoubleSubtraction
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilko authored and hardbyte committed Feb 16, 2017
1 parent 3b340fd commit 68c881d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/test/java/com/n1analytics/paillier/SubtractionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,16 @@ public void testDoubleSubtraction() {
encodedB = new EncodedNumber(context, encodedB.value, newExp);
}
b = encodedB.decodeDouble();
if(context.isUnsigned()) { //now that we changed b, we have to check again if a < b
if (a < b) {
double tmp = a;
a = b;
b = tmp;
encodedA = context.encode(a);
}
}
encodedB = context.encode(b);

plainResult = a - b;

cipherTextA = context.encrypt(a);
Expand Down

0 comments on commit 68c881d

Please sign in to comment.