Skip to content

Commit

Permalink
unit test exec speed improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
KRM7 committed Nov 6, 2023
1 parent 18a6857 commit 84b01b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions test/unit/metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ using namespace gapp;
using namespace gapp::metrics;

constexpr static size_t num_obj = 3;
constexpr static size_t num_gen = 10;
constexpr static size_t popsize = 100;
constexpr static size_t num_gen = 5;
constexpr static size_t popsize = 20;


TEMPLATE_TEST_CASE("fitness_metrics", "[metrics]", FitnessMin, FitnessMax, FitnessMean, FitnessVariance, FitnessStdDev, NadirPoint)
Expand All @@ -31,9 +31,9 @@ TEMPLATE_TEST_CASE("fitness_metrics", "[metrics]", FitnessMin, FitnessMax, Fitne
REQUIRE(metric.data().size() == num_gen);

REQUIRE(std::all_of(metric.begin(), metric.end(), detail::is_size(num_obj)));
REQUIRE(metric[4].size() == num_obj);
REQUIRE(metric[0].size() == num_obj);

const auto& val = metric[7];
const auto& val = metric[1];
REQUIRE(std::all_of(val.begin(), val.end(), detail::equal_to(0.0)));
}

Expand All @@ -48,7 +48,7 @@ TEST_CASE("nadir_point_metric", "[metrics]")
REQUIRE(metric.size() == num_gen);
REQUIRE(std::all_of(metric.begin(), metric.end(), detail::is_size(num_obj)));

const auto& val = metric[5];
const auto& val = metric[1];
REQUIRE(std::all_of(val.begin(), val.end(), detail::equal_to(0.0)));
}

Expand Down
2 changes: 1 addition & 1 deletion test/unit/mutation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ TEMPLATE_TEST_CASE("real_mutation", "[mutation]", real::Boundary, real::Gauss, r
const Bounds bounds = { -1.0, 1.0 };

RCGA context;
context.solve(DummyFitnessFunction<RealGene>(10), bounds);
context.solve(DummyFitnessFunction<RealGene>(10), bounds, 1);

Candidate<RealGene> candidate{ { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 } };
candidate.fitness = { 0.0 }; candidate.is_evaluated = true;
Expand Down

0 comments on commit 84b01b1

Please sign in to comment.