/* * This program performs some very basic tests of libmp(3). It is by * no means expected to perform a complete test of the library for * correctness, but is meant to test the API to make sure libmp (or * libcrypto) updates don't totally break the library. */ int main(int argc, char *argv[]) { printf("1..25\n"); /* * Init "constants" variables - done in this somewhat * cumbersome way to in theory be able to check for memory * leaks. */ c0 = mp_itom(0); c1 = mp_itom(1); c2 = mp_itom(2); c3 = mp_itom(3); c5 = mp_itom(5); c6 = mp_itom(6); c8 = mp_itom(8); c10 = mp_itom(10); c14 = mp_itom(14); c15 = mp_itom(15); c25 = mp_itom(25); c42 = mp_itom(42); c43 = mp_itom(43); c44 = mp_itom(44); c45 = mp_itom(45); // Init temp variables t0 = mp_itom(0); t1 = mp_itom(0); // Run tests testsimpel(); testgcd(); testdiv(); testmult(); testpow(); testmsqrt(); // Cleanup mp_mfree(c0); mp_mfree(c1); mp_mfree(c2); mp_mfree(c3); mp_mfree(c5); mp_mfree(c6); mp_mfree(c8); mp_mfree(c10); mp_mfree(c14); mp_mfree(c15); mp_mfree(c25); mp_mfree(c42); mp_mfree(c43); mp_mfree(c44); mp_mfree(c45); mp_mfree(t0); mp_mfree(t1); return (EX_OK); }
static void test(void) { int idone, jdone, iidx, jidx; /* loop though all argument value combinations */ for (idone = 0, iidx = 0; i = getargval(iidx, &idone), !idone; iidx++) for (jdone = 0, jidx = 0; j = getargval(jidx, &jdone), !jdone; jidx++) { testmul(); testdiv(); } }
int main(void) { testdiv(); testsqrt(); testlog2(); testexp2(); testexp2log2(); #ifdef FIXED_POINT testilog2(); #endif return ret; }
int main(void) { MCU_init(); /* call Device Initialization */ SOPT_COPE =0; /*apago el watchdog*/ testdiv(); testsqrt(); testrsqrt(); testlog2(); testexp2(); testexp2log2(); #ifdef FIXED_POINT testilog2(); #endif return ret; }