From 583f43e1f7e9e05f2418d6b8ef8e36f85c40c9e4 Mon Sep 17 00:00:00 2001 From: belliash Date: Sat, 13 Apr 2019 14:37:04 +0200 Subject: [PATCH] Convert carriage return and line feed to line feed (UNIX line ending). --- tests/anon_filter.aer | 56 ++++++++++++++++---------------- tests/center_text.aer | 6 ++-- tests/closure_test.aer | 72 +++++++++++++++++++++--------------------- tests/static_var.aer | 48 ++++++++++++++-------------- 4 files changed, 91 insertions(+), 91 deletions(-) diff --git a/tests/anon_filter.aer b/tests/anon_filter.aer index 88c529d..bf94872 100644 --- a/tests/anon_filter.aer +++ b/tests/anon_filter.aer @@ -1,28 +1,28 @@ -class Program { - private callback $condition = bool(int $x) { return ($x > 100); }; - private int[] $numbers = {34, 56, 22, 1, 5, 67, 897, 123, 55, 101}; - - int[] filter(callback $condition, int[] $numbers) { - int $len = sizeof($numbers); - int[] $filtered; - for(int $i = 0; $i < $len; $i++) { - if($condition($numbers[$i])) { - $filtered[] = $numbers[$i]; - } - } - return $filtered; - } - - void main() { - int[] $filtered = $this->filter($this->condition, $this->numbers); - var_dump($filtered); - } - -} - - -/* - * Should output - -Array ( [0] => 897 [1] => 123 ) -*/ +class Program { + private callback $condition = bool(int $x) { return ($x > 100); }; + private int[] $numbers = {34, 56, 22, 1, 5, 67, 897, 123, 55, 101}; + + int[] filter(callback $condition, int[] $numbers) { + int $len = sizeof($numbers); + int[] $filtered; + for(int $i = 0; $i < $len; $i++) { + if($condition($numbers[$i])) { + $filtered[] = $numbers[$i]; + } + } + return $filtered; + } + + void main() { + int[] $filtered = $this->filter($this->condition, $this->numbers); + var_dump($filtered); + } + +} + + +/* + * Should output + +Array ( [0] => 897 [1] => 123 ) +*/ diff --git a/tests/center_text.aer b/tests/center_text.aer index 636431b..93267a2 100644 --- a/tests/center_text.aer +++ b/tests/center_text.aer @@ -23,6 +23,6 @@ class Program { } -/* Should output ----------------This is some text------------ -*/ +/* Should output +---------------This is some text------------ +*/ diff --git a/tests/closure_test.aer b/tests/closure_test.aer index 34886da..6f6a470 100644 --- a/tests/closure_test.aer +++ b/tests/closure_test.aer @@ -1,36 +1,36 @@ -class Operations { - - public callback ops(int $x, int $y, string $op){ - switch($op) { - case 'ADD': - return int() using ($x, $y) { - return $x + $y; - }; - break; - case 'SUB': - return int() using ($x, $y) { - return $x - $y; - }; - break; - default: - return string() { - return 'Operation is not supported by class.'; - }; - } - } -} - -class Program { - - void main() { - callback $fn; - object $op = new Operations(); - $fn = $op->ops(6, 7, 'ADD'); - print($fn() + "\n"); - $fn = $op->ops(6, 2, 'SUB'); - print($fn() + "\n"); - $fn = $op->ops(6, 7, 'MUL'); - print($fn() + "\n"); - } - -} +class Operations { + + public callback ops(int $x, int $y, string $op){ + switch($op) { + case 'ADD': + return int() using ($x, $y) { + return $x + $y; + }; + break; + case 'SUB': + return int() using ($x, $y) { + return $x - $y; + }; + break; + default: + return string() { + return 'Operation is not supported by class.'; + }; + } + } +} + +class Program { + + void main() { + callback $fn; + object $op = new Operations(); + $fn = $op->ops(6, 7, 'ADD'); + print($fn() + "\n"); + $fn = $op->ops(6, 2, 'SUB'); + print($fn() + "\n"); + $fn = $op->ops(6, 7, 'MUL'); + print($fn() + "\n"); + } + +} diff --git a/tests/static_var.aer b/tests/static_var.aer index 3c6817e..7d4a519 100644 --- a/tests/static_var.aer +++ b/tests/static_var.aer @@ -1,25 +1,25 @@ -class Program { - - string cycle(char $a, char $b, int $i = 0) { - static char[] $switches; - if($switches[$i]) - $switches[$i] = !$switches[$i]; - else - !($switches[$i] = true); - return ($switches[$i]) ? $a : $b; - } - - void main() { +class Program { + + string cycle(char $a, char $b, int $i = 0) { + static char[] $switches; + if($switches[$i]) + $switches[$i] = !$switches[$i]; + else + !($switches[$i] = true); + return ($switches[$i]) ? $a : $b; + } + + void main() { int $i, $j, $k; - for($i = 1; $i < 3; $i++) { - print($i + $this->cycle('a', 'b') + PHP_EOL); - for($j = 1; $j < 5; $j++) { - print(' ' + $j + $this->cycle('a', 'b', 1) + PHP_EOL); - for($k = 1; $k < 3; $k++) { - print(' ' + $k + $this->cycle('c', 'd', 2) + PHP_EOL); - } - } - } - } - -} + for($i = 1; $i < 3; $i++) { + print($i + $this->cycle('a', 'b') + PHP_EOL); + for($j = 1; $j < 5; $j++) { + print(' ' + $j + $this->cycle('a', 'b', 1) + PHP_EOL); + for($k = 1; $k < 3; $k++) { + print(' ' + $k + $this->cycle('c', 'd', 2) + PHP_EOL); + } + } + } + } + +}