1 // Copyright (c) 2013 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.
7 base.require('base.utils');
9 base.unittest.testSuite('base.utils', function() {
10 test('clamping', function() {
11 assertEquals(2, base.clamp(2, 1, 3));
12 assertEquals(1, base.clamp(1, 1, 3));
13 assertEquals(1, base.clamp(0, 1, 3));
14 assertEquals(3, base.clamp(3, 1, 3));
15 assertEquals(3, base.clamp(4, 1, 3));