| @@ 27-39 (lines=13) @@ | ||
| 24 | $this->assertEquals(new UnitASTNode('kg'), $node); |
|
| 25 | } |
|
| 26 | ||
| 27 | public function testMultipliedUnits() { |
|
| 28 | $parser = $this->createParser('N * m'); |
|
| 29 | ||
| 30 | $node = $parser->parse(); |
|
| 31 | $this->assertEquals( |
|
| 32 | new BinaryOperatorASTNode( |
|
| 33 | '*', |
|
| 34 | new UnitASTNode('N'), |
|
| 35 | new UnitASTNode('m') |
|
| 36 | ), |
|
| 37 | $node |
|
| 38 | ); |
|
| 39 | } |
|
| 40 | ||
| 41 | public function testDividedUnits() { |
|
| 42 | $parser = $this->createParser('m/s'); |
|
| @@ 41-53 (lines=13) @@ | ||
| 38 | ); |
|
| 39 | } |
|
| 40 | ||
| 41 | public function testDividedUnits() { |
|
| 42 | $parser = $this->createParser('m/s'); |
|
| 43 | ||
| 44 | $node = $parser->parse(); |
|
| 45 | $this->assertEquals( |
|
| 46 | new BinaryOperatorASTNode( |
|
| 47 | '/', |
|
| 48 | new UnitASTNode('m'), |
|
| 49 | new UnitASTNode('s') |
|
| 50 | ), |
|
| 51 | $node |
|
| 52 | ); |
|
| 53 | } |
|
| 54 | ||
| 55 | public function testExponentialUnit() { |
|
| 56 | $parser = $this->createParser('m^2'); |
|
| @@ 55-67 (lines=13) @@ | ||
| 52 | ); |
|
| 53 | } |
|
| 54 | ||
| 55 | public function testExponentialUnit() { |
|
| 56 | $parser = $this->createParser('m^2'); |
|
| 57 | ||
| 58 | $node = $parser->parse(); |
|
| 59 | $this->assertEquals( |
|
| 60 | new BinaryOperatorASTNode( |
|
| 61 | '^', |
|
| 62 | new UnitASTNode('m'), |
|
| 63 | new DigitASTNode('2') |
|
| 64 | ), |
|
| 65 | $node |
|
| 66 | ); |
|
| 67 | } |
|
| 68 | ||
| 69 | public function testExponentialUnits() { |
|
| 70 | $parser = $this->createParser('m^2/s'); |
|