Skip to content

Commit

Permalink
Copy test inputs and fix paths in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ckendrick committed Jul 18, 2024
1 parent 4bb4191 commit 1152b04
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 22 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,11 @@ if (ENABLE_TESTS)

add_test(NAME test_${stem} COMMAND test_${stem} WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/tests/")
endforeach(stem) # IN LISTS unit_test_stems

# Copy testing inputs and scripts to build/tests/
file(COPY ${CMAKE_SOURCE_DIR}/unit_tests/baselines/ DESTINATION "${CMAKE_BINARY_DIR}/tests/baselines/")
file(COPY ${CMAKE_SOURCE_DIR}/unit_tests/s_opt_data/ DESTINATION "${CMAKE_BINARY_DIR}/tests/s_opt_data/")

endif()

# NOTE([email protected], [email protected]): This code snippet
Expand Down
4 changes: 2 additions & 2 deletions unit_tests/test_DMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ TEST(DMDTest, Test_DMD)
EXPECT_NEAR(result->item(i), prediction_baseline[row_offset[d_rank] + i], 1e-3);
}

dmd.save("test_DMD");
CAROM::DMD dmd_load("test_DMD");
dmd.save("test_DMD_trained");
CAROM::DMD dmd_load("test_DMD_trained");
CAROM::Vector* result_load = dmd_load.predict(3.0);

for (int i = 0; i < d_num_rows; i++) {
Expand Down
40 changes: 20 additions & 20 deletions unit_tests/test_S_OPT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ TEST(S_OPTSerialTest, Test_S_OPT)
}

CAROM::CSVDatabase database;
database.getDoubleArray("../unit_tests/s_opt_data/col1.csv", cols[0], num_rows,
database.getDoubleArray("./s_opt_data/col1.csv", cols[0], num_rows,
row_offset[d_rank], 1, 1);
database.getDoubleArray("../unit_tests/s_opt_data/col2.csv", cols[1], num_rows,
database.getDoubleArray("./s_opt_data/col2.csv", cols[1], num_rows,
row_offset[d_rank], 1, 1);
database.getDoubleArray("../unit_tests/s_opt_data/col3.csv", cols[2], num_rows,
database.getDoubleArray("./s_opt_data/col3.csv", cols[2], num_rows,
row_offset[d_rank], 1, 1);
database.getDoubleArray("../unit_tests/s_opt_data/col4.csv", cols[3], num_rows,
database.getDoubleArray("./s_opt_data/col4.csv", cols[3], num_rows,
row_offset[d_rank], 1, 1);
database.getDoubleArray("../unit_tests/s_opt_data/col5.csv", cols[4], num_rows,
database.getDoubleArray("./s_opt_data/col5.csv", cols[4], num_rows,
row_offset[d_rank], 1, 1);

double* orthonormal_mat = new double[num_rows * num_cols];
Expand Down Expand Up @@ -193,15 +193,15 @@ TEST(S_OPTSerialTest, Test_S_OPT_less_basis_vectors)
}

CAROM::CSVDatabase database;
database.getDoubleArray("../unit_tests/s_opt_data/col1.csv", cols[0], num_rows,
database.getDoubleArray("./s_opt_data/col1.csv", cols[0], num_rows,
row_offset[d_rank], 1, 1);
database.getDoubleArray("../unit_tests/s_opt_data/col2.csv", cols[1], num_rows,
database.getDoubleArray("./s_opt_data/col2.csv", cols[1], num_rows,
row_offset[d_rank], 1, 1);
database.getDoubleArray("../unit_tests/s_opt_data/col3.csv", cols[2], num_rows,
database.getDoubleArray("./s_opt_data/col3.csv", cols[2], num_rows,
row_offset[d_rank], 1, 1);
database.getDoubleArray("../unit_tests/s_opt_data/col4.csv", cols[3], num_rows,
database.getDoubleArray("./s_opt_data/col4.csv", cols[3], num_rows,
row_offset[d_rank], 1, 1);
database.getDoubleArray("../unit_tests/s_opt_data/col5.csv", cols[4], num_rows,
database.getDoubleArray("./s_opt_data/col5.csv", cols[4], num_rows,
row_offset[d_rank], 1, 1);

double* orthonormal_mat = new double[num_rows * num_cols];
Expand Down Expand Up @@ -309,15 +309,15 @@ TEST(S_OPTSerialTest, Test_S_OPT_init_vector)
}

CAROM::CSVDatabase database;
database.getDoubleArray("../unit_tests/s_opt_data/col1.csv", cols[0], num_rows,
database.getDoubleArray("./s_opt_data/col1.csv", cols[0], num_rows,
row_offset[d_rank], 1, 1);
database.getDoubleArray("../unit_tests/s_opt_data/col2.csv", cols[1], num_rows,
database.getDoubleArray("./s_opt_data/col2.csv", cols[1], num_rows,
row_offset[d_rank], 1, 1);
database.getDoubleArray("../unit_tests/s_opt_data/col3.csv", cols[2], num_rows,
database.getDoubleArray("./s_opt_data/col3.csv", cols[2], num_rows,
row_offset[d_rank], 1, 1);
database.getDoubleArray("../unit_tests/s_opt_data/col4.csv", cols[3], num_rows,
database.getDoubleArray("./s_opt_data/col4.csv", cols[3], num_rows,
row_offset[d_rank], 1, 1);
database.getDoubleArray("../unit_tests/s_opt_data/col5.csv", cols[4], num_rows,
database.getDoubleArray("./s_opt_data/col5.csv", cols[4], num_rows,
row_offset[d_rank], 1, 1);

double* orthonormal_mat = new double[num_rows * num_cols];
Expand Down Expand Up @@ -468,15 +468,15 @@ TEST(S_OPTSerialTest, Test_S_OPT_QR)
}

CAROM::CSVDatabase database;
database.getDoubleArray("../unit_tests/s_opt_data/col1.csv", cols[0], num_rows,
database.getDoubleArray("./s_opt_data/col1.csv", cols[0], num_rows,
row_offset[d_rank], 1, 1);
database.getDoubleArray("../unit_tests/s_opt_data/col2.csv", cols[1], num_rows,
database.getDoubleArray("./s_opt_data/col2.csv", cols[1], num_rows,
row_offset[d_rank], 1, 1);
database.getDoubleArray("../unit_tests/s_opt_data/col3.csv", cols[2], num_rows,
database.getDoubleArray("./s_opt_data/col3.csv", cols[2], num_rows,
row_offset[d_rank], 1, 1);
database.getDoubleArray("../unit_tests/s_opt_data/col4.csv", cols[3], num_rows,
database.getDoubleArray("./s_opt_data/col4.csv", cols[3], num_rows,
row_offset[d_rank], 1, 1);
database.getDoubleArray("../unit_tests/s_opt_data/col5.csv", cols[4], num_rows,
database.getDoubleArray("./s_opt_data/col5.csv", cols[4], num_rows,
row_offset[d_rank], 1, 1);

double* orthonormal_mat = new double[num_rows * num_cols];
Expand Down

0 comments on commit 1152b04

Please sign in to comment.