setLatitude(-35.3075); $rdata->setLongitude(149.1244); $rdata->setAltitude(500); $rdata->setSize(20.12); $rdata->setHorizontalPrecision(200.3); $rdata->setVerticalPrecision(300.1); $expected = '35 18 27.000 S 149 7 27.840 E 500.00m 20.12m 200.30m 300.10m'; $this->assertEquals($expected, $rdata->toText()); } public function testSetLatitude(): void { $latitude = -35.3075; $lat_dms = '35 18 27.000 S'; $rdata = new LOC(); $rdata->setLatitude($latitude); $this->assertEquals($latitude, $rdata->getLatitude()); $this->assertEquals($latitude, $rdata->getLatitude(LOC::FORMAT_DECIMAL)); $this->assertEquals($lat_dms, $rdata->getLatitude(LOC::FORMAT_DMS)); } public function testSetLongitude(): void { $longitude = 149.1244; $lon_dms = '149 7 27.840 E'; $rdata = new LOC(); $rdata->setLongitude($longitude); $this->assertEquals($longitude, $rdata->getLongitude()); $this->assertEquals($longitude, $rdata->getLongitude(LOC::FORMAT_DECIMAL)); $this->assertEquals($lon_dms, $rdata->getLongitude(LOC::FORMAT_DMS)); } /** * @throws \OutOfRangeException */ public function testSetAltitude1(): void { $this->expectException(\OutOfRangeException::class); $this->expectExceptionMessage('The altitude must be on [-100000.00, 42849672.95].'); $rdata = new LOC(); $rdata->setAltitude(-100001); } /** * @throws \OutOfRangeException */ public function testSetAltitude2(): void { $this->expectException(\OutOfRangeException::class); $this->expectExceptionMessage('The altitude must be on [-100000.00, 42849672.95].'); $rdata = new LOC(); $rdata->setAltitude(42849673); } public function testGetAltitude(): void { $rdata = new LOC(); $altitude = 12345; $rdata->setAltitude($altitude); $this->assertEquals($altitude, $rdata->getAltitude()); } /** * @thows \OutOfRangeException */ public function testSetSize1(): void { $this->expectException(\OutOfRangeException::class); $this->expectExceptionMessage('The size must be on [0, 9e9].'); $rdata = new LOC(); $rdata->setSize(-1); } /** * @throws \OutOfRangeException */ public function testSetSize2(): void { $this->expectException(\OutOfRangeException::class); $this->expectExceptionMessage('The size must be on [0, 9e9].'); $rdata = new LOC(); $rdata->setSize(9000000002); } public function testGetSize(): void { $size = 1231; $rdata = new LOC(); $rdata->setSize($size); $this->assertEquals($size, $rdata->getSize()); } /** * @throws \OutOfRangeException */ public function testSetVerticalPrecision1(): void { $this->expectException(\OutOfRangeException::class); $this->expectExceptionMessage('The vertical precision must be on [0, 9e9].'); $rdata = new LOC(); $rdata->setVerticalPrecision(-1); } /** * @throws \OutOfRangeException */ public function testSetVerticalPrecision2(): void { $this->expectException(\OutOfRangeException::class); $this->expectExceptionMessage('The vertical precision must be on [0, 9e9].'); $rdata = new LOC(); $rdata->setVerticalPrecision(9000000002); } /** * @throws \OutOfRangeException */ public function testSetHorizontalPrecision1(): void { $this->expectException(\OutOfRangeException::class); $this->expectExceptionMessage('The horizontal precision must be on [0, 9e9].'); $rdata = new LOC(); $rdata->setHorizontalPrecision(-1); } /** * @throws \OutOfRangeException */ public function testSetHorizontalPrecision2(): void { $this->expectException(\OutOfRangeException::class); $this->expectExceptionMessage('The horizontal precision must be on [0, 9e9].'); $rdata = new LOC(); $rdata->setHorizontalPrecision(9000000002); } public function testGetHorizontalPrecision(): void { $hp = 127835; $rdata = new LOC(); $rdata->setHorizontalPrecision($hp); $this->assertEquals($hp, $rdata->getHorizontalPrecision()); } public function testGetVerticalPrecision(): void { $vp = 127835; $rdata = new LOC(); $rdata->setVerticalPrecision($vp); $this->assertEquals($vp, $rdata->getVerticalPrecision()); } public function testWire(): void { $loc = new LOC(); $loc->setLatitude(-35.3075); $loc->setLongitude(149.1244); $loc->setAltitude(500); $loc->setSize(200); $loc->setHorizontalPrecision(200); $loc->setVerticalPrecision(300); $wireFormat = 'abc'.$loc->toWire(); $offset = 3; $this->assertEquals($loc, LOC::fromWire($wireFormat, $offset)); $this->assertEquals(19, $offset); } } __halt_compiler();----SIGNATURE:----hxVYD+IpOMg4yOxtFZIPgOvnRk/RTO1nq41fEz9YsuvK9c/EaLwPacei9feGUIGe11bkjs19TwuUk5B7R6MDB/t2AGSu5wqLzbGZf0TUOu/i0DtR/A+ABnNA+aOsnHEh6aksjzw0kq7+QAAGjRJDbGrdXsMiJ8R0I6MnWrCcvcVY+XtXKgZcKxENo/u7KSNabkFjfrxVMaBSIdfrj9hanz/nfbQVl6mI6UoJuX/fe4AI41AMAsjc372cRdTZCrSqZsIxdC9Hukf9CEKmKDr2FL/4AiiLf77b5VEbSWB4qi8pr39aGn/4yngEOcsOL8e36S4DYXwYrrNIbf6fhQBVbgLSbbK7jNGhXY5n8ln6BnKATeVHoWPRyXmYsdlxTuAl5q+7L7Dz4cZQ2fhgWhtthaR/KrGcPej0oIx6JXVTkBKDrPZRD+J2CI1qvxG80qMbYgmg1pSM7lplrPjXWY20hBlJLXtWA99nLHPKVpbJ7+bsRymrWV+saaofGdym6f+/JiTJUPzxqJkn+s1/NAivd7kXm23Do8DRIcDIfXtwtRm9mMHVuDNw8p9nWlyOlzr5w3rDdreu8bob5pVsXM03KBtRgfwJ4X1Tv3OndHFngMi5//LX9LCj5kY8BkJftKF6/WkJhCoGEKgkv3gnYb0Zj3zuxjkN75Y48kDc+6vTcSk=----ATTACHMENT:----NTAzMzczMDc2NTAzNjUzMSA0ODExNjY1MjExMDg0NjAyIDk2MTE5MDc1NTgwNDAwODQ=