int main () { printf("Derivee de sin pour x = 0 : %f\n", derivee(sin, 0)); printf("Derivee de cos pour x = 0 : %f\n", derivee(cos, 0)); printf("Derivee de exp pour x = 0 : %f\n", derivee(exp, 0)); printf("Derivee de x^2 pour x = 3 : %f\n", derivee(carre, 3)); return 0; }
// @derivee:test_derivee_4 => [La fonction derivee ne reagis pas correctement a un polynome nul.] void test_derivee_4(void) { double sol[] = {0.0, 0.0, 0.0, 0.0}; double test = 0; for (int i = 0; i < 4; i++) { test += sol[i] - eval(derivee(test4), x[i]); } int ass_less = fabs(test) < threshold; CU_ASSERT(ass_less); }
// @derivee:test_derivee_1 => [La fonction derivee ne reagis pas correctement a un polynome entier de degre 9.] void test_derivee_1(void) { double sol[] = {165, 7181, 9 , 5}; double test = 0; for (int i = 0; i < 4; i++) { test += sol[i] - eval(derivee(test1), x[i]); } int ass_less = fabs(test) < threshold; CU_ASSERT(ass_less); }
// @derivee:test_derivee_2 => [La fonction derivee ne reagis pas correctement a un polynome non-entier de degre 9.] void test_derivee_2(void) { double sol[] = { -62.1748, -660.4536, 13.8700, 232.6128}; double test = 0; for (int i = 0; i < 4; i++) { test += sol[i] - eval(derivee(test2), x[i]); } int ass_less = fabs(test) < threshold; CU_ASSERT(ass_less); }