summaryrefslogtreecommitdiff
path: root/cras/src/tests/volume_curve_unittest.cc
blob: f25d95631b1a56f9a09629b73aca8ab230deb40b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <stdio.h>
#include <gtest/gtest.h>

extern "C" {
#include "cras_volume_curve.h"
}

namespace {

TEST(VolumeCurve, DefaultCurve) {
  struct cras_volume_curve *curve;
  curve = cras_volume_curve_create_default();
  ASSERT_NE(static_cast<struct cras_volume_curve *>(NULL), curve);
  EXPECT_EQ(-5000, curve->get_dBFS(curve, 50));
  EXPECT_EQ(0, curve->get_dBFS(curve, 100));
  EXPECT_EQ(-10000, curve->get_dBFS(curve, 0));
  EXPECT_EQ(-2500, curve->get_dBFS(curve, 75));
}

}  //  namespace

int main(int argc, char **argv) {
  ::testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}