From 5eba9b74a076f2327ee237d4e23d9cc780303ee7 Mon Sep 17 00:00:00 2001 From: Stegmujo Date: Fri, 3 Feb 2023 13:52:39 +0000 Subject: [PATCH] Optimize Test Parametrization * For MMLGenTexVCUtilTest and the MMLComparator * Also skip some inputs which are not supported Bug: T327392 Change-Id: Ifac913e2b8e4c70c7222f769c0e7cf93e65de5b8 --- tests/phpunit/unit/TexVC/MMLComparator.php | 5 +++-- .../phpunit/unit/TexVC/MMLGenerationTexUtilTest.php | 13 ++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/unit/TexVC/MMLComparator.php b/tests/phpunit/unit/TexVC/MMLComparator.php index f6f8f686e..7abebf823 100644 --- a/tests/phpunit/unit/TexVC/MMLComparator.php +++ b/tests/phpunit/unit/TexVC/MMLComparator.php @@ -37,8 +37,9 @@ class MMLComparator { private const IGNOREDATTRIBUTES = [ "mrow" => [ "class", "data-mjx-texclass" ], "math" => [ "alttext", "display" ], - "mi" => [ "class", "data-mjx-variant", "data-mjx-texclass", ], - "mo" => [ "data-mjx-pseudoscript", "stretchy", "fence", "data-mjx-texclass", "texClass" ] + "mi" => [ "class", "data-mjx-variant", "mathvariant", "data-mjx-texclass", "data-mjx-alternate" ], + "mo" => [ "data-mjx-pseudoscript", "stretchy", "fence", "data-mjx-texclass", "texClass", "class", + "data-mjx-alternate", "form", "accent" ] ]; /** diff --git a/tests/phpunit/unit/TexVC/MMLGenerationTexUtilTest.php b/tests/phpunit/unit/TexVC/MMLGenerationTexUtilTest.php index ab2be6231..e18b88b3f 100644 --- a/tests/phpunit/unit/TexVC/MMLGenerationTexUtilTest.php +++ b/tests/phpunit/unit/TexVC/MMLGenerationTexUtilTest.php @@ -32,17 +32,26 @@ class MMLGenerationTexUtilTest extends MediaWikiUnitTestCase { private static $FILTERSTART = 15; private static $FILTERLENGTH = 1; - private static $GENERATEHTML = true; + private static $GENERATEHTML = false; private static $GENERATEDHTMLFILE = __DIR__ . "/MMLGenerationTexUtilTest-Output.html"; private static $MMLREFFILE = __DIR__ . "/TexUtil-Ref.json"; /** @var bool export the updated TexUtil-Tex to "./ExportedTexUtilKeys.json" */ private static $EXPORT_KEYS = false; + private static $SKIPPEDINDICES = [ 15,33,382,553 ]; + /** * @dataProvider provideTestCases */ public function testTexVC( $title, $input ) { + if ( in_array( $input->ctr, self::$SKIPPEDINDICES ) ) { + MMLTestUtilHTML::generateHTMLtableRow( self::$GENERATEDHTMLFILE, [ $title, $input->tex, $input->mmlLaTeXML, + $input->mmlMathoid, "skipped", "skipped" ], false, self::$GENERATEHTML ); + $this->assertTrue( true ); + return; + } + $texVC = new TexVC(); $useMHChem = self::getMHChem( $title ); @@ -210,6 +219,8 @@ class MMLGenerationTexUtilTest extends MediaWikiUnitTestCase { foreach ( $group as $case ) { $title = "set#" . $overAllCtr . ": " . $category . $indexCtr; $finalCase = $refAssociative[$case] ?? $case; + $finalCase->ctr = $overAllCtr; + $finalCases[$title] = [ $title, $finalCase ]; $indexCtr++; $overAllCtr++;