blob: 281950a26661a3467422799593195073acf013df [file] [log] [blame]
<!DOCTYPE html>
<!--
Copyright 2016 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="/tracing/base/range.html">
<link rel="import" href="/tracing/base/statistics.html">
<link rel="import" href="/tracing/base/unit.html">
<link rel="import" href="/tracing/value/diagnostics/diagnostic_map.html">
<link rel="import" href="/tracing/value/diagnostics/generic.html">
<link rel="import" href="/tracing/value/numeric.html">
<script>
'use strict';
tr.b.unittest.testSuite(function() {
test('nonUnitThrows', function() {
assert.throws(function() { new tr.v.NumericBase('foo', -273.15); });
});
test('nonNumberScalarThrows', function() {
var unit = tr.b.Unit.byName.sizeInBytes;
assert.throws(function() { new tr.v.ScalarNumeric(unit, 'foo'); });
});
test('scalarBasic', function() {
var unit = tr.b.Unit.byName.sizeInBytes;
var d = {
type: 'scalar',
unit: unit.asJSON(),
value: 42
};
assert.deepEqual(d, tr.v.NumericBase.fromDict(d).asDict());
});
});
</script>