summaryrefslogtreecommitdiffstats
path: root/common/tests/HelpersTest.php
blob: 141e604b866bcb437fa871643d45c16cd94b5d69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php

use PHPUnit\Framework\TestCase;

class HelpersTest extends TestCase
{
    function test_constant_time_compare()
    {
        $this->assertTrue(_hash_equals('abc', 'abc'));
        $this->assertFalse(_hash_equals('abc', 'ab'));
        $this->assertFalse(_hash_equals('ab', 'abc'));
        $this->assertFalse(_hash_equals('abcd', 'adbc'));
        $this->assertFalse(_hash_equals(0, 0));
    }
}