OLD | NEW |
| (Empty) |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | |
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, PointsToString) { | |
14 std::vector<Point> points(1, Point(1, 0, 0.01f)); | |
15 points.push_back(Point(0, 2, 0.02f)); | |
16 EXPECT_EQ("1.000000,0.000000,0.010000, 0.000000,2.000000,0.020000", | |
17 PointsToString(points)); | |
18 | |
19 EXPECT_EQ("", PointsToString(std::vector<Point>())); | |
20 } | |
21 | |
22 TEST(PointTest, ParsePointString) { | |
23 const std::vector<Point> expected_empty; | |
24 EXPECT_EQ(expected_empty, ParsePointsFromString("")); | |
25 EXPECT_EQ(expected_empty, ParsePointsFromString("0 0 a")); | |
26 EXPECT_EQ(expected_empty, ParsePointsFromString("1 2")); | |
27 EXPECT_EQ(expected_empty, ParsePointsFromString("1 2 3 4")); | |
28 | |
29 { | |
30 std::vector<Point> expected(1, Point(-0.02f, 0, 0)); | |
31 expected.push_back(Point(0.02f, 0, 0)); | |
32 EXPECT_EQ(expected, ParsePointsFromString("-0.02 0 0 0.02 0 0")); | |
33 } | |
34 { | |
35 std::vector<Point> expected(1, Point(1, 2, 3)); | |
36 EXPECT_EQ(expected, ParsePointsFromString("1 2 3")); | |
37 } | |
38 } | |
39 | |
40 } // namespace | |
41 } // namespace media | |
OLD | NEW |