Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Unified Diff: tracing/tracing/extras/rail/rail_interaction_record_test.html

Issue 1357983002: Invert pain to comfort throughout tracing. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: . Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tracing/tracing/extras/rail/rail_interaction_record_test.html
diff --git a/tracing/tracing/extras/rail/rail_interaction_record_test.html b/tracing/tracing/extras/rail/rail_interaction_record_test.html
index 189ac751bcd17063ef88d2e91713e1350eb94ba3..ba15d6fed766539680748c91a79baa878c14d715 100644
--- a/tracing/tracing/extras/rail/rail_interaction_record_test.html
+++ b/tracing/tracing/extras/rail/rail_interaction_record_test.html
@@ -36,7 +36,7 @@ tr.b.unittest.testSuite(function() {
assert.equal(rir.args.layoutInfo.timeInLayout, 100);
});
- test('computeNormalizedPain', function() {
+ test('computeNormalizedComfort', function() {
var opts = {
minValueExponential: 1,
minValueLinear: 2,
@@ -44,24 +44,29 @@ tr.b.unittest.testSuite(function() {
maxValue: 4
};
- assert.equal(0, tr.e.rail.computeNormalizedPain(0, opts));
-
- // Exponential pain should be convex.
- assert.equal(0, tr.e.rail.computeNormalizedPain(1 - 1e-4, opts));
- assert.isTrue(0.1 > tr.e.rail.computeNormalizedPain(1.5, opts));
-
- // Linear pain should be linear.
- assert.closeTo(0.2, tr.e.rail.computeNormalizedPain(2 - 1e-4, opts), 1e-4);
- assert.closeTo(0.2, tr.e.rail.computeNormalizedPain(2 + 1e-4, opts), 1e-4);
- assert.closeTo(0.55, tr.e.rail.computeNormalizedPain(2.5, opts), 1e-4);
- assert.closeTo(0.9, tr.e.rail.computeNormalizedPain(3 - 1e-4, opts), 1e-4);
-
- // Logarithmic pain should be concave.
- assert.closeTo(0.9, tr.e.rail.computeNormalizedPain(3 + 1e-5, opts), 1e-4);
- assert.isTrue(0.95 < tr.e.rail.computeNormalizedPain(3.5, opts));
- assert.closeTo(1, tr.e.rail.computeNormalizedPain(4 - 1e-4, opts), 1e-5);
-
- assert.equal(1, tr.e.rail.computeNormalizedPain(4 + 1e-4, opts));
+ assert.equal(0, tr.e.rail.computeNormalizedComfort(0, opts));
+
+ // Exponential comfort should be convex.
+ assert.equal(0, tr.e.rail.computeNormalizedComfort(1 - 1e-4, opts));
+ assert.isTrue(0.1 > tr.e.rail.computeNormalizedComfort(1.5, opts));
+
+ // Linear comfort should be linear.
+ assert.closeTo(0.2, tr.e.rail.computeNormalizedComfort(2 - 1e-4, opts),
+ 1e-4);
+ assert.closeTo(0.2, tr.e.rail.computeNormalizedComfort(2 + 1e-4, opts),
+ 1e-4);
+ assert.closeTo(0.55, tr.e.rail.computeNormalizedComfort(2.5, opts),
+ 1e-4);
+ assert.closeTo(0.9, tr.e.rail.computeNormalizedComfort(3 - 1e-4, opts),
+ 1e-4);
+
+ // Logarithmic comfort should be concave.
+ assert.closeTo(0.9, tr.e.rail.computeNormalizedComfort(3 + 1e-5, opts),
+ 1e-4);
+ assert.isTrue(0.95 < tr.e.rail.computeNormalizedComfort(3.5, opts));
+ assert.closeTo(1, tr.e.rail.computeNormalizedComfort(4 - 1e-4, opts), 1e-5);
+
+ assert.equal(1, tr.e.rail.computeNormalizedComfort(4 + 1e-4, opts));
});
// This basically just tests weightedAverage2.
@@ -69,7 +74,7 @@ tr.b.unittest.testSuite(function() {
var ir = new tr.e.rail.StubRAILInteractionRecord({
start: 0, end: 100,
railTypeName: 'rail_idle',
- normalizedUserPain: 1,
+ normalizedUserComfort: 0,
normalizedEfficiency: 0
});
assert.closeTo(0, ir.railScore, 1e-5);
@@ -77,7 +82,7 @@ tr.b.unittest.testSuite(function() {
ir = new tr.e.rail.StubRAILInteractionRecord({
start: 0, end: 100,
railTypeName: 'rail_idle',
- normalizedUserPain: 0,
+ normalizedUserComfort: 1,
normalizedEfficiency: 1
});
assert.closeTo(1, ir.railScore, 1e-5);
@@ -85,7 +90,7 @@ tr.b.unittest.testSuite(function() {
ir = new tr.e.rail.StubRAILInteractionRecord({
start: 0, end: 100,
railTypeName: 'rail_idle',
- normalizedUserPain: 0,
+ normalizedUserComfort: 1,
normalizedEfficiency: 0
});
assert.closeTo(0.42388, ir.railScore, 1e-5);
@@ -93,7 +98,7 @@ tr.b.unittest.testSuite(function() {
ir = new tr.e.rail.StubRAILInteractionRecord({
start: 0, end: 100,
railTypeName: 'rail_idle',
- normalizedUserPain: 1,
+ normalizedUserComfort: 0,
normalizedEfficiency: 1
});
assert.closeTo(0.15536, ir.railScore, 1e-5);
« no previous file with comments | « tracing/tracing/extras/rail/rail_interaction_record.html ('k') | tracing/tracing/extras/rail/rail_ir_finder.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698