Exemple #1
0
 /**
  * Funky test as float values get rounded when you clip digits and recreate
  * them so what we're doing is verifying the float that is regenerated
  * from the object results in the same 16 digit integer.
  */
 public function testToFloat()
 {
     $i = $this->testCount;
     do {
         $microtime = microtime(true);
         $m = Microtime::fromFloat($microtime);
         $f1 = substr(str_pad(str_replace('.', '', $microtime), 16, '0'), 0, 16);
         $f2 = substr(str_pad(str_replace('.', '', $m->toFloat()), 16, '0'), 0, 16);
         $this->assertSame($f1, $f2);
         --$i;
     } while ($i > 0);
 }