@@ -292,66 +292,6 @@ static int test_mp_rand(void)
292292 return err == MP_OKAY ? EXIT_SUCCESS : EXIT_FAILURE ;
293293}
294294
295- static int test_s_mp_jacobi (void )
296- {
297- struct s_mp_jacobi_st {
298- unsigned long n ;
299- int c [16 ];
300- };
301-
302- static struct s_mp_jacobi_st jacobi [] = {
303- { 3 , { 1 , -1 , 0 , 1 , -1 , 0 , 1 , -1 , 0 , 1 , -1 , 0 , 1 , -1 , 0 , 1 } },
304- { 5 , { 0 , 1 , -1 , -1 , 1 , 0 , 1 , -1 , -1 , 1 , 0 , 1 , -1 , -1 , 1 , 0 } },
305- { 7 , { 1 , -1 , 1 , -1 , -1 , 0 , 1 , 1 , -1 , 1 , -1 , -1 , 0 , 1 , 1 , -1 } },
306- { 9 , { -1 , 1 , 0 , 1 , 1 , 0 , 1 , 1 , 0 , 1 , 1 , 0 , 1 , 1 , 0 , 1 } },
307- };
308-
309- int i , n , cnt ;
310- mp_err err , should ;
311- mp_int a , b ;
312- if (mp_init_multi (& a , & b , NULL )!= MP_OKAY ) {
313- return EXIT_FAILURE ;
314- }
315-
316- mp_set_ul (& a , 0uL );
317- mp_set_ul (& b , 1uL );
318- if ((err = s_mp_jacobi (& a , & b , & i )) != MP_OKAY ) {
319- printf ("Failed executing s_mp_jacobi(0 | 1) %s.\n" , mp_error_to_string (err ));
320- goto LBL_ERR ;
321- }
322- if (i != 1 ) {
323- printf ("Failed trivial s_mp_jacobi(0 | 1) %d != 1\n" , i );
324- goto LBL_ERR ;
325- }
326- for (cnt = 0 ; cnt < (int )(sizeof (jacobi )/sizeof (jacobi [0 ])); ++ cnt ) {
327- mp_set_ul (& b , jacobi [cnt ].n );
328- /* only test positive values of a */
329- for (n = -5 ; n <= 10 ; ++ n ) {
330- mp_set_ul (& a , (unsigned int )abs (n ));
331- should = MP_OKAY ;
332- if (n < 0 ) {
333- mp_neg (& a , & a );
334- /* Until #44 is fixed the negative a's must fail */
335- should = MP_VAL ;
336- }
337- if ((err = s_mp_jacobi (& a , & b , & i )) != should ) {
338- printf ("Failed executing s_mp_jacobi(%d | %lu) %s.\n" , n , jacobi [cnt ].n , mp_error_to_string (err ));
339- goto LBL_ERR ;
340- }
341- if ((err == MP_OKAY ) && (i != jacobi [cnt ].c [n + 5 ])) {
342- printf ("Failed trivial s_mp_jacobi(%d | %lu) %d != %d\n" , n , jacobi [cnt ].n , i , jacobi [cnt ].c [n + 5 ]);
343- goto LBL_ERR ;
344- }
345- }
346- }
347-
348- mp_clear_multi (& a , & b , NULL );
349- return EXIT_SUCCESS ;
350- LBL_ERR :
351- mp_clear_multi (& a , & b , NULL );
352- return EXIT_FAILURE ;
353- }
354-
355295static int test_mp_kronecker (void )
356296{
357297 struct mp_kronecker_st {
@@ -2175,7 +2115,6 @@ int unit_tests(int argc, char **argv)
21752115 T (mp_sqrtmod_prime ),
21762116 T (mp_xor ),
21772117 T (s_mp_balance_mul ),
2178- T (s_mp_jacobi ),
21792118 T (s_mp_karatsuba_mul ),
21802119 T (s_mp_karatsuba_sqr ),
21812120 T (s_mp_toom_mul ),
0 commit comments