Code Duplication    Length = 10-10 lines in 4 locations

tests/StatisticsTest.php 4 locations

@@ 351-360 (lines=10) @@
348
     *
349
     * @return void
350
     */
351
    public function testVariancePopulationIntegers()
352
    {
353
        $values = [2, 4, 4, 4, 5, 5, 7, 9];
354
        $sample = false;
355
356
        $result = Statistics::variance($values, $sample);
357
        $expected = 4;
358
359
        $this->assertSame($expected, $result);
360
    }
361
362
    /**
363
     * Tests `variance`.
@@ 419-428 (lines=10) @@
416
     *
417
     * @return void
418
     */
419
    public function testStandardDeviationSampleFloats()
420
    {
421
        $values = [1.5, 2.5, 2.5, 2.75, 3.25, 4.75];
422
        $sample = true;
423
424
        $result = Statistics::standardDeviation($values, $sample);
425
        $expected = 1.081087;
426
427
        $this->assertEquals($expected, $result, '', pow(10, -4));
428
    }
429
430
    /**
431
     * Tests `standardDeviation`.
@@ 437-446 (lines=10) @@
434
     *
435
     * @return void
436
     */
437
    public function testStandardDeviationPopulationIntegers()
438
    {
439
        $values = [2, 4, 4, 4, 5, 5, 7, 9];
440
        $sample = false;
441
442
        $result = Statistics::standardDeviation($values, $sample);
443
        $expected = 2.0;
444
445
        $this->assertSame($expected, $result);
446
    }
447
448
    /**
449
     * Tests `standardDeviation`.
@@ 455-464 (lines=10) @@
452
     *
453
     * @return void
454
     */
455
    public function testStandardDeviationPopulationFloats()
456
    {
457
        $values = [1.5, 2.5, 2.5, 2.75, 3.25, 4.75];
458
        $sample = false;
459
460
        $result = Statistics::standardDeviation($values, $sample);
461
        $expected = 0.9868;
462
463
        $this->assertEquals($expected, $result, '', pow(10, -4));
464
    }
465
466
    /**
467
     * Tests `range`.