Optimiser F2 avec un tableau de clients rencontrés

This commit is contained in:
rabot
2026-10-21 11:11:56 +02:00
parent b6352e063b
commit 2b34b35f2b
3 changed files with 30 additions and 8 deletions
+16
View File
@@ -54,9 +54,25 @@ static void tester_tri(void)
}
}
static void tester_clients_distincts(void)
{
assert(nb_clients_distincts(NULL, 0) == 0);
Transaction t[NB_CLIENTS];
for (int i = 0; i < NB_CLIENTS; i++)
t[i] = (Transaction){i, NB_CLIENTS - 1, 0, 0};
assert(nb_clients_distincts(t, NB_CLIENTS) == 1);
t[0].client = 0;
assert(nb_clients_distincts(t, NB_CLIENTS) == 2);
for (int i = 0; i < NB_CLIENTS; i++)
t[i].client = i;
assert(nb_clients_distincts(t, NB_CLIENTS) == NB_CLIENTS);
assert(nb_clients_distincts(t, 1) == 1);
}
int main(void)
{
tester_tri();
tester_clients_distincts();
puts("Tests banque : OK");
return 0;
}