Skip to content

Commit d420471

Browse files
vissarionclaude
andcommitted
Reorganize unit tests into subdirectories mirroring include/ structure
Move 42 test files from flat test/ into subdirectories: - convex_bodies/ (hpolytope, vpolytope, orderpolytope, convex_body) - convex_bodies/correlation_matrices/ (matrix sampling) - convex_bodies/spectrahedra/ (SDPA format) - diagnostics/ (MCMC diagnostics) - generators/ (polytope + zonotope generators) - integration/ (Monte Carlo integration) - lp_oracles/ (boundary oracles) - misc/ (poset, print_table, small_utils) - ode_solvers/ (ODE solvers, leapfrog) - preprocess/ (rounding, full_dimensional, inner points, max ellipsoid) - preprocess/crhmc/ (CRHMC preprocessing) - random_walks/ (sampling, shake-and-bake, logconcave) - random_walks/crhmc/ (CRHMC sampling) - root_finders/ (root finders) - sampling/ (MMCS) - volume/ (cooling balls, cooling gaussians, sequence of balls) - benchmarks/ (performance benchmarks) Each subdirectory has its own CMakeLists.txt with test registration. Root CMakeLists.txt retains shared setup (dependencies, coverage_config) and uses add_subdirectory() for each module. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 7fdb2fe commit d420471

79 files changed

Lines changed: 804 additions & 430 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

examples/crhmc_prepare/crhmc_prepare.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int main(int argc, char *argv[])
4141
{
4242
std::cout << "Usage: ./crhmc_prepare [file_name_string]\n";
4343
std::cout << "Example file name= "
44-
"../../test/metabolic_full_dim/polytope_e_coli.ine\n";
44+
"../data/metabolic_full_dim/polytope_e_coli.ine\n";
4545
exit(1);
4646
}
4747
std::string fileName(argv[1]);

examples/volume_spectrahedron/volume_cb_spectrahedra.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void example_volume(){
3636
std::ifstream in1;
3737
spectrahedron spectra;
3838
Point objFunction;
39-
in1.open("./../../test/spectra_data/sdp_prob_20_20.txt", std::ifstream::in);
39+
in1.open("./../../test/data/spectra_data/sdp_prob_20_20.txt", std::ifstream::in);
4040
sdpaFormatManager.loadSDPAFormatFile(in1, spectra, objFunction);
4141

4242
// Setup the parameters

test/.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Out-of-source build artifacts
2+
build/
3+
CMakeCache.txt
4+
CMakeFiles/
5+
cmake_install.cmake
6+
CTestTestfile.cmake
7+
Makefile
8+
*.o
9+
*.a
10+
*.so
11+
*.gcda
12+
*.gcno
13+
*.gcov
14+
Testing/
15+
compile_commands.json

test/CMakeLists.txt

Lines changed: 25 additions & 387 deletions
Large diffs are not rendered by default.

test/SDP/test_solve_sdp.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static SDPTestResult run_sdp_test(const SDPTestCase& test_case) {
131131
// Individual test case wrappers for better test organization
132132
static void test_sdp_2x8() {
133133
SDPTestCase test_case = {
134-
.filename = "../spectra_data/sdp__2_8_d.txt",
134+
.filename = "../data/spectra_data/sdp__2_8_d.txt",
135135
.expected_minimum = -1.3888e+00,
136136
.relative_error = 1e-2,
137137
.additive_error_factor = 5e-2,
@@ -147,7 +147,7 @@ static void test_sdp_2x8() {
147147

148148
static void test_sdp_20x20() {
149149
SDPTestCase test_case = {
150-
.filename = "../spectra_data/sdp_prob_20_20_d.txt",
150+
.filename = "../data/spectra_data/sdp_prob_20_20_d.txt",
151151
.expected_minimum = -1.6535356e+00,
152152
.relative_error = 1e-3,
153153
.additive_error_factor = 5e-2,
@@ -163,7 +163,7 @@ static void test_sdp_20x20() {
163163

164164
static void test_sdp_20x30() {
165165
SDPTestCase test_case = {
166-
.filename = "../spectra_data/sdp__20_30_d.txt",
166+
.filename = "../data/spectra_data/sdp__20_30_d.txt",
167167
.expected_minimum = -1.89076e+01,
168168
.relative_error = 1e-3,
169169
.additive_error_factor = 5e-2,
@@ -179,7 +179,7 @@ static void test_sdp_20x30() {
179179

180180
static void test_sdp_50x40() {
181181
SDPTestCase test_case = {
182-
.filename = "../spectra_data/sdp__50_40_d.txt",
182+
.filename = "../data/spectra_data/sdp__50_40_d.txt",
183183
.expected_minimum = -3.1513966779338073e+01,
184184
.relative_error = 1e-3,
185185
.additive_error_factor = 5e-2,
@@ -195,7 +195,7 @@ static void test_sdp_50x40() {
195195

196196
static void test_sdp_20x100() {
197197
SDPTestCase test_case = {
198-
.filename = "../spectra_data/sdp__20_100_d.txt",
198+
.filename = "../data/spectra_data/sdp__20_100_d.txt",
199199
.expected_minimum = -6.74974e+00,
200200
.relative_error = 1e-3,
201201
.additive_error_factor = 5e-2,
@@ -211,7 +211,7 @@ static void test_sdp_20x100() {
211211

212212
static void test_sdp_50x200() {
213213
SDPTestCase test_case = {
214-
.filename = "../spectra_data/sdp__50_200_d.txt",
214+
.filename = "../data/spectra_data/sdp__50_200_d.txt",
215215
.expected_minimum = -7.71954e+00,
216216
.relative_error = 1e-3,
217217
.additive_error_factor = 5e-2,
@@ -227,7 +227,7 @@ static void test_sdp_50x200() {
227227

228228
static void test_sdp_200x15() {
229229
SDPTestCase test_case = {
230-
.filename = "../spectra_data/sdp_prob_200_15_d.txt",
230+
.filename = "../data/spectra_data/sdp_prob_200_15_d.txt",
231231
.expected_minimum = -3.1610166002684946e+12,
232232
.relative_error = 1e-4,
233233
.additive_error_factor = 5e-2,
@@ -243,7 +243,7 @@ static void test_sdp_200x15() {
243243

244244
static void test_sdp_400x20() {
245245
SDPTestCase test_case = {
246-
.filename = "../spectra_data/sdp_prob_400_20_d.txt",
246+
.filename = "../data/spectra_data/sdp_prob_400_20_d.txt",
247247
.expected_minimum = -8.7728166762094482e+11,
248248
.relative_error = 1e-4,
249249
.additive_error_factor = 5e-2,
@@ -259,7 +259,7 @@ static void test_sdp_400x20() {
259259

260260
static void test_sdp_600x25() {
261261
SDPTestCase test_case = {
262-
.filename = "../spectra_data/sdp_prob_600_25_d.txt",
262+
.filename = "../data/spectra_data/sdp_prob_600_25_d.txt",
263263
.expected_minimum = -1.3547280395306393e+11,
264264
.relative_error = 1e-2,
265265
.additive_error_factor = 5e-2,

test/benchmarks/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Benchmark executables (not run via ctest by default)
2+
3+
add_executable(benchmarks_sob benchmarks_sob.cpp)
4+
add_executable(benchmarks_cg benchmarks_cg.cpp)
5+
add_executable(benchmarks_cb benchmarks_cb.cpp)
6+
7+
TARGET_LINK_LIBRARIES(benchmarks_sob lp_solve ${MKL_LINK} coverage_config)
8+
TARGET_LINK_LIBRARIES(benchmarks_cg lp_solve ${MKL_LINK} coverage_config)
9+
TARGET_LINK_LIBRARIES(benchmarks_cb lp_solve ${MKL_LINK} coverage_config)
10+
11+
# CRHMC benchmarks (disabled by default)
12+
# add_executable(benchmarks_crhmc benchmarks_crhmc.cpp)
13+
# add_executable(benchmarks_crhmc_sampling benchmarks_crhmc_sampling.cpp)
14+
# TARGET_LINK_LIBRARIES(benchmarks_crhmc_sampling lp_solve ${MKL_LINK} QD_LIB coverage_config)
15+
# TARGET_LINK_LIBRARIES(benchmarks_crhmc lp_solve ${MKL_LINK} QD_LIB coverage_config)
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,22 +93,22 @@ int main() {
9393
assert(preparation_time < 0.5);
9494
std::cout << "Assertion (preparation_time< 0.5 secs) passed!" << std::endl
9595
<< std::endl;
96-
if (exists_check("../test/metabolic_full_dim/polytope_e_coli.ine")) {
96+
if (exists_check("../data/metabolic_full_dim/polytope_e_coli.ine")) {
9797
preparation_time =
98-
benchmark("../test/metabolic_full_dim/polytope_e_coli.ine");
98+
benchmark("../data/metabolic_full_dim/polytope_e_coli.ine");
9999
assert(preparation_time < 2.0);
100100
std::cout << "Assertion (preparation_time< 2 secs) passed!" << std::endl
101101
<< std::endl;
102102
}
103-
if (exists_check("../test/netlib/afiro.ine")) {
104-
preparation_time = benchmark("../test/netlib/afiro.ine");
103+
if (exists_check("../data/netlib/afiro.ine")) {
104+
preparation_time = benchmark("../data/netlib/afiro.ine");
105105
assert(preparation_time < 0.3);
106106
std::cout << "Assertion (preparation_time< 0.3 secs) passed!" << std::endl
107107
<< std::endl;
108108
}
109-
if (exists_check("../test/metabolic_full_dim/polytope_iAB_RBC_283.ine")) {
109+
if (exists_check("../data/metabolic_full_dim/polytope_iAB_RBC_283.ine")) {
110110
preparation_time =
111-
benchmark("../test/metabolic_full_dim/polytope_iAB_RBC_283.ine");
111+
benchmark("../data/metabolic_full_dim/polytope_iAB_RBC_283.ine");
112112
assert(preparation_time < 400);
113113
std::cout << "Assertion (preparation_time< 400 secs) passed!" << std::endl
114114
<< std::endl;

test/benchmarks_crhmc_sampling.cpp renamed to test/benchmarks/benchmarks_crhmc_sampling.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,17 +369,17 @@ void call_test_benchmark_polytope() {
369369
test_benchmark_polytope<NT, Point, Hpolytope, simdLen>(stream, P, name, target_time, centered);
370370
}
371371

372-
if (exists_check("../test/netlib/afiro.ine")) {
373-
Hpolytope P = read_polytope<Hpolytope, NT>("../test/netlib/afiro.ine");
372+
if (exists_check("../data/netlib/afiro.ine")) {
373+
Hpolytope P = read_polytope<Hpolytope, NT>("../data/netlib/afiro.ine");
374374
std::string name = "afiro";
375375
bool centered = true;
376376
double target_time = 100; // secs
377377
test_benchmark_polytope<NT, Point, Hpolytope, simdLen>(stream, P, name, target_time, centered);
378378
}
379379

380-
if (exists_check("../test/metabolic_full_dim/polytope_e_coli.ine")) {
380+
if (exists_check("../data/metabolic_full_dim/polytope_e_coli.ine")) {
381381
Hpolytope P =
382-
read_polytope<Hpolytope, NT>("../test/metabolic_full_dim/polytope_e_coli.ine");
382+
read_polytope<Hpolytope, NT>("../data/metabolic_full_dim/polytope_e_coli.ine");
383383
std::string name = "e_coli";
384384
bool centered = true;
385385
double target_time = 600; // secs

0 commit comments

Comments
 (0)