mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-12-18 10:30:51 +00:00
dcce2100d0
composer: * mediawiki/mediawiki-codesniffer: 39.0.0 → 41.0.0 npm: * cookiejar: 2.1.3 → 2.1.4 * https://github.com/advisories/GHSA-h452-7996-h45h * http-cache-semantics: 4.1.0 → 4.1.1 * https://github.com/advisories/GHSA-rc47-6667-2j5j * ua-parser-js: 1.0.2 → 1.0.34 * https://github.com/advisories/GHSA-fhg7-m89q-25r3 Change-Id: I4198e1cbdc115d27c9fe5b8d0ce813b514524796
56 lines
1.2 KiB
PHP
56 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\Math\Tests\TexVC;
|
|
|
|
use MediaWiki\Extension\Math\TexVC\Parser;
|
|
use MediaWikiUnitTestCase;
|
|
|
|
/**
|
|
* @covers \MediaWiki\Extension\Math\TexVC\Parser
|
|
*/
|
|
class ParserTest extends MediaWikiUnitTestCase {
|
|
private $testCases;
|
|
private $parser;
|
|
|
|
protected function setUp(): void {
|
|
parent::setUp();
|
|
$this->parser = new Parser();
|
|
|
|
$this->testCases = [
|
|
[
|
|
'in' => '',
|
|
],
|
|
[
|
|
'in' => 'a',
|
|
],
|
|
[
|
|
'in' => 'a^2',
|
|
],
|
|
[
|
|
'in' => 'a^2+b^{2}',
|
|
],
|
|
[
|
|
'in' => 'l_a^2+l_b^2=l_c^2' ,
|
|
]
|
|
];
|
|
}
|
|
|
|
public function testSimpleParse() {
|
|
foreach ( $this->testCases as $case ) {
|
|
$this->parser->parse( $case['in'], [ 'debug' => true ] );
|
|
$this->assertTrue( true, 'Should parse: ' . $case['in'] );
|
|
}
|
|
}
|
|
|
|
public function testExample() {
|
|
$this->parser->parse( '\\sin(x)+{}{}\\cos(x)^2 newcommand', [ 'debug' => true ] );
|
|
$this->assertTrue( true, 'Should parse texVC example' );
|
|
}
|
|
|
|
public function testSpecific() {
|
|
$resultR = $this->parser->parse( '\\reals' );
|
|
$resultS = $this->parser->parse( '\\mathbb{R}' );
|
|
$this->assertEquals( $resultR, $resultS, 'Should parse texVC specific functions' );
|
|
}
|
|
}
|