| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 // MSVC++ requires this to be set before any other includes to get M_PI. | 11 // MSVC++ requires this to be set before any other includes to get M_PI. |
| 12 #define _USE_MATH_DEFINES | 12 #define _USE_MATH_DEFINES |
| 13 | 13 |
| 14 #include "webrtc/modules/audio_processing/beamformer/array_util.h" | 14 #include "webrtc/modules/audio_processing/beamformer/array_util.h" |
| 15 | 15 |
| 16 #include <math.h> | 16 #include <math.h> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "webrtc/test/gtest.h" |
| 20 | 20 |
| 21 namespace webrtc { | 21 namespace webrtc { |
| 22 | 22 |
| 23 bool operator==(const Point& lhs, const Point& rhs) { | 23 bool operator==(const Point& lhs, const Point& rhs) { |
| 24 return lhs.x() == rhs.x() && lhs.y() == rhs.y() && lhs.z() == rhs.z(); | 24 return lhs.x() == rhs.x() && lhs.y() == rhs.y() && lhs.z() == rhs.z(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 TEST(ArrayUtilTest, PairDirection) { | 27 TEST(ArrayUtilTest, PairDirection) { |
| 28 EXPECT_EQ(Point(1.f, 2.f, 3.f), | 28 EXPECT_EQ(Point(1.f, 2.f, 3.f), |
| 29 PairDirection(Point(0.f, 0.f, 0.f), Point(1.f, 2.f, 3.f))); | 29 PairDirection(Point(0.f, 0.f, 0.f), Point(1.f, 2.f, 3.f))); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 EXPECT_FLOAT_EQ(-45.f, RadiansToDegrees(-M_PI / 4.f)); | 176 EXPECT_FLOAT_EQ(-45.f, RadiansToDegrees(-M_PI / 4.f)); |
| 177 EXPECT_FLOAT_EQ(60.f, RadiansToDegrees(M_PI / 3.f)); | 177 EXPECT_FLOAT_EQ(60.f, RadiansToDegrees(M_PI / 3.f)); |
| 178 EXPECT_FLOAT_EQ(-90.f, RadiansToDegrees(-M_PI / 2.f)); | 178 EXPECT_FLOAT_EQ(-90.f, RadiansToDegrees(-M_PI / 2.f)); |
| 179 EXPECT_FLOAT_EQ(120.f, RadiansToDegrees(2.f * M_PI / 3.f)); | 179 EXPECT_FLOAT_EQ(120.f, RadiansToDegrees(2.f * M_PI / 3.f)); |
| 180 EXPECT_FLOAT_EQ(-135.f, RadiansToDegrees(-3.f * M_PI / 4.f)); | 180 EXPECT_FLOAT_EQ(-135.f, RadiansToDegrees(-3.f * M_PI / 4.f)); |
| 181 EXPECT_FLOAT_EQ(150.f, RadiansToDegrees(5.f * M_PI / 6.f)); | 181 EXPECT_FLOAT_EQ(150.f, RadiansToDegrees(5.f * M_PI / 6.f)); |
| 182 EXPECT_FLOAT_EQ(-180.f, RadiansToDegrees(-M_PI)); | 182 EXPECT_FLOAT_EQ(-180.f, RadiansToDegrees(-M_PI)); |
| 183 } | 183 } |
| 184 | 184 |
| 185 } // namespace webrtc | 185 } // namespace webrtc |
| OLD | NEW |