@@ -171,9 +171,8 @@ protected void testFindSingleFactorForRandomOddComposites(int minBits, int maxBi
171171 */
172172 protected void assertFullFactorizationSuccess (long N , String expectedPrimeFactorizationStr ) {
173173 BigInteger NBig = BigInteger .valueOf (N );
174- LOG .info ("Test " + N + " (" + NBig .bitLength () + " bit)" );
175174 SortedMultiset <BigInteger > factors = factorizer .factor (NBig );
176- LOG .info (N + " = " + factors .toString ("*" , "^" ));
175+ LOG .info (N + " (" + NBig . bitLength () + " bit) = " + factors .toString ("*" , "^" ));
177176 assertEquals (expectedPrimeFactorizationStr , factors .toString ("*" , "^" ));
178177 }
179178
@@ -184,9 +183,8 @@ protected void assertFullFactorizationSuccess(long N, String expectedPrimeFactor
184183 */
185184 protected void assertFullFactorizationFailure (long N , String expectedPrimeFactorizationStr ) {
186185 BigInteger NBig = BigInteger .valueOf (N );
187- LOG .info ("Test " + N + " (" + NBig .bitLength () + " bit)" );
188186 SortedMultiset <BigInteger > factors = factorizer .factor (NBig );
189- LOG .info (N + " = " + factors .toString ("*" , "^" ));
187+ LOG .info (N + " (" + NBig . bitLength () + " bit) = " + factors .toString ("*" , "^" ));
190188 assertNotEquals (expectedPrimeFactorizationStr , factors .toString ("*" , "^" ));
191189 }
192190
@@ -196,27 +194,25 @@ protected void assertFullFactorizationFailure(long N, String expectedPrimeFactor
196194 * @param expectedPrimeFactorizationStr string representation of the expected full prime factorization
197195 */
198196 protected void assertFullFactorizationSuccess (String NStr , String expectedPrimeFactorizationStr ) {
199- long t0 , t1 ;
200- t0 = System .currentTimeMillis ();
201197 BigInteger N = new BigInteger (NStr );
198+ long t0 = System .currentTimeMillis ();
202199 SortedMultiset <BigInteger > factors = factorizer .factor (N );
200+ long t1 = System .currentTimeMillis ();
201+ LOG .info (N + " (" + N .bitLength () + " bit) = " + factors .toString ("*" , "^" ) + " computed in " + (t1 -t0 ) + "ms" );
203202 assertEquals (expectedPrimeFactorizationStr , factors .toString ("*" , "^" ));
204- t1 = System .currentTimeMillis ();
205- LOG .info ("Factoring " + NStr + " took " + (t1 -t0 ) + "ms" );
206203 }
207204
208205 /**
209206 * Assert the failure of a full prime factorization.
210207 * @param NStr string representation of the integer to factor (should be odd)
211208 * @param expectedPrimeFactorizationStr string representation of the correct full prime factorization
212209 */
213- protected void assertFullFactorizationFailure (String oddNStr , String expectedPrimeFactorizationStr ) {
214- long t0 , t1 ;
215- t0 = System .currentTimeMillis ();
216- BigInteger N = new BigInteger (oddNStr );
217- SortedMultiset <BigInteger > factorResult = factorizer .factor (N );
218- assertNotEquals (expectedPrimeFactorizationStr , factorResult .toString ("*" , "^" ));
219- t1 = System .currentTimeMillis ();
220- LOG .info ("Factoring " + oddNStr + " took " + (t1 -t0 ) + "ms" );
210+ protected void assertFullFactorizationFailure (String NStr , String expectedPrimeFactorizationStr ) {
211+ BigInteger N = new BigInteger (NStr );
212+ long t0 = System .currentTimeMillis ();
213+ SortedMultiset <BigInteger > factors = factorizer .factor (N );
214+ long t1 = System .currentTimeMillis ();
215+ LOG .info (N + " (" + N .bitLength () + " bit) = " + factors .toString ("*" , "^" ) + " computed in " + (t1 -t0 ) + "ms" );
216+ assertNotEquals (expectedPrimeFactorizationStr , factors .toString ("*" , "^" ));
221217 }
222218}
0 commit comments