From eec8e1ebb21f18914b5c43982f02f851fea6f146 Mon Sep 17 00:00:00 2001 From: Valentyn Kolesnikov Date: Fri, 22 Dec 2023 04:00:23 +0200 Subject: [PATCH] Fixed build --- composer.json | 7 ++++++- tests/SolutionTest.php | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 tests/SolutionTest.php diff --git a/composer.json b/composer.json index 03f47a4..54dfa9d 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,12 @@ "license": "MIT", "autoload": { "psr-4": { - "Javadev\\LeetCodePhp\\": "" + "\\": "Algorithms/s0001_two_sum" + } + }, + "autoload-dev": { + "psr-4": { + "\\": "tests" } }, "authors": [ diff --git a/tests/SolutionTest.php b/tests/SolutionTest.php new file mode 100644 index 0000000..9219f0a --- /dev/null +++ b/tests/SolutionTest.php @@ -0,0 +1,21 @@ +assertEquals([0, 1], (new Solution())->twoSum([2, 7, 11, 15], 9)); + } + + public function testTwoSum2() { + $this->assertEquals([1, 2], (new Solution())->twoSum([3, 2, 4], 6)); + } + + public function testTwoSum3() { + $this->assertEquals([0, 1], (new Solution())->twoSum([3, 3], 6)); + } + + public function testTwoSum4() { + $this->assertEquals([-1, -1], (new Solution())->twoSum([3, 3], 7)); + } +}