@@ 39-46 (lines=8) @@ | ||
36 | $this->assertTrue($lexer->eof()); |
|
37 | } |
|
38 | ||
39 | public function testMultipliedUnits() { |
|
40 | $lexer = $this->createLexer('N * m'); |
|
41 | ||
42 | $this->assertEquals(new Token(Token::TYPE_UNIT, 'N'), $lexer->next()); |
|
43 | $this->assertEquals(new Operator('*', 1), $lexer->next()); |
|
44 | $this->assertEquals(new Token(Token::TYPE_UNIT, 'm'), $lexer->next()); |
|
45 | $this->assertTrue($lexer->eof()); |
|
46 | } |
|
47 | ||
48 | public function testDividedUnits() { |
|
49 | $lexer = $this->createLexer('m/s'); |
|
@@ 48-55 (lines=8) @@ | ||
45 | $this->assertTrue($lexer->eof()); |
|
46 | } |
|
47 | ||
48 | public function testDividedUnits() { |
|
49 | $lexer = $this->createLexer('m/s'); |
|
50 | ||
51 | $this->assertEquals(new Token(Token::TYPE_UNIT, 'm'), $lexer->next()); |
|
52 | $this->assertEquals(new Operator('/', 1), $lexer->next()); |
|
53 | $this->assertEquals(new Token(Token::TYPE_UNIT, 's'), $lexer->next()); |
|
54 | $this->assertTrue($lexer->eof()); |
|
55 | } |
|
56 | ||
57 | public function testExponentialUnit() { |
|
58 | $lexer = $this->createLexer('m^2'); |
|
@@ 57-64 (lines=8) @@ | ||
54 | $this->assertTrue($lexer->eof()); |
|
55 | } |
|
56 | ||
57 | public function testExponentialUnit() { |
|
58 | $lexer = $this->createLexer('m^2'); |
|
59 | ||
60 | $this->assertEquals(new Token(Token::TYPE_UNIT, 'm'), $lexer->next()); |
|
61 | $this->assertEquals(new Operator('^', 2), $lexer->next()); |
|
62 | $this->assertEquals(new Token(Token::TYPE_DIGIT, '2'), $lexer->next()); |
|
63 | $this->assertTrue($lexer->eof()); |
|
64 | } |
|
65 | ||
66 | public function testExponentialUnits() { |
|
67 | $lexer = $this->createLexer('m^2/s'); |