blob: 697e62e6086c0ae9e3ce61f7a9a9d479cefc8884 [file] [log] [blame]
<!DOCTYPE html>
<!--
Copyright (c) 2015 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="/extras/rail/response_interaction_record.html">
<script>
'use strict';
tr.b.unittest.testSuite(function() {
var test_utils = tr.c.test_utils;
test('instantiate', function() {
var responseIR = new tr.e.rail.ResponseInteractionRecord(0, 150);
assert.equal(0, responseIR.normalizedUserPain);
responseIR = new tr.e.rail.ResponseInteractionRecord(0, 150.0001);
assert.closeTo(0, responseIR.normalizedUserPain, 1e-5);
responseIR = new tr.e.rail.ResponseInteractionRecord(0, 1000);
assert.equal(1, responseIR.normalizedUserPain);
responseIR = new tr.e.rail.ResponseInteractionRecord(0, 999.999);
assert.closeTo(1, responseIR.normalizedUserPain, 1e-5);
responseIR = new tr.e.rail.ResponseInteractionRecord(0, 751.68);
assert.closeTo(0.5, responseIR.normalizedUserPain, 1e-5);
responseIR = new tr.e.rail.ResponseInteractionRecord(0, 1);
assert.closeTo(0, responseIR.normalizedUserPain, 1e-5);
});
});
</script>