From 6a74bf9e8b0767eb1f50445a57b4369fd5c36628 Mon Sep 17 00:00:00 2001 From: belliash Date: Thu, 7 Feb 2019 18:23:37 +0100 Subject: [PATCH] Test if method overloading is working properly. --- tests/overloading_methods.aer | 16 ++++++++++++++++ tests/overloading_methods.exp | 2 ++ 2 files changed, 18 insertions(+) create mode 100644 tests/overloading_methods.aer create mode 100644 tests/overloading_methods.exp diff --git a/tests/overloading_methods.aer b/tests/overloading_methods.aer new file mode 100644 index 0000000..cc45c09 --- /dev/null +++ b/tests/overloading_methods.aer @@ -0,0 +1,16 @@ +class Program { + + function count(int $a, int $b) { + print("Counting 2 integers: $a + $b = ", $a + $b, "\n"); + } + + function count(float $a, float $b) { + print("Counting 2 floats: $a + $b = ", $a + $b, "\n"); + } + + function main() { + $this->count(4.3, 5.7); + $this->count(6, 4); + } + +} diff --git a/tests/overloading_methods.exp b/tests/overloading_methods.exp new file mode 100644 index 0000000..bfc9055 --- /dev/null +++ b/tests/overloading_methods.exp @@ -0,0 +1,2 @@ +Counting 2 floats: 4.3 + 5.7 = 10 +Counting 2 integers: 6 + 4 = 10