Commit 3552d71d authored by Louis Malevez's avatar Louis Malevez

Fichier de test(peu complet certes)

parent 2c422b3b
Pipeline #6613 passed with stage
in 0 seconds
//
// Created by Louis Malevez on 26-04-20.
//
#include <CUnit/CUnit.h>
#include <CUnit/Basic.h>
#include <CUnit/Automated.h>
#include<stdlib.h>
#include"Factor.h"
#include "Fonction_liste.h"
int entier(int n){ // fonction qui retourne le l'entier via la fonction primeFactor(...)
struct dblist *Maliste;
Init(Maliste);
primeFactors(Maliste,666343);
struct elem *runner;
runner=Maliste->first;
int a;
a=runner->value;
Clear(Maliste);
return a;
}
int diviseur1(int n){ // fonction qui retourne le l'entier via la fonction primeFactor(...)
struct dblist *Maliste;
Init(Maliste);
primeFactors(Maliste,666343);
struct elem *runner;
runner=Maliste->first->next;
int a;
a=runner->value;
Clear(Maliste);
return a;
}
int diviseur2(int n){ // fonction qui retourne le l'entier via la fonction primeFactor(...)
struct dblist *Maliste;
Init(Maliste);
primeFactors(Maliste,666343);
struct elem *runner;
runner=Maliste->first->next->next;
int a;
a=runner->value;
Clear(Maliste);
return a;
}
void test_entier(void) // test si les diviseurs premiers retournés indirectement(via les fonctions ci-dessus) par primeFactors sont correctes,
{
CU_ASSERT(entier(666343) == 666343);
CU_ASSERT(diviseur1(666343) == 89);
CU_ASSERT(diviseur2(666343) == 7487);
}
int main() {
CU_initialize_registry();
CU_pSuite suite = CU_add_suite("maxi_test", 0, 0);
CU_add_test(suite, "fact_entier", test_entier);
CU_basic_set_mode(CU_BRM_VERBOSE);
CU_basic_run_tests();
CU_automated_run_tests();
CU_cleanup_registry();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment