tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

opSupportLimits.https.any.js (1387B)


      1 // META: title=validation context.opSupportLimits() interface
      2 // META: global=window
      3 // META: variant=?cpu
      4 // META: variant=?gpu
      5 // META: variant=?npu
      6 // META: script=../resources/utils_validation.js
      7 
      8 'use strict';
      9 
     10 
     11 const tests = [
     12  {
     13    operator: 'logicalAnd',
     14    limits: {
     15      a: {dataTypes: ['uint8']},
     16      b: {dataTypes: ['uint8']},
     17      output: {dataTypes: ['uint8']},
     18    }
     19  },
     20  {
     21    operator: 'logicalOr',
     22    limits: {
     23      a: {dataTypes: ['uint8']},
     24      b: {dataTypes: ['uint8']},
     25      output: {dataTypes: ['uint8']},
     26    }
     27  },
     28  {
     29    operator: 'logicalXor',
     30    limits: {
     31      a: {dataTypes: ['uint8']},
     32      b: {dataTypes: ['uint8']},
     33      output: {dataTypes: ['uint8']},
     34    }
     35  },
     36  {
     37    operator: 'logicalNot',
     38    limits: {
     39      a: {dataTypes: ['uint8']},
     40      output: {dataTypes: ['uint8']},
     41    }
     42  }
     43 ];
     44 
     45 tests.forEach(test => promise_test(async t => {
     46                const limits = context.opSupportLimits()[test.operator];
     47                for (let [name, expected] of Object.entries(test.limits)) {
     48                  for (let actualDataType of limits[name].dataTypes) {
     49                    assert_in_array(
     50                        actualDataType, expected.dataTypes,
     51                        `${test.operator}.${name}.dataTypes`);
     52                  }
     53                }
     54              }, `check opSupportLimits data types of ${test.operator}`));