Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 2025

Přidáno uživatelem David Raška před více než 11 roky(ů)

Upravy:
- Zrychleni unit testu

Zobrazit rozdíly:

freenetis/branches/1.1/tests/application/libraries/variable_key_generators/Checksum_Variable_Key_GeneratorTest.php
}
/**
* Test uniqe keys for member IDs 0 - 999999
* Test uniqe keys for member IDs
* @covers Parity_Variable_Key_Generator::generate
*/
public function testGenerate() {
$variable_symbols = array();
$variable_symbols_bottom = array();
for ($i = 0; $i < 999999; $i++)
for ($i = 0; $i < 29999; $i++)
{
$vs = $this->object->generate(strval($i));
$variable_symbols[$vs] = true;
$this->assertEquals(count($variable_symbols), $i+1);
$variable_symbols_bottom[$vs] = true;
}
$this->assertEquals(count($variable_symbols_bottom), 29999);
$variable_symbols_top = array();
for ($i = 990000; $i < 999999; $i++)
{
$vs = $this->object->generate(strval($i));
$variable_symbols_top[$vs] = true;
}
$this->assertEquals(count($variable_symbols_top), 9999);
$variable_symbols_middle = array();
$seed = rand(30000, 269999);
for ($i = $seed; $i < $seed + 9999; $i++)
{
$vs = $this->object->generate(strval($i));
$variable_symbols_middle[$vs] = true;
}
$this->assertEquals(count($variable_symbols_middle), 9999);
$vs = array_merge($variable_symbols_bottom, $variable_symbols_middle, $variable_symbols_top);
$this->assertEquals(count($vs), 49997);
}
/**

Také k dispozici: Unified diff