OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | |
Henrik Grunell
2015/09/03 07:14:20
Remove "(c)".
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include <cmath> | |
6 | |
7 #include "media/audio/point.h" | |
8 #include "testing/gtest/include/gtest/gtest.h" | |
9 | |
10 namespace media { | |
11 namespace { | |
12 | |
13 TEST(PointTest, IsValid) { | |
14 { | |
15 const Point point; | |
16 EXPECT_TRUE(point.IsValid()); | |
17 } | |
18 { | |
19 const Point point(0, -1, 5.5); | |
20 EXPECT_TRUE(point.IsValid()); | |
21 } | |
22 { | |
23 const Point point(NAN, 0, 0); | |
24 EXPECT_FALSE(point.IsValid()); | |
25 } | |
26 } | |
27 | |
28 TEST(PointTest, ToString) { | |
29 const std::string point_string = "x=0.000, y=1.000, z=-1.000"; | |
30 const Point point(0, 1, -1); | |
31 EXPECT_EQ(point_string, point.ToString()); | |
32 } | |
33 | |
34 TEST(PointTest, ParsePointString) { | |
35 const std::vector<Point> expected_empty; | |
36 EXPECT_EQ(expected_empty, ParsePointsFromString("")); | |
37 EXPECT_EQ(expected_empty, ParsePointsFromString("0 0 a")); | |
38 EXPECT_EQ(expected_empty, ParsePointsFromString("1 2")); | |
39 EXPECT_EQ(expected_empty, ParsePointsFromString("1 2 3 4")); | |
40 | |
41 { | |
42 std::vector<Point> expected(1, Point(-0.02f, 0, 0)); | |
43 expected.push_back(Point(0.02f, 0, 0)); | |
44 EXPECT_EQ(expected, ParsePointsFromString("-0.02 0 0 0.02 0 0")); | |
45 } | |
46 { | |
47 std::vector<Point> expected(1, Point(1, 2, 3)); | |
48 EXPECT_EQ(expected, ParsePointsFromString("1 2 3")); | |
49 } | |
50 } | |
51 | |
52 } // namespace | |
53 } // namespace media | |
OLD | NEW |