Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7404431
FQTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
FQTest.php
View Options
<?php
namespace
MediaWiki\Extension\Math\Tests\WikiTexVC\Nodes
;
use
ArgumentCountError
;
use
MediaWiki\Extension\Math\WikiTexVC\MMLnodes\MMLmrow
;
use
MediaWiki\Extension\Math\WikiTexVC\Nodes\FQ
;
use
MediaWiki\Extension\Math\WikiTexVC\Nodes\Literal
;
use
MediaWiki\Extension\Math\WikiTexVC\Nodes\TexArray
;
use
MediaWikiUnitTestCase
;
use
TypeError
;
/**
* @covers \MediaWiki\Extension\Math\WikiTexVC\Nodes\FQ
*/
class
FQTest
extends
MediaWikiUnitTestCase
{
public
function
testEmptyFQ
()
{
$this
->
expectException
(
ArgumentCountError
::
class
);
new
FQ
();
throw
new
ArgumentCountError
(
'Should not create an empty fq'
);
}
public
function
testOneArgumentFQ
()
{
$this
->
expectException
(
ArgumentCountError
::
class
);
new
FQ
(
new
Literal
(
'a'
)
);
throw
new
ArgumentCountError
(
'Should not create a fq with one argument'
);
}
public
function
testIncorrectTypeFQ
()
{
$this
->
expectException
(
TypeError
::
class
);
new
FQ
(
'a'
,
'b'
,
'c'
);
throw
new
TypeError
(
'Should not create a fq with incorrect type'
);
}
public
function
testBasicFQ
()
{
$fq
=
new
FQ
(
new
Literal
(
'a'
),
new
Literal
(
'b'
),
new
Literal
(
'c'
)
);
$this
->
assertEquals
(
'a_{b}^{c}'
,
$fq
->
render
(),
'Should create a basic fq'
);
}
public
function
testGetters
()
{
$fq
=
new
FQ
(
new
Literal
(
'a'
),
new
Literal
(
'b'
),
new
Literal
(
'c'
)
);
$this
->
assertNotEmpty
(
$fq
->
getBase
()
);
$this
->
assertNotEmpty
(
$fq
->
getUp
()
);
$this
->
assertNotEmpty
(
$fq
->
getDown
()
);
}
public
function
testRenderEmptyFq
()
{
$fq
=
new
FQ
(
TexArray
::
newCurly
(),
new
Literal
(
'b'
),
new
Literal
(
'c'
)
);
$result
=
$fq
->
renderMML
();
$this
->
assertStringContainsString
(
'msubsup'
,
$result
);
$this
->
assertStringContainsString
(
(
new
MMLmrow
()
)->
getEmpty
(),
$result
);
}
public
function
testLatin
()
{
$fq
=
new
FQ
(
new
Literal
(
'a'
),
new
Literal
(
'b'
),
new
Literal
(
'c'
)
);
$this
->
assertStringContainsString
(
'msubsup'
,
$fq
->
renderMML
()
);
}
public
function
testSum
()
{
$fq
=
new
FQ
(
new
Literal
(
'
\s
um'
),
new
Literal
(
'b'
),
new
Literal
(
'c'
)
);
$this
->
assertStringContainsString
(
'munderover'
,
$fq
->
renderMML
()
);
}
public
function
testGreek
()
{
$fq
=
new
FQ
(
new
Literal
(
'
\\
alpha'
),
new
Literal
(
'b'
),
new
Literal
(
'c'
)
);
$this
->
assertStringContainsString
(
'msubsup'
,
$fq
->
renderMML
()
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Nov 21, 19:10 (1 d, 2 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
93/de/b6f385221cb4c5ba480599459886
Default Alt Text
FQTest.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment