blob: f842519161b65877c6b46828065f60cab866e86b [file] [log] [blame]
Austin Schuh173a1592018-12-19 16:20:54 +11001#include "frc971/control_loops/fixed_quadrature.h"
2
3#include <cmath>
4
5#include "gtest/gtest.h"
6
7namespace frc971 {
8namespace control_loops {
9namespace testing {
10
11// Tests that integrating y = cos(x) works.
12TEST(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