summaryrefslogtreecommitdiff
path: root/src/util_unittest.cc
blob: 5d0a435ae402ed94db337e071d36948a44b34f39 (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
// Copyright 2012 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <gtest/gtest.h>

#include "include/macros.h"
#include "include/util.h"

namespace gestures {

class UtilTest : public ::testing::Test {};

TEST(UtilTest, DistSqTest) {
  FingerState fs[] = {
    // TM, Tm, WM, Wm, Press, Orientation, X, Y, TrID
    {0, 0, 0, 0, 1, 0, 1, 2, 1, 0},
    {0, 0, 0, 0, 1, 0, 4, 6, 1, 0}
  };
  EXPECT_FLOAT_EQ(DistSq(fs[0], fs[1]), 25);
  EXPECT_FLOAT_EQ(DistSqXY(fs[0], 4, 6), 25);
}

}  // namespace gestures