Austin Schuh | 173a159 | 2018-12-19 16:20:54 +1100 | [diff] [blame^] | 1 | #include "frc971/control_loops/fixed_quadrature.h" |
| 2 | |
| 3 | #include <cmath> |
| 4 | |
| 5 | #include "gtest/gtest.h" |
| 6 | |
| 7 | namespace frc971 { |
| 8 | namespace control_loops { |
| 9 | namespace testing { |
| 10 | |
| 11 | // Tests that integrating y = cos(x) works. |
| 12 | TEST(GaussianQuadratureTest, Cos) { |
| 13 | double y1 = |
| 14 | GaussianQuadrature5([](double x) { return ::std::cos(x); }, 0.0, 0.5); |
| 15 | |
| 16 | EXPECT_NEAR(y1, ::std::sin(0.5), 1e-15); |
| 17 | } |
| 18 | |
| 19 | } // namespace testing |
| 20 | } // namespace control_loops |
| 21 | } // namespace frc971 |