Skip to content

Commit 0891801

Browse files
Ralph UrlusRUrlus
authored andcommitted
TST: Clang format of tests
1 parent 373b5bc commit 0891801

File tree

8 files changed

+24
-24
lines changed

8 files changed

+24
-24
lines changed

tests/src/bindings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
#include "test_arraystore.h"
88
#include "test_mat_to_arr.h"
99
#include "test_nparray.h"
10-
#include "test_type_caster.h"
1110
#include "test_roundtrip.h"
11+
#include "test_type_caster.h"
1212

1313
#include <string>
1414

tests/src/test_arr_to_mat.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,12 @@ int test_arr_to_mat_1d(py::array_t<double>& arr, bool copy) {
137137
double mat_sum = arma::accu(M);
138138

139139
// variable for test status
140-
if (arr_N != M.n_elem) return 1;
141-
if (std::abs(arr_sum - mat_sum) > 1e-8) return 4;
142-
if (info.ptr != M.memptr()) return 5;
140+
if (arr_N != M.n_elem)
141+
return 1;
142+
if (std::abs(arr_sum - mat_sum) > 1e-8)
143+
return 4;
144+
if (info.ptr != M.memptr())
145+
return 5;
143146
return 0;
144147
} /* arr_to_mat_1d */
145148

@@ -396,7 +399,6 @@ py::array_t<double> debug_arr_to_mat(py::array_t<double>& arr, int copy) {
396399
return carma::mat_to_arr(carma::arr_to_mat<double>(arr, copy));
397400
}
398401

399-
400402
} // namespace tests
401403
} // namespace carma
402404

tests/src/test_native_arr_to_mat.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#include <carma>
21
#include <pybind11/numpy.h>
32
#include <pybind11/pybind11.h>
43
#include <armadillo>
4+
#include <carma>
55
#include <catch2/catch.hpp>
66

77
namespace py = pybind11;
@@ -27,7 +27,7 @@ TEST_CASE("Test arr_to_mat", "[arr_to_mat]") {
2727

2828
// compute sum of array
2929
double arr_sum = 0.0;
30-
double * _ptr = reinterpret_cast<double*>(info.ptr);
30+
double* _ptr = reinterpret_cast<double*>(info.ptr);
3131
auto ptr = arr.unchecked<2>();
3232
for (size_t ic = 0; ic < arr_S1; ic++) {
3333
for (size_t ir = 0; ir < arr_S0; ir++) {
@@ -63,7 +63,7 @@ TEST_CASE("Test arr_to_mat", "[arr_to_mat]") {
6363

6464
// compute sum of array
6565
double arr_sum = 0.0;
66-
double * _ptr = reinterpret_cast<double*>(info.ptr);
66+
double* _ptr = reinterpret_cast<double*>(info.ptr);
6767
auto ptr = arr.unchecked<2>();
6868
for (size_t ic = 0; ic < arr_S1; ic++) {
6969
for (size_t ir = 0; ir < arr_S0; ir++) {
@@ -100,7 +100,7 @@ TEST_CASE("Test arr_to_mat", "[arr_to_mat]") {
100100

101101
// compute sum of array
102102
double arr_sum = 0.0;
103-
double * _ptr = reinterpret_cast<double*>(info.ptr);
103+
double* _ptr = reinterpret_cast<double*>(info.ptr);
104104
auto ptr = arr.unchecked<2>();
105105
for (size_t ic = 0; ic < arr_S1; ic++) {
106106
for (size_t ir = 0; ir < arr_S0; ir++) {
@@ -121,7 +121,6 @@ TEST_CASE("Test arr_to_mat", "[arr_to_mat]") {
121121
CHECK(_ptr == M.memptr());
122122
}
123123

124-
125124
SECTION("F-contiguous; const") {
126125
int copy = 0;
127126

@@ -137,7 +136,7 @@ TEST_CASE("Test arr_to_mat", "[arr_to_mat]") {
137136

138137
// compute sum of array
139138
double arr_sum = 0.0;
140-
double * _ptr = reinterpret_cast<double*>(info.ptr);
139+
double* _ptr = reinterpret_cast<double*>(info.ptr);
141140
auto ptr = arr.unchecked<2>();
142141
for (size_t ic = 0; ic < arr_S1; ic++) {
143142
for (size_t ir = 0; ir < arr_S0; ir++) {
@@ -213,7 +212,7 @@ TEST_CASE("Test arr_to_mat", "[arr_to_mat]") {
213212

214213
// get buffer for raw pointer
215214
py::buffer_info info = arr.request();
216-
double* ptr = reinterpret_cast<double *>(info.ptr);
215+
double* ptr = reinterpret_cast<double*>(info.ptr);
217216

218217
// compute sum of array
219218
double arr_sum = 0;
@@ -1551,7 +1550,7 @@ TEST_CASE("Test arr_to_mat_view", "[arr_to_mat_view]") {
15511550

15521551
// compute sum of array
15531552
double arr_sum = 0.0;
1554-
double * _ptr = reinterpret_cast<double*>(info.ptr);
1553+
double* _ptr = reinterpret_cast<double*>(info.ptr);
15551554
auto ptr = arr.unchecked<2>();
15561555
for (size_t ic = 0; ic < arr_S1; ic++) {
15571556
for (size_t ir = 0; ir < arr_S0; ir++) {
@@ -1585,7 +1584,7 @@ TEST_CASE("Test arr_to_mat_view", "[arr_to_mat_view]") {
15851584

15861585
// compute sum of array
15871586
double arr_sum = 0.0;
1588-
double * _ptr = reinterpret_cast<double*>(info.ptr);
1587+
double* _ptr = reinterpret_cast<double*>(info.ptr);
15891588
auto ptr = arr.unchecked<2>();
15901589
for (size_t ic = 0; ic < arr_S1; ic++) {
15911590
for (size_t ir = 0; ir < arr_S0; ir++) {

tests/src/test_native_roundtrip.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#include <carma>
21
#include <pybind11/numpy.h>
32
#include <pybind11/pybind11.h>
43
#include <armadillo>
4+
#include <carma>
55
#include <catch2/catch.hpp>
66

77
namespace py = pybind11;
@@ -24,7 +24,7 @@ TEST_CASE("Test roundtrip mat", "[roundtrip_mat]") {
2424

2525
// compute sum of array
2626
double arr_sum = 0.0;
27-
double * _ptr = reinterpret_cast<double*>(info.ptr);
27+
double* _ptr = reinterpret_cast<double*>(info.ptr);
2828
auto ptr = arr.unchecked<2>();
2929
for (size_t ic = 0; ic < arr_S1; ic++) {
3030
for (size_t ir = 0; ir < arr_S0; ir++) {
@@ -56,7 +56,7 @@ TEST_CASE("Test roundtrip mat", "[roundtrip_mat]") {
5656

5757
// compute sum of array
5858
double arr_sum_out = 0.0;
59-
double * _ptr_out = reinterpret_cast<double*>(info_out.ptr);
59+
double* _ptr_out = reinterpret_cast<double*>(info_out.ptr);
6060
auto ptr_out = arr_out.unchecked<2>();
6161
for (size_t ic = 0; ic < arr_out_S1; ic++) {
6262
for (size_t ir = 0; ir < arr_out_S0; ir++) {
@@ -112,7 +112,7 @@ TEST_CASE("Test roundtrip row", "[roundtrip_row]") {
112112

113113
// compute sum of array
114114
double arr_sum_out = 0.0;
115-
double * _ptr_out = reinterpret_cast<double*>(info_out.ptr);
115+
double* _ptr_out = reinterpret_cast<double*>(info_out.ptr);
116116
auto ptr_out = arr_out.unchecked<2>();
117117
for (size_t i = 0; i < arr_out_S0; i++) {
118118
arr_sum_out += ptr_out(0, i);
@@ -165,7 +165,7 @@ TEST_CASE("Test roundtrip col", "[roundtrip_col]") {
165165

166166
// compute sum of array
167167
double arr_sum_out = 0.0;
168-
double * _ptr_out = reinterpret_cast<double*>(info_out.ptr);
168+
double* _ptr_out = reinterpret_cast<double*>(info_out.ptr);
169169
auto ptr_out = arr_out.unchecked<2>();
170170
for (size_t i = 0; i < arr_out_S0; i++) {
171171
arr_sum_out += ptr_out(i, 0);

tests/src/test_nparray.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,5 @@ void bind_test_is_well_behaved(py::module& m) {
4545
m.def(
4646
"is_well_behaved",
4747
[](const py::array_t<double>& arr) { return carma::is_well_behaved(arr); },
48-
"Test is_well_behaved"
49-
);
48+
"Test is_well_behaved");
5049
}

tests/src/test_nparray.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ void bind_test_set_not_owndata(py::module& m);
1515
void bind_test_set_not_writeable(py::module& m);
1616
void bind_test_is_well_behaved(py::module& m);
1717

18-
#endif // TESTS_SRC_TEST_NPARRAY_H_
18+
#endif // TESTS_SRC_TEST_NPARRAY_H_

tests/src/test_roundtrip.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#include <carma>
21
#include <pybind11/numpy.h>
32
#include <pybind11/pybind11.h>
43
#include <armadillo>
4+
#include <carma>
55

66
namespace py = pybind11;
77

tests/src/test_roundtrip.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#include <carma>
21
#include <pybind11/numpy.h>
32
#include <pybind11/pybind11.h>
43
#include <armadillo>
4+
#include <carma>
55

66
namespace py = pybind11;
77

0 commit comments

Comments
 (0)