This commit is contained in:
@@ -6,14 +6,14 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
static constexpr int EXECUTION_COUNT = 10;
|
||||
static constexpr int EXECUTION_COUNT = 1000;
|
||||
static constexpr int KERNEL_CHECKS = 100;
|
||||
static constexpr int MATRIX_MAX_SIZE = 10;
|
||||
static constexpr int MATRIX_MAX_SIZE = 9;
|
||||
|
||||
static const Solver solver;
|
||||
|
||||
static unsigned int GetRandomInt() {
|
||||
return rand() % MATRIX_MAX_SIZE + 1;
|
||||
static int GetRandomInt() {
|
||||
return rand() % 11 - 5;
|
||||
}
|
||||
|
||||
static Matrix GetRandomMatrix(std::size_t a_Raw, std::size_t a_Column) {
|
||||
@@ -28,8 +28,8 @@ static Matrix GetRandomMatrix(std::size_t a_Raw, std::size_t a_Column) {
|
||||
return matrix;
|
||||
}
|
||||
|
||||
static void Test() {
|
||||
Matrix matrix = GetRandomMatrix(GetRandomInt(), GetRandomInt());
|
||||
static bool Test() {
|
||||
Matrix matrix = GetRandomMatrix(rand() % MATRIX_MAX_SIZE + 1, rand() % MATRIX_MAX_SIZE + 1);
|
||||
|
||||
for (std::size_t i = 0; i < matrix.GetRawCount(); i++) {
|
||||
for (std::size_t j = 0; j < matrix.GetColumnCount(); j++) {
|
||||
@@ -57,12 +57,13 @@ static void Test() {
|
||||
Vect kernel2 = solver.Kernel(kernel.GetLinearSystem());
|
||||
|
||||
test_assert(kernel == kernel2);
|
||||
return true;
|
||||
}
|
||||
|
||||
int main() {
|
||||
srand(time(0));
|
||||
|
||||
std::vector<std::future<void>> results;
|
||||
std::vector<std::future<bool>> results;
|
||||
|
||||
// appelle la fonction Test() en parallèle
|
||||
for (int i = 0; i < EXECUTION_COUNT; i++) {
|
||||
@@ -70,5 +71,10 @@ int main() {
|
||||
results.push_back(std::move(handle));
|
||||
}
|
||||
|
||||
for (auto& result : results) {
|
||||
if (!result.get())
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user