use crate::common::*;
#[test]
fn modified_vars() {
let expr = "<math> <mrow>
<mover> <mi>a</mi> <mo>`</mo> </mover>
<mover> <mi>b</mi> <mo>~</mo> </mover>
<mover> <mi>c</mi> <mo>̆</mo> </mover>
<mover> <mi>b</mi> <mo>̌</mo> </mover>
<mover> <mi>c</mi> <mo>`</mo> </mover> <mo>+</mo>
<mover> <mi>x</mi> <mo>.</mo> </mover>
<mover> <mi>y</mi> <mo>˙</mo> </mover>
<mover> <mi>z</mi> <mo>¨</mo> </mover>
<mover> <mi>u</mi> <mo>⃛</mo> </mover>
<mover> <mi>v</mi> <mo>⃜</mo> </mover> <mo>+</mo>
<mover> <mi>x</mi> <mo>^</mo> </mover> <mo>+</mo>
<mover> <mi>t</mi> <mo>→</mo> </mover>
</mrow> </math>";
test("zh-tw", "SimpleSpeak", expr,
"a grave, b tilde, c breve, b check, c grave; 加; \
x 點, y dot, z double dot, u triple dot, v quadruple dot; 加 x hat, 加 向量 t");
}
#[test]
fn limit() {
let expr = "<math>
<munder>
<mo>lim</mo>
<mrow> <mi>x</mi> <mo>→</mo> <mn>0</mn> </mrow>
</munder>
<mrow>
<mfrac>
<mrow> <mi>sin</mi> <mo>⁡</mo> <mi>x</mi> </mrow>
<mi>x</mi>
</mfrac>
</mrow>
</math>";
test("zh-tw", "SimpleSpeak", expr, "極限 x 趨近 0; 分數 x 分之, sine x 結束分數");
}
#[test]
fn limit_from_below() {
let expr = "<math>
<munder>
<mo>lim</mo>
<mrow> <mi>x</mi> <mo>↗</mo> <mn>0</mn> </mrow>
</munder>
<mrow>
<mrow> <mi>sin</mi> <mo>⁡</mo> <mi>x</mi> </mrow>
</mrow>
</math>";
test("zh-tw", "SimpleSpeak", expr, "極限 x 從下方趨近 0; sine x");
}
#[test]
fn binomial_mmultiscripts() {
let expr = "<math><mmultiscripts><mi>C</mi><mi>m</mi><none/><mprescripts/><mi>n</mi><none/></mmultiscripts></math>";
test("zh-tw", "SimpleSpeak", expr, "n 選 m");
}
#[test]
fn permutation_mmultiscripts() {
let expr = "<math><mmultiscripts><mi>P</mi><mi>k</mi><none/><mprescripts/><mi>n</mi><none/></mmultiscripts></math>";
test("zh-tw", "SimpleSpeak", expr, "n 排列 k");
}
#[test]
fn permutation_mmultiscripts_sup() {
let expr = "<math><mmultiscripts><mi>P</mi><mi>k</mi><none/><mprescripts/><none/><mi>n</mi></mmultiscripts></math>";
test("zh-tw", "SimpleSpeak", expr, "n 排列 k");
}
#[test]
fn permutation_msubsup() {
let expr = "<math><msubsup><mi>P</mi><mi>k</mi><mi>n</mi></msubsup></math>";
test("zh-tw", "SimpleSpeak", expr, "n 排列 k");
}
#[test]
fn tensor_mmultiscripts() {
let expr = "<math><mmultiscripts>
<mi>R</mi> <mi>i</mi><none/> <none/><mi>j</mi> <mi>k</mi><none/> <mi>l</mi><none/>
</mmultiscripts></math>";
test_prefs("zh-tw", "SimpleSpeak", vec![("Verbosity", "Verbose")], expr,
"大寫 r 有 4 後標, 下標 i 上標 j 下標 k 下標 l");
test_prefs("zh-tw", "SimpleSpeak", vec![("Verbosity", "Medium")], expr,
"大寫 r 有 4 後標, 下標 i 上標 j 下標 k 下標 l");
}
#[test]
fn huge_num_mmultiscripts() {
let expr = "<math><mmultiscripts>
<mi>R</mi> <mi>i</mi><none/> <none/><mi>j</mi> <mi>k</mi><none/> <mi>l</mi><none/> <mi>m</mi><none/>
<mprescripts/> <mi>I</mi><none/> <none/><mi>J</mi> <mi>K</mi><none/> <mi>L</mi><none/>
</mmultiscripts></math>";
test_prefs("zh-tw", "SimpleSpeak", vec![("Verbosity", "Verbose")], expr,
"大寫 r 有 4 前標, 前下標 大寫 i, 前上標 大寫 j 與交替前標 大寫 k none 大寫 l none 結束前標 且 有 5 後標, 下標 i 上標 j 下標 k 下標 l 與交替後標 m none 結束後標");
}
#[test]
fn prime() {
let expr = "<math> <msup><mi>x</mi><mo >′</mo></msup> </math>";
test("zh-tw", "SimpleSpeak", expr, "x prime");
}
#[test]
fn given() {
let expr = "<math><mi>P</mi><mo>(</mo><mi>A</mi><mo>|</mo><mi>B</mi><mo>)</mo></math>";
test("zh-tw", "SimpleSpeak", expr, "大寫 p, 左小括, 大寫 a 給定 大寫 b, 右小括");
}
#[test]
fn simple_msubsup() {
let expr = "<math>
<mstyle displaystyle='true' scriptlevel='0'>
<msubsup>
<mi>x</mi>
<mrow>
<mi>k</mi>
</mrow>
<mrow>
<mi>i</mi>
</mrow>
</msubsup>
</mstyle>
</math>";
test("zh-tw", "SimpleSpeak", expr, "x 下標 k 的 i 次方");
}
#[test]
fn non_simple_msubsup() {
let expr = "<math><msubsup><mi>i</mi><mrow><mi>j</mi><mo>−</mo><mn>2</mn></mrow><mi>k</mi></msubsup></math>";
test("zh-tw", "SimpleSpeak", expr, "i 下標 j 減 2 結束下標, 的 k 次方");
}
#[test]
fn presentation_mathml_in_semantics() {
let expr = "<math>
<semantics>
<annotation encoding='application/x-tex'>{\\displaystyle x_k^i}</annotation>
<annotation-xml encoding='MathML-Presentation'>
<msubsup>
<mi>x</mi>
<mrow>
<mi>k</mi>
</mrow>
<mrow>
<mi>i</mi>
</mrow>
</msubsup>
</annotation-xml>
</semantics>
</math>";
test("zh-tw", "SimpleSpeak", expr, "x 下標 k 的 i 次方");
}
#[test]
fn ignore_period() {
let expr = "<math>
<semantics>
<annotation encoding='application/x-tex'>{\\displaystyle x_k^i}</annotation>
<annotation-xml encoding='MathML-Presentation'>
<mrow>
<mstyle displaystyle='true' scriptlevel='0'>
<mi>P</mi>
<mo stretchy='false'>(</mo>
<mi>A</mi>
<mrow>
<mstyle displaystyle='false' scriptlevel='0'>
<mtext> and </mtext>
</mstyle>
</mrow>
<mi>B</mi>
<mo stretchy='false'>)</mo>
<mo>=</mo>
<mi>P</mi>
<mo stretchy='false'>(</mo>
<mi>A</mi>
<mo>∩<!-- ∩ --></mo>
<mi>B</mi>
<mo stretchy='false'>)</mo>
<mo>=</mo>
<mi>P</mi>
<mo stretchy='false'>(</mo>
<mi>A</mi>
<mo stretchy='false'>)</mo>
<mi>P</mi>
<mo stretchy='false'>(</mo>
<mi>B</mi>
<mo stretchy='false'>)</mo>
<mo>.</mo>
</mstyle>
</mrow>
</annotation-xml>
</semantics>
</math>";
test("zh-tw", "SimpleSpeak", expr, "大寫 p; 左小括, 大寫 a and 大寫 b; 右小括; 等於; 大寫 p, 左小括, 大寫 a 交集 大寫 b, 右小括; 等於, 大寫 p 大寫 a, 大寫 p 大寫 b");
}
#[test]
fn ignore_mtext_period() {
let expr = "<math><mrow><mrow><mo>{</mo><mn>2</mn><mo>}</mo></mrow><mtext>.</mtext></mrow></math>";
test("zh-tw", "SimpleSpeak", expr, "集合 2");
}
#[test]
fn ignore_comma() {
let expr = "<math>
<mrow>
<mstyle displaystyle='true' scriptlevel='0'>
<mi>ϕ<!-- ϕ --></mi>
<mo stretchy='false'>(</mo>
<mi>x</mi>
<mo stretchy='false'>)</mo>
<mo>=</mo>
<mi>c</mi>
<msup>
<mi>e</mi>
<mrow>
<mo>−<!-- − --></mo>
<msup>
<mi>h</mi>
<mrow>
<mn>2</mn>
</mrow>
</msup>
<msup>
<mi>x</mi>
<mrow>
<mn>2</mn>
</mrow>
</msup>
</mrow>
</msup>
<mo>,</mo>
</mstyle>
</mrow>
</math>";
test("zh-tw", "SimpleSpeak", expr, "phi x 等於, c 乘, e 的 負 h 平方 x 平方 次方");
}
#[test]
#[ignore] fn ignore_period_and_space() {
let expr = "<math>
<mrow>
<mstyle displaystyle='true' scriptlevel='0'>
<mi>P</mi>
<mo stretchy='false'>(</mo>
<mi>A</mi>
<mo>∣<!-- ∣ --></mo>
<mi>B</mi>
<mo stretchy='false'>)</mo>
<mo>=</mo>
<mrow>
<mfrac>
<mrow>
<mi>P</mi>
<mo stretchy='false'>(</mo>
<mi>A</mi>
<mo>∩<!-- ∩ --></mo>
<mi>B</mi>
<mo stretchy='false'>)</mo>
</mrow>
<mrow>
<mi>P</mi>
<mo stretchy='false'>(</mo>
<mi>B</mi>
<mo stretchy='false'>)</mo>
</mrow>
</mfrac>
</mrow>
<mo>.</mo>
<mspace width='thinmathspace'></mspace>
</mstyle>
</mrow>
</math>";
test("zh-tw", "SimpleSpeak", expr, "大寫 p, 左小括, 大寫 a 垂線 大寫 b, 右小括; 等於; 分數 大寫 p 大寫 b, 分之, 大寫 p, 左小括, 大寫 a 交集 大寫 b, 右小括 結束分數; 點");
}
#[test]
fn mn_with_space() {
let expr = "<math><mn>1 234 567</mn></math>";
test("zh-tw", "SimpleSpeak", expr, "1234567");
}