repl.it
@acwoss/

WarmWarpedRatfish

PHP (Legacy)

No description

fork
loading
main.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// [[$a, $b, $c], $expected]
$tests = [
  [[1, 2, 3], false], // a < b < c, erro!
  [[1, 3, 2], false], // a < b > c, erro!
  [[2, 1, 3], false], // a > b < c, erro!
  [[3, 2, 1], true],  // a > b > c, ok!
  [[1, 1, 1], false], // a = b = c, erro!
  [[2, 2, 1], false], // a = b > c, erro!
  [[2, 1, 1], false], // a > b = c, erro!
  [[2, 1, 2], false]  // a > b < c, erro!
];

foreach($tests as $i => $test)
{
  list($curva_a, $curva_b, $curva_c) = $test[0];
  $expected = $test[1];
  
  assert(($curva_a <= $curva_b || $curva_b <= $curva_c) == !$expected, "Erro no teste {$i}");
}
PHP 7.0.8 (Legacy: use the following for new features: Command-line PHP: https://repl.it/languages/php_cli PHP Web Server: https://repl.it/languages/php7