Fixed bit lenght assertions for safe prime generator tests

This commit is contained in:
Piotr Dyraga committed 2018-07-27 16:45:29 +02:00
1 parent 7ab24f0641
commit ee7e96eaf6
1 file changed
+6 -7
+6 -7
View File
@@ -2,7 +2,6 @@ package paillier
import ( import (
"errors" "errors"
"fmt"
"math/big" "math/big"
"reflect" "reflect"
"testing" "testing"
@@ -77,18 +76,18 @@ func TestAsyncGenerator(t *testing.T) {
t.Errorf("2q + 1 != p") t.Errorf("2q + 1 != p")
} }
if len(p.Bytes()) != test.bitLen { if p.BitLen() != test.bitLen {
fmt.Errorf( t.Fatalf(
"Unexpected p bit length\nActual: %v\nExpected: %v", "Unexpected p bit length\nActual: %v\nExpected: %v",
len(p.Bytes()), p.BitLen(),
test.bitLen, test.bitLen,
) )
} }
if len(q.Bytes()) != test.bitLen-1 { if q.BitLen() != test.bitLen-1 {
fmt.Errorf( t.Fatalf(
"Unexpected q bit length\nActual: %v\nExpected: %v", "Unexpected q bit length\nActual: %v\nExpected: %v",
len(q.Bytes()), q.BitLen(),
test.bitLen-1, test.bitLen-1,
) )
} }