public function testWootID() { $id = new WootID(self::$SITE_ID, self::$CHAR_ID); $this->assertEquals(self::$SITE_ID, $id->getSiteID()); $this->assertEquals(self::$CHAR_ID, $id->getCharID()); for ($i = 0; $i < self::$NUM_RANDOM_TESTS; $i++) { do { $randSiteID = rand(0, 255); } while ($randSiteID == self::$SITE_ID); $randCharID = rand(0, 255); $randID = new WootID($randSiteID, $randCharID); $this->assertFalse($randID->equals($id)); $this->assertFalse($id->equals($randID)); if ($randSiteID < self::$SITE_ID) { $this->assertEquals(-1, $randID->compareTo($id)); $this->assertEquals(1, $id->compareTo($randID)); } else { if ($randSiteID > self::$SITE_ID) { $this->assertEquals(1, $randID->compareTo($id)); $this->assertEquals(-1, $id->compareTo($randID)); } } if ($randSiteID != self::$SITE_ID || $randCharID != self::$CHAR_ID) { $this->assertFalse($randID->equals($id)); } else { $this->assertTrue($randID->equals($id)); } $this->assertEquals(-1, $randID->compareTo(WootID::$IDE)); $this->assertEquals(1, $randID->compareTo(WootID::$IDB)); $this->assertEquals(-1, WootID::$IDB->compareTo($randID)); $this->assertEquals(1, WootID::$IDE->compareTo($randID)); } }