Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: media/audio/point_unittest.cc

Issue 1275783003: Add a virtual beamforming audio device on ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Chromebook not booting. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698