blob: e8cb80ef9ee4bb76eaa8711dfd7aaa6e13468f0e [file] [log] [blame]
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings_lite.js"></script>
<script src="/gen/mojo/public/js/ts/bindings/tests/constants.test-mojom-lite.js"></script>
<script>
'use strict';
[{
constant: mojo.tstest.BOOL_VALUE,
expectedValue: true,
type: 'boolean'
}, {
constant: mojo.tstest.INT8_VALUE,
expectedValue: -2,
type: 'int8'
}, {
constant: mojo.tstest.UINT8_VALUE,
expectedValue: 128,
type: 'uint8'
}, {
constant: mojo.tstest.INT16_VALUE,
expectedValue: -233,
type: 'int16'
}, {
constant: mojo.tstest.UINT16_VALUE,
expectedValue: 44204,
type: 'uint16'
}, {
constant: mojo.tstest.INT32_VALUE,
expectedValue: -44204,
type: 'int32'
}, {
constant: mojo.tstest.UINT32_VALUE,
expectedValue: 4294967295,
type: 'uint32'
}, {
constant: mojo.tstest.INT64_VALUE,
expectedValue: -9223372036854775807n,
type: 'int64'
}, {
constant: mojo.tstest.UINT64_VALUE,
expectedValue: 9999999999999999999n,
type: 'uint64'
}, {
constant: mojo.tstest.DOUBLE_VALUE,
expectedValue: 3.14159,
type: 'double'
}, {
constant: mojo.tstest.DOUBLE_INFINITY,
expectedValue: Infinity,
type: 'double infinity'
}, {
constant: mojo.tstest.DOUBLE_NEGATIVE_INFINITY,
expectedValue: -Infinity,
type: 'double negative infinity'
}, {
constant: mojo.tstest.DOUBLE_NA_N,
expectedValue: NaN,
type: 'double NaN'
}, {
constant: mojo.tstest.FLOAT_VALUE,
expectedValue: 2.71828,
type: 'float'
}, {
constant: mojo.tstest.FLOAT_INFINITY,
expectedValue: Infinity,
type: 'float infinity'
}, {
constant: mojo.tstest.FLOAT_NEGATIVE_INFINITY,
expectedValue: -Infinity,
type: 'float negative infinity'
}, {
constant: mojo.tstest.FLOAT_NA_N,
expectedValue: NaN,
type: 'NaN'
}, {
constant: mojo.tstest.STRING_VALUE,
expectedValue: "test string contents",
type: 'string'
}, {
constant: mojo.tstest.NAMED_VALUE1,
expectedValue: mojo.tstest.UINT8_VALUE,
type: 'int8 that points to another constant'
}, {
constant: mojo.tstest.NAMED_VALUE2,
expectedValue: mojo.tstest.DOUBLE_INFINITY,
type: 'double that points to another constant'
}].forEach(testCase => {
test(
() => assert_equals(testCase.constant, testCase.expectedValue),
`Checks that the value of generated ${testCase.type} constants is correct`);
});
</script>