1# Copyright 2014 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.
4import unittest
5
6from telemetry.timeline import bounds
7
8
9class BoundsTests(unittest.TestCase):
10
11  def testGetOverlap(self):
12    # Non overlap cases.
13    self.assertEquals(0, bounds.Bounds.GetOverlap(10, 20, 30, 40))
14    self.assertEquals(0, bounds.Bounds.GetOverlap(30, 40, 10, 20))
15    # Overlap cases.
16    self.assertEquals(10, bounds.Bounds.GetOverlap(10, 30, 20, 40))
17    self.assertEquals(10, bounds.Bounds.GetOverlap(20, 40, 10, 30))
18    # Inclusive cases.
19    self.assertEquals(10, bounds.Bounds.GetOverlap(10, 40, 20, 30))
20    self.assertEquals(10, bounds.Bounds.GetOverlap(20, 30, 10, 40))
21