<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-values-4/#comp-func">
<link rel="help" href="https://drafts.csswg.org/css-values-4/#percentages">
<link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-type-checking">
<link rel="author" title="Xiaocheng Hu" href="mailto:xiaochengh@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../support/numeric-testcommon.js"></script>
<div id="container" style="width: 400px">
  <div id="target"></div>
</div>
<script>

// Identity tests
test_math_used('min(1%)', '1%');
test_math_used('max(1%)', '1%');

// Nestings
test_math_used('min(20%, max(10%, 15%))', '15%');
test_math_used('max(10%, min(20%, 15%))', '15%');

// General calculations
test_math_used('calc(min(10%, 20%) + 5%)', '15%');
test_math_used('calc(min(10%, 20%) - 5%)', '5%');
test_math_used('calc(min(10%, 20%) * 2)', '20%');
test_math_used('calc(min(10%, 20%) / 2)', '5%');
test_math_used('calc(max(10%, 20%) + 5%)', '25%');
test_math_used('calc(max(10%, 20%) - 5%)', '15%');
test_math_used('calc(max(10%, 20%) * 2)', '40%');
test_math_used('calc(max(10%, 20%) / 2)', '10%');
test_math_used('calc(min(10%, 20%) + max(10%, 5%))', '20%');
test_math_used('calc(min(11%, 20%) - max(10%, 5%))', '1%');
</script>
