Skip to content

Commit 8bbb11a

Browse files
committed
Set outlines fo the new tests
1 parent 548b1f0 commit 8bbb11a

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

demo/test.c

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,8 +1395,7 @@ static int test_mp_reduce_2k_l(void)
13951395
return EXIT_SUCCESS;
13961396
# endif /* LTM_DEMO_TEST_REDUCE_2K_L */
13971397
}
1398-
/* stripped down version of mp_radix_size. The faster version can be off by up t
1399-
o +3 */
1398+
/* stripped down version of mp_radix_size. The faster version can be off by up to +3 */
14001399
static mp_err s_rs(const mp_int *a, int radix, int *size)
14011400
{
14021401
mp_err res;
@@ -1425,6 +1424,32 @@ static mp_err s_rs(const mp_int *a, int radix, int *size)
14251424
*size = digs + 1;
14261425
return MP_OKAY;
14271426
}
1427+
1428+
/* The internal functions that compute the logarithm base two with MP_PRECISION_FIXED_LOG */
1429+
static int test_s_mp_fp_log(void)
1430+
{
1431+
// s_mp_fp_log(const mp_int *a, mp_int *c)
1432+
1433+
1434+
/*
1435+
"a" some large constants.
1436+
No random values because it would be quite involved to check the results
1437+
1438+
Some checks are made earlier so no tests with "a" a power of two are needed.
1439+
*/
1440+
1441+
1442+
return MP_OKAY;
1443+
}
1444+
static int test_s_mp_fp_log_d(void)
1445+
{
1446+
// s_mp_fp_log_d(const mp_int *a, mp_word *c)
1447+
/* See test_s_mp_fp_log() for details */
1448+
return MP_OKAY;
1449+
}
1450+
1451+
1452+
/* TODO: Cleanup (not everything is still needed) and construct (find) testvalues for each correction loop */
14281453
static int test_mp_log_n(void)
14291454
{
14301455
mp_int a;
@@ -2436,6 +2461,8 @@ static int unit_tests(int argc, char **argv)
24362461
T1(mp_get_u32, MP_GET_I32),
24372462
T1(mp_get_u64, MP_GET_I64),
24382463
T1(mp_get_ul, MP_GET_L),
2464+
T1(s_mp_fp_log_d, S_MP_FP_LOG_D),
2465+
T1(s_mp_fp_log, S_MP_FP_LOG),
24392466
T1(mp_log_n, MP_LOG_N),
24402467
T1(mp_log, MP_LOG),
24412468
T1(mp_incr, MP_ADD_D),

0 commit comments

Comments
 (0)