智慧教务系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

41 lines
1.9 KiB

<?php
declare(strict_types=1);
namespace Location\Direction;
use Location\Coordinate;
use PHPUnit\Framework\TestCase;
class DirectionTest extends TestCase
{
public function testIsNorthOf(): void
{
$this->assertTrue((new Direction())->pointIsNorthOf(new Coordinate(50, 13), new Coordinate(40, 10)));
$this->assertTrue((new Direction())->pointIsNorthOf(new Coordinate(-50, 13), new Coordinate(-60, 10)));
$this->assertTrue((new Direction())->pointIsNorthOf(new Coordinate(10, 13), new Coordinate(-40, 10)));
}
public function testIsSouthOf(): void
{
$this->assertTrue((new Direction())->pointIsSouthOf(new Coordinate(40, 10), new Coordinate(50, 13)));
$this->assertTrue((new Direction())->pointIsSouthOf(new Coordinate(-60, 10), new Coordinate(-50, 13)));
$this->assertTrue((new Direction())->pointIsSouthOf(new Coordinate(-40, 10), new Coordinate(10, 13)));
}
public function testIsWestOf(): void
{
$this->assertTrue((new Direction())->pointIsWestOf(new Coordinate(40, 10), new Coordinate(50, 13)));
$this->assertTrue((new Direction())->pointIsWestOf(new Coordinate(-60, -10), new Coordinate(-50, -3)));
$this->assertTrue((new Direction())->pointIsWestOf(new Coordinate(-40, -100), new Coordinate(10, 130)));
$this->assertTrue((new Direction())->pointIsWestOf(new Coordinate(-40, -179), new Coordinate(10, 179)));
}
public function testIsEastOf(): void
{
$this->assertTrue((new Direction())->pointIsEastOf(new Coordinate(50, 13), new Coordinate(40, 10)));
$this->assertTrue((new Direction())->pointIsEastOf(new Coordinate(-50, -3), new Coordinate(-60, -10)));
$this->assertTrue((new Direction())->pointIsEastOf(new Coordinate(10, 130), new Coordinate(-40, -100)));
$this->assertTrue((new Direction())->pointIsEastOf(new Coordinate(10, 179), new Coordinate(-40, -179)));
}
}