<?php

namespace App\Tests;

use App\ThreeSumClosest;
use PHPUnit\Framework\TestCase;

class ThreeSumClosestTest extends TestCase
{
    /** @dataProvider threeSumClosestProvider */
    public function testThreeSumClosest(array $nums, int $target, int $expected): void
    {
        $threeSumClosest = new ThreeSumClosest();
        $result = $threeSumClosest->threeSumClosest($nums, $target);
        $this->assertEquals($expected, $result);
    }

    public function threeSumClosestProvider(): array
    {
        return [
            [[524,428,969,-868,223,333,986,-553,-519,967,-392,709,82,-819,-188,-416,-359,477,-622,-912,-883,3,-278,-265,-195,791,-515,183,-239,-817,764,576,804,647,-743,-766,-642,461,-313,-90,4,882,-933,-921,-24,74,892,578,234,621,-825,806,192,227,-495,585,236,259,-384,873,456,182,93,33,-298,579,240,-922,980,-68,110,855,786,-814,924,-305,-217,-198,-64,634,686,-295,943,-140,-852,-460,190,-907,-311,584,545,-920,-366,902,-446,64,-676,702,-928,-17,-666,766,-493,-249,922,-910,673,-847,-338,-139,-831,-40,-873,271,-913,-448,57,-853,653,-560,-484,668,118,-601,-882,-414,-432,497,349,-605,-881,-324,-488,-443,663,558,684,996,-675,114,441,-144,815,281,286,505,-502,-457,216,678,-353,249,488,-347,-972,-555,-963,-860,87,112,-981,119,-141,834,587,511,-420,816,-838,194,-340,-996,-951,-717,45,-88,-636,-152,-662,-565,-872,-38,507,-76,606,490,-69,-247,-431,1,-777,-201,-52,-56,666,682,-160,174,941,478,178,-916,-832,911,-264,760,-463,-60,-516,-154,763,-762,-808,-850,129,-150,-641,564,649,52,-6,-309,83,655,780,769,388,-287,435,218,727,737,844,777,-528,-72,-781,439,885,-98,-44,-952,-325,-350,-966,650,-930,-388,494,630,313,-480,616,472,399,172,-290,24,669,-215,-504,761,486,-525,75,-131,-656,-979,916,-604,204,-684,-344,904,-619,370,-173,-2,-828,504,-505,-965,-811,221,-49,944,-499,-181,-301,250,753,384,-233,168,344,326,-580,202,39,-857,159,-97,-430,-452,433,256,-582,-165,235,73,-358,-608,871,957,954,-169,907,595,-986,-783,406,-481,-253,792,11], 7651, 2962],
            [[777,286,-518,749,965,-15,497,566,683,-231,381,-9,930,510,-161,-431,307,-288,-643,-198,556,-576,757,-777,-994,-953,-908,-890,-92,561,-333,905,-881,-387,-247,-326,-654,-116,213,577,66,236,-179,373,698,-230,602,337,-669,798,-771,-395,717,459,174,-457,-452,414,-526,253,-782,962,-279,-13,693,886,422,146,-906,932,-818,-710,30,-405,-347,-964,621,678,-1,835,68,-623,-37,309,136,-496,-909,593,481,-786,825,-660,423,370,-376,694,88,79,896,503,-358,-289,143,780,-225,440,-989,544,622,775,-810,229,574,-218,961,-736,-806,-950,-907,-143,-998,-3,-944,-409,813,-493,-715,-205,807,-569,-521,-800,729,-523,-160,119,372,-857,121,255,-886,-41,-27,827,-95,127,767,-653,771,-480,-776,446,-276,506,-889,458,-80,953,746,797,-735,625,-933,-488,726,513,571,124,955,-769,-897,94,171,-157,525,913,-713,70,-823,711,679,380,281,-839,901,-359,319,-281,-194,514,671,-261,861,974,-490,467,328,-427,368,-228,764,2,182,-234,-841,677,271,-468,740,433,-371,-236,613,-617,-372,952,-796,543,776,-522,-478,-914,929,-259,-48,-840,-570,-297,-747,-675,103,461,387,34,67,724,118,539,-323,138,-820,290,230,737,730,-716,-700,-987,-88,-535,-960,-305,-365,-838,580,-882,979,-600,487,938,-783,-135,547,183,-665,-291,277,187,-287,212,202,657,-193,700,-726,603,246,651,304,-741,-590,209,-528,233,-828,778,900,-799,639,894,-658,795,-126,-325,-550,-336,270,681,-472,-749,-191,455,-879,421,-122,44,-133,-666,809,-211,633,-602], -7843, -2981],
            [[-1,2,1,-4], 1, 2],
            [[1,2,3,4,5,6,7,8,9,20], 33, 33],
            [[0,0,0], 1, 0]
        ];
    }
}
