feat: scaffold FCES-native C++ project with libtorch integration
- CMakeLists.txt with libtorch, GoogleTest, GoogleBenchmark, OpenMP, pybind11 - Header files: config, controller, population, fitness, evolution, spectral, oscillation, telemetry, optimizer - Source implementations: controller (full micro-MLP forward pass, mutation, crossover), fitness (Welford's algorithm), oscillation (DFT), spectral (SVD rank), optimizer (sign-SGD stub) - Tests: controller, population, fitness, optimizer (Google Test) - Benchmarks: evolve throughput, optimizer step (Google Benchmark) - Examples: simple optimization, PyTorch/libtorch integration - Python extension: pybind11 bindings with setup.py - README with architecture diagram and build instructions
This commit is contained in:
28
tests/test_population.cpp
Normal file
28
tests/test_population.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "fces/population.hpp"
|
||||
|
||||
using namespace fces;
|
||||
|
||||
TEST(PopulationTest, Construction) {
|
||||
Population pop(50);
|
||||
EXPECT_EQ(pop.size(), 50);
|
||||
}
|
||||
|
||||
TEST(PopulationTest, DirectConstruction) {
|
||||
Population pop(200, 10000, EliteStrategy::Cumulative,
|
||||
false, false, false, false, false, true);
|
||||
EXPECT_EQ(pop.size(), 1);
|
||||
}
|
||||
|
||||
TEST(PopulationTest, GetBestActive) {
|
||||
Population pop(10);
|
||||
auto& best = pop.get_best_active();
|
||||
// Should not crash
|
||||
EXPECT_GE(best.id, 0u);
|
||||
}
|
||||
|
||||
TEST(PopulationTest, CalmDown) {
|
||||
Population pop(10);
|
||||
pop.calm_down();
|
||||
EXPECT_LT(pop.global_sigma_modifier(), 1.0f);
|
||||
}
|
||||
Reference in New Issue
Block a user