Optimize Test Parametrization

* For MMLGenTexVCUtilTest and the MMLComparator
* Also skip some inputs which are not supported

Bug: T327392
Change-Id: Ifac913e2b8e4c70c7222f769c0e7cf93e65de5b8
This commit is contained in:
Stegmujo 2023-02-03 13:52:39 +00:00
parent be8725c1d2
commit 5eba9b74a0
No known key found for this signature in database
GPG key ID: BB616B7CC84186BE
2 changed files with 15 additions and 3 deletions

View file

@ -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" ]
];
/**

View file

@ -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++;