fork download
  1. <?php
  2.  
  3. // [[$a, $b, $c], $expected]
  4. $tests = [
  5. [[1, 2, 3], false], // a < b < c, erro!
  6. [[1, 3, 2], false], // a < b > c, erro!
  7. [[2, 1, 3], false], // a > b < c, erro!
  8. [[3, 2, 1], true], // a > b > c, ok!
  9. [[1, 1, 1], false], // a = b = c, erro!
  10. [[2, 2, 1], false], // a = b > c, erro!
  11. [[2, 1, 1], false], // a > b = c, erro!
  12. [[2, 1, 2], false] // a > b < c, erro!
  13. ];
  14.  
  15. foreach($tests as $i => $test)
  16. {
  17. list($curva_a, $curva_b, $curva_c) = $test[0];
  18. $expected = $test[1];
  19.  
  20. assert(($curva_a <= $curva_b || $curva_b <= $curva_c) == !$expected, "Erro no teste {$i}");
  21. }
Success #stdin #stdout 0.01s 82880KB
stdin
Standard input is empty
stdout
Standard output is empty