12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- #include "gtest/gtest.h"
- #include "../src/nmie-impl.hpp"
- TEST(BulkSphere, HandlesInput) {
- nmie::MultiLayerMie<double> nmie;
-
-
-
-
- std::vector< std::tuple< double, std::complex<double>, double, double, char > >
- parameters_and_results
- {
-
- {0.099, {0.75,0}, 7.417859e-06, 7.417859e-06, 'a'},
- {0.101, {0.75,0}, 8.033538e-06, 8.033538e-06, 'b'},
- {10, {0.75,0}, 2.232265, 2.232265, 'c'},
- {1000, {0.75,0}, 1.997908, 1.997908, 'd'},
- };
- for (const auto &data : parameters_and_results) {
- nmie.SetLayersSize({std::get<0>(data)});
- nmie.SetLayersIndex({std::get<1>(data)});
- nmie.RunMieCalculation();
- double Qext = nmie.GetQext();
- double Qsca = nmie.GetQsca();
- EXPECT_FLOAT_EQ(std::get<2>(data), Qext)
- << "Extinction of the bulk sphere, test case:" << std::get<4>(data);
- EXPECT_FLOAT_EQ(std::get<3>(data), Qsca)
- << "Scattering of the bulk sphere, test case:" << std::get<4>(data);
- }
- }
- int main(int argc, char **argv) {
- testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
- }
|