tor-browser

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

hypot-pow-sqrt-computed.html (3078B)


      1 <!DOCTYPE html>
      2 <link rel="help" href="https://drafts.csswg.org/css-values-4/#exponent-funcs">
      3 <link rel="help" href="https://drafts.csswg.org/css-values-4/#numbers">
      4 <link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-type-checking">
      5 <link rel="author" title="Apple Inc">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <script src="../support/numeric-testcommon.js"></script>
      9 <div>
     10  <div></div>
     11  <div></div>
     12  <div></div>
     13  <div id="target"></div>
     14 </div>
     15 <script>
     16 
     17 // Identity tests
     18 test_math_used('pow(1,1)', '1', {type:'integer'});
     19 test_math_used('sqrt(1)', '1', {type:'integer'});
     20 test_math_used('hypot(1)', '1', {type:'integer'});
     21 
     22 // Nestings
     23 test_math_used('sqrt(pow(1,1))', '1', {type:'integer'});
     24 test_math_used('hypot(pow(1, sqrt(1)))', '1', {type:'integer'});
     25 test_math_used('calc(hypot(pow((1 + sqrt(1)) / 2, sqrt(1))))', '1', {type:'integer'});
     26 
     27 // General calculations
     28 test_math_used('calc(100px * pow(2, pow(2, 2)))','1600px');
     29 test_math_used('calc(1px * pow(2, 3))', '8px')
     30 test_math_used('calc(100px * sqrt(100))', '1000px');
     31 test_math_used('calc(1px * pow(2, sqrt(100))', '1024px');
     32 test_math_used('hypot(3px, 4px)', '5px');
     33 test_math_used('hypot(3e+9px, 4e+9px)', '5e+9px');
     34 test_math_used('calc(100px * hypot(3, 4))', '500px');
     35 test_math_used('hypot(-5px)', '5px');
     36 test_math_used('calc(1px * hypot(-5))', '5px');
     37 test_math_used('calc(1px * hypot(10000))','10000px');
     38 test_math_used('calc(2px * sqrt(100000000))','20000px');
     39 test_math_used('calc(3px * pow(20, 4))', '480000px');
     40 test_math_used('calc(-2 * hypot(3px, 4px))', '-10px');
     41 test_math_used('hypot(0% + 3px, 0% + 4px)', '5px');
     42 test_math_used('hypot(0% + 772.333px)', 'calc(0% + 772.333px)');
     43 test_math_used('hypot(0% + 772.35px)', 'calc(0% + 772.35px)');
     44 test_math_used('hypot(0% + 600px, 0% + 800px)', '1000px');
     45 
     46 //Test unresolved at parse time
     47 test_math_used('sqrt(sibling-index())', '2', {type: 'integer'});
     48 test_math_used('calc(1px * sqrt(sibling-index()))', '2px');
     49 test_math_used('sqrt(pow(sibling-index(), 2))', '4', {type: 'integer'});
     50 
     51 //Type checking hypot
     52 test_math_used('hypot(1px)', '1px');
     53 test_math_used('hypot(1cm)', '1cm');
     54 test_math_used('hypot(1mm)', '1mm');
     55 test_math_used('hypot(1Q)', '1Q');
     56 test_math_used('hypot(1in)', '1in');
     57 test_math_used('hypot(1pc)', '1pc');
     58 test_math_used('hypot(1pt)', '1pt');
     59 test_math_used('hypot(1em)', '1em');
     60 test_math_used('hypot(1ex)', '1ex');
     61 test_math_used('hypot(1ch)', '1ch');
     62 test_math_used('hypot(1rem)', '1rem');
     63 test_math_used('hypot(1vh)', '1vh');
     64 test_math_used('hypot(1vw)', '1vw');
     65 test_math_used('hypot(1vmin)', '1vmin');
     66 test_math_used('hypot(1vmax)', '1vmax');
     67 test_math_used('hypot(1s)', '1s', {type:'time'});
     68 test_math_used('hypot(1ms)', '1ms', {type:'time'});
     69 test_math_used('hypot(1deg)', '1deg', {type:'angle', approx:0.001});
     70 test_math_used('hypot(1grad)', '1grad', {type:'angle', approx:0.001});
     71 test_math_used('hypot(1rad)', '1rad', {type:'angle', approx:0.001});
     72 test_math_used('hypot(1turn)', '1turn', {type:'angle', approx:0.001});
     73 </script>