use crate::common::*;
#[test]
fn matrix_1x1() {
let expr = "
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
<mrow><mo>(</mo>
<mtable><mtr><mtd>
<mn>3</mn>
</mtd> </mtr></mtable>
<mo>)</mo></mrow></mrow>
</math>
";
test("zh-tw", "SimpleSpeak", expr, "1 乘 1 矩陣 成員 3");
}
#[test]
fn determinant_1x1() {
let expr = "
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
<mrow><mo>|</mo>
<mtable><mtr><mtd>
<mn>3</mn>
</mtd> </mtr></mtable>
<mo>|</mo></mrow></mrow>
</math>
";
test("zh-tw", "SimpleSpeak", expr, "1 乘 1 行列式 成員 3");
}
#[test]
fn matrix_1x2() {
let expr = "
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
<mrow><mo>(</mo>
<mtable>
<mtr>
<mtd>
<mn>3</mn>
</mtd>
<mtd>
<mn>5</mn>
</mtd>
</mtr>
</mtable>
<mo>)</mo></mrow></mrow>
</math>
";
test("zh-tw", "SimpleSpeak", expr, "1 乘 2 矩陣; 3, 5");
}
#[test]
fn matrix_1x3() {
let expr = "
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
<mrow><mo>(</mo>
<mtable>
<mtr>
<mtd>
<mrow><mo>-</mo><mi>x</mi></mrow>
</mtd>
<mtd>
<mn>5</mn>
</mtd>
<mtd>
<mn>12</mn>
</mtd>
</mtr>
</mtable>
<mo>)</mo></mrow></mrow>
</math>
";
test("zh-tw", "SimpleSpeak", expr, "1 乘 3 矩陣; 負 x, 5, 12");
}
#[test]
fn matrix_2x1_not_simple() {
let expr = "
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
<mrow><mo>(</mo>
<mtable>
<mtr>
<mtd>
<mrow>
<mi>x</mi><mo>+</mo><mn>1</mn>
</mrow>
</mtd>
</mtr>
<mtr>
<mtd>
<mrow>
<mi>x</mi><mo>-</mo><mn>1</mn></mrow>
</mtd>
</mtr>
</mtable>
<mo>)</mo></mrow></mrow>
</math>
";
test("zh-tw", "SimpleSpeak", expr, "2 乘 1 矩陣; 列 1; x 加 1; 列 2; x 減 1");
}
#[test]
fn matrix_3x1_not_simple() {
let expr = "
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
<mrow><mo>(</mo>
<mtable>
<mtr>
<mtd>
<mrow>
<mi>x</mi>
</mrow>
</mtd>
</mtr>
<mtr>
<mtd>
<mrow>
<mi>a</mi>
</mrow>
</mtd>
</mtr>
<mtr>
<mtd>
<mfrac>
<mi>x</mi>
<mrow>
<mi>x</mi><mo>+</mo><mn>1</mn>
</mrow>
</mfrac>
</mtd>
</mtr>
</mtable>
<mo>)</mo></mrow></mrow>
</math>";
test("zh-tw", "SimpleSpeak", expr, "3 乘 1 矩陣; \
列 1; x; \
列 2; a; \
列 3; 分數 x 加 1, 分之 x 結束分數");
}
#[test]
fn determinant_2x2() {
let expr = "<math>
<mrow>
<mrow><mo>|</mo>
<mtable>
<mtr>
<mtd>
<mn>2</mn>
</mtd>
<mtd>
<mn>1</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<mn>7</mn>
</mtd>
<mtd>
<mn>5</mn>
</mtd>
</mtr>
</mtable>
<mo>|</mo></mrow></mrow>
</math>";
test("zh-tw", "SimpleSpeak", expr, "2 乘 2 行列式; 列 1; 2, 1; 列 2; 7, 5");
}
#[test]
fn matrix_2x3() {
let expr = "
<math display='block' xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
<mrow><mo>[</mo>
<mtable>
<mtr>
<mtd>
<mn>3</mn>
</mtd>
<mtd>
<mn>1</mn>
</mtd>
<mtd>
<mn>4</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<mn>0</mn>
</mtd>
<mtd>
<mn>2</mn>
</mtd>
<mtd>
<mn>6</mn>
</mtd>
</mtr>
</mtable>
<mo>]</mo></mrow></mrow>
</math>
";
test("zh-tw", "SimpleSpeak", expr, "2 乘 3 矩陣; 列 1; 3, 1, 4; 列 2; 0, 2, 6");
}
#[test]
fn matrix_2x3_labeled() {
let expr = "
<math display='block' xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
<mrow><mo>[</mo>
<mtable>
<mlabeledtr>
<mtd>
<mtext>(3.1)</mtext>
</mtd>
<mtd>
<mn>3</mn>
</mtd>
<mtd>
<mn>1</mn>
</mtd>
<mtd>
<mn>4</mn>
</mtd>
</mlabeledtr>
<mtr>
<mtd>
<mn>0</mn>
</mtd>
<mtd>
<mn>2</mn>
</mtd>
<mtd>
<mn>6</mn>
</mtd>
</mtr>
</mtable>
<mo>]</mo></mrow></mrow>
</math>
";
test("zh-tw", "SimpleSpeak", expr,
"2 乘 3 矩陣; 列 1 帶有標籤 (3.1); 行 1; 3, 行 2; 1, 行 3; 4; \
列 2; 行 1; 0, 行 2; 2, 行 3; 6");
}
#[test]
fn matrix_3x1() {
let expr = "
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
<mrow><mo>[</mo>
<mtable>
<mtr>
<mtd>
<mn>1</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<mn>2</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<mn>3</mn>
</mtd>
</mtr>
</mtable> <mo>]</mo></mrow></mrow>
</math>
";
test("zh-tw", "SimpleSpeak", expr, "3 乘 1 矩陣; 1; 2; 3");
}
#[test]
fn matrix_4x1() {
let expr = "
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
<mrow><mo>(</mo>
<mtable>
<mtr>
<mtd>
<mn>3</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<mn>6</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<mn>1</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<mn>2</mn>
</mtd>
</mtr>
</mtable>
<mo>)</mo></mrow></mrow>
</math>
";
test("zh-tw", "SimpleSpeak", expr, "4 乘 1 矩陣; 列 1; 3; 列 2; 6; 列 3; 1; 列 4; 2");
}
#[test]
fn matrix_4x1_labeled() {
let expr = "
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
<mrow><mo>(</mo>
<mtable>
<mtr>
<mtd>
<mn>3</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<mn>6</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<mn>1</mn>
</mtd>
</mtr>
<mlabeledtr>
<mtd>
<mtext>(3.1)</mtext>
</mtd>
<mtd>
<mn>2</mn>
</mtd>
</mlabeledtr>
</mtable>
<mo>)</mo></mrow></mrow>
</math>
";
test("zh-tw", "SimpleSpeak", expr,
"4 乘 1 矩陣; 列 1; 3; 列 2; 6; 列 3; 1; 列 4 帶有標籤 (3.1); 2");
}
#[test]
fn matrix_1x4() {
let expr = "
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
<mrow><mo>(</mo>
<mtable>
<mtr>
<mtd>
<mn>3</mn>
</mtd>
<mtd>
<mn>6</mn>
</mtd>
<mtd>
<mn>1</mn>
</mtd>
<mtd>
<mn>2</mn>
</mtd>
</mtr>
</mtable>
<mo>)</mo></mrow></mrow>
</math>
";
test("zh-tw", "SimpleSpeak", expr, "1 乘 4 矩陣; 行 1; 3, 行 2; 6, 行 3; 1, 行 4; 2");
}
#[test]
fn matrix_4x4() {
let expr = "
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
<mrow><mo>(</mo>
<mtable>
<mtr>
<mtd>
<mn>0</mn>
</mtd>
<mtd>
<mn>3</mn>
</mtd>
<mtd>
<mn>4</mn>
</mtd>
<mtd>
<mn>3</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<mn>2</mn>
</mtd>
<mtd>
<mn>1</mn>
</mtd>
<mtd>
<mn>0</mn>
</mtd>
<mtd>
<mn>9</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<mn>3</mn>
</mtd>
<mtd>
<mn>0</mn>
</mtd>
<mtd>
<mn>2</mn>
</mtd>
<mtd>
<mn>1</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<mn>6</mn>
</mtd>
<mtd>
<mn>2</mn>
</mtd>
<mtd>
<mn>9</mn>
</mtd>
<mtd>
<mn>0</mn>
</mtd>
</mtr>
</mtable>
<mo>)</mo></mrow></mrow>
</math>
";
test("zh-tw", "SimpleSpeak", expr, "4 乘 4 矩陣; \
列 1; 行 1; 0, 行 2; 3, 行 3; 4, 行 4; 3; \
列 2; 行 1; 2, 行 2; 1, 行 3; 0, 行 4; 9; \
列 3; 行 1; 3, 行 2; 0, 行 3; 2, 行 4; 1; \
列 4; 行 1; 6, 行 2; 2, 行 3; 9, 行 4; 0");}
#[test]
fn matrix_4x2() {
let expr = "
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
<mrow><mo>(</mo>
<mtable>
<mtr>
<mtd>
<mn>1</mn>
</mtd>
<mtd>
<mn>3</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<mn>4</mn>
</mtd>
<mtd>
<mn>2</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<mn>2</mn>
</mtd>
<mtd>
<mn>1</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<mn>0</mn>
</mtd>
<mtd>
<mn>5</mn>
</mtd>
</mtr>
</mtable>
<mo>)</mo></mrow></mrow>
</math>
";
test("zh-tw", "SimpleSpeak", expr, "4 乘 2 矩陣; \
列 1; 行 1; 1, 行 2; 3; \
列 2; 行 1; 4, 行 2; 2; \
列 3; 行 1; 2, 行 2; 1; \
列 4; 行 1; 0, 行 2; 5\
");
}
#[test]
fn simple_absolute_value() {
let expr = "<math>
<mrow><mrow><mo>|</mo> <mi>x</mi> <mo>|</mo></mrow></mrow>
</math>";
test("zh-tw", "SimpleSpeak", expr, "x 的 絕對值");
}
#[test]
fn absolute_value_plus_1() {
let expr = "<math>
<mrow><mrow><mo>|</mo>
<mrow><mi>x</mi><mo>+</mo><mn>1</mn> </mrow>
<mo>|</mo></mrow></mrow>
</math>";
test("zh-tw", "SimpleSpeak", expr, "x 加 1 的 絕對值");
}