Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / resources / chromeos / chromevox / common / math_semantic_tree_test.unitjs
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Include test fixture.
6 GEN_INCLUDE(['../testing/chromevox_unittest_base.js']);
7
8 /**
9  * Test fixture.
10  * @constructor
11  * @extends {ChromeVoxUnitTestBase}
12  */
13 function CvoxSemanticTreeUnitTest() {}
14
15 CvoxSemanticTreeUnitTest.prototype = {
16   __proto__: ChromeVoxUnitTestBase.prototype,
17
18   /** @override */
19   closureModuleDeps: [
20     'cvox.SemanticAttr',
21     'cvox.SemanticTree',
22     'cvox.SemanticUtil',
23     'cvox.XpathUtil'
24   ],
25
26   /** @override */
27   setUp: function() {
28     this.nodeCounter = 0;
29     this.xpathBlacklist = [];
30     this.brief = true;
31     this.setupAttributes();
32   },
33
34   /**
35    * Adds some unicode characters via hex code to the right category.
36    *
37    * This method is necessary as the test framework can not handle code
38    * containing utf-8 encoded characters.
39    */
40   setupAttributes: function() {
41     var attr = cvox.SemanticAttr.getInstance();
42     attr.neutralFences.unshift(cvox.SemanticUtil.numberToUnicode(0x00A6));
43     attr.dashes.unshift(cvox.SemanticUtil.numberToUnicode(0x2015));
44     attr.neutralFences.unshift(cvox.SemanticUtil.numberToUnicode(0x2016));
45     attr.arrows.unshift(cvox.SemanticUtil.numberToUnicode(0x2192));
46     attr.sumOps.unshift(cvox.SemanticUtil.numberToUnicode(0x2211));
47     attr.additions.unshift(cvox.SemanticUtil.numberToUnicode(0x2213));
48     attr.multiplications.unshift(cvox.SemanticUtil.numberToUnicode(0x2218));
49     attr.intOps.unshift(cvox.SemanticUtil.numberToUnicode(0x222B));
50     attr.inequalities.unshift(cvox.SemanticUtil.numberToUnicode(0x2264));
51     attr.additions.unshift(cvox.SemanticUtil.numberToUnicode(0x2295));
52     var open = cvox.SemanticUtil.numberToUnicode(0x3008);
53     var close = cvox.SemanticUtil.numberToUnicode(0x3009);
54     attr.openClosePairs[open] = close;
55     attr.leftFences.unshift(open);
56     attr.rightFences.unshift(close);
57   },
58
59   /**
60    * Removes XML nodes according to the XPath elements in the blacklist.
61    * @param {Node} xml Xml representation of the semantic node.
62    */
63   customizeXml: function(xml) {
64     this.xpathBlacklist.forEach(
65         function(xpath) {
66           var removes = cvox.XpathUtil.evalXPath(xpath, xml);
67           removes.forEach(
68               function(node) {
69                 node.parentNode.removeChild(node);
70               });
71         });
72   },
73
74   /**
75    * Tests if for a given mathml snippet results in a particular semantic tree.
76    * @param {string} mml MathML expression.
77    * @param {string} sml XML snippet for the semantic tree.
78   */
79   executeTreeTest: function(mml, sml) {
80     var mathMl = '<math id=' + this.nodeCounter + '>' + mml + '';
81     this.loadHtml(mathMl);
82     var node = document.getElementById((this.nodeCounter++).toString());
83     var stree = new cvox.SemanticTree(/** @type {!Element} */(node));
84     var sxml = stree.xml(this.brief);
85     this.customizeXml(sxml);
86     var dp = new DOMParser();
87     var xml = dp.parseFromString('<stree>' + sml + '</stree>', 'text/xml');
88     var xmls = new XMLSerializer();
89     assertEquals(xmls.serializeToString(xml),
90                  xmls.serializeToString(sxml));
91   }
92 };
93
94 TEST_F('CvoxSemanticTreeUnitTest', 'StreeRelations', function() {
95   this.brief = true;
96   this.executeTreeTest(
97       '<mo>=</mo>',
98       '<relation>=</relation>');
99   this.executeTreeTest(
100       '<mi>a</mi><mo>=</mo><mi>b</mi>',
101       '<relseq>=' +
102           '<content><relation>=</relation></content>' +
103           '<children>' +
104           '<identifier>a</identifier>' +
105           '<identifier>b</identifier>' +
106           '</children>' +
107           '</relseq>');
108   this.executeTreeTest(
109       '<mi>a</mi><mo>=</mo><mi>b</mi><mo>=</mo><mi>c</mi>',
110       '<relseq>=' +
111           '<content><relation>=</relation><relation>=</relation></content>' +
112           '<children>' +
113           '<identifier>a</identifier>' +
114           '<identifier>b</identifier>' +
115           '<identifier>c</identifier>' +
116           '</children>' +
117           '</relseq>');
118   this.executeTreeTest(
119       '<mi>a</mi><mo>=</mo><mi>b</mi><mo>=</mo><mi>c</mi>' +
120           '<mo>\u2264</mo><mi>d</mi>',
121       '<multirel>' +
122           '<content><relation>=</relation><relation>=</relation>' +
123           '<relation>\u2264</relation></content>' +
124           '<children>' +
125           '<identifier>a</identifier>' +
126           '<identifier>b</identifier>' +
127           '<identifier>c</identifier>' +
128           '<identifier>d</identifier>' +
129           '</children>' +
130           '</multirel>');
131 });
132
133
134 // Operators.
135 /**
136  * Test operator trees with pre- and postfixes.
137  */
138 TEST_F('CvoxSemanticTreeUnitTest', 'StreePrePostfixOperators', function() {
139   this.brief = true;
140   // Pathological operator only case.
141   this.executeTreeTest(
142       '<mo>+</mo><mo>-</mo><mo>+</mo>',
143       '<prefixop>+' +
144           '<content><operator>+</operator></content>' +
145           '<children>' +
146           '<prefixop>-' +
147           '<content><operator>-</operator></content>' +
148           '<children>' +
149           '<operator>+</operator>' +
150           '</children>' +
151           '</prefixop>' +
152           '</children>' +
153           '</prefixop>');
154   // Single identifier with prefixes.
155   this.executeTreeTest(
156       '<mo>+</mo><mo>+</mo><mi>a</mi>',
157       '<prefixop>+ +' +
158           '<content><operator>+</operator><operator>+</operator></content>' +
159           '<children>' +
160           '<identifier>a</identifier>' +
161           '</children>' +
162           '</prefixop>');
163   // Single identifier with prefix and negative.
164   this.executeTreeTest(
165       '<mo>+</mo><mo>-</mo><mi>a</mi>',
166       '<prefixop>+' +
167           '<content><operator>+</operator></content>' +
168           '<children>' +
169           '<prefixop>-' +
170           '<content><operator>-</operator></content>' +
171           '<children>' +
172           '<identifier>a</identifier>' +
173           '</children>' +
174           '</prefixop>' +
175           '</children>' +
176           '</prefixop>');
177   // Single identifier with postfixes.
178   this.executeTreeTest(
179       '<mi>a</mi><mo>+</mo><mo>-</mo>',
180       '<postfixop>+ -' +
181           '<content><operator>+</operator><operator>-</operator></content>' +
182           '<children>' +
183           '<identifier>a</identifier>' +
184           '</children>' +
185           '</postfixop>');
186   // Single identifier with pre- and postfixes.
187   this.executeTreeTest(
188       '<mo>+</mo><mo>+</mo><mi>a</mi><mo>+</mo><mo>+</mo>',
189       '<postfixop>+ +' +
190           '<content><operator>+</operator><operator>+</operator></content>' +
191           '<children>' +
192           '<prefixop>+ +' +
193           '<content><operator>+</operator><operator>+</operator></content>' +
194           '<children>' +
195           '<identifier>a</identifier>' +
196           '</children>' +
197           '</prefixop>' +
198           '</children>' +
199           '</postfixop>');
200   // Single identifier with mixed pre- and postfixes.
201   this.executeTreeTest(
202       '<mo>\u2213</mo><mo>+</mo><mi>a</mi><mo>\u2213</mo><mo>+</mo>',
203       '<postfixop>\u2213 +' +
204           '<content>' +
205           '<operator>\u2213</operator><operator>+</operator>' +
206           '</content>' +
207           '<children>' +
208           '<prefixop>\u2213 +' +
209           '<content>' +
210           '<operator>\u2213</operator><operator>+</operator>' +
211           '</content>' +
212           '<children>' +
213           '<identifier>a</identifier>' +
214           '</children>' +
215           '</prefixop>' +
216           '</children>' +
217           '</postfixop>');
218   // Two identifiers with pre- and postfixes.
219   this.executeTreeTest(
220       '<mo>+</mo><mo>+</mo><mi>a</mi><mo>\u2213</mo><mo>+</mo>' +
221           '<mi>b</mi><mo>+</mo>',
222       '<infixop>\u2213' +
223           '<content><operator>\u2213</operator></content>' +
224           '<children>' +
225           '<prefixop>+ +' +
226           '<content><operator>+</operator><operator>+</operator></content>' +
227           '<children>' +
228           '<identifier>a</identifier>' +
229           '</children>' +
230           '</prefixop>' +
231           '<postfixop>+' +
232           '<content><operator>+</operator></content>' +
233           '<children>' +
234           '<prefixop>+' +
235           '<content><operator>+</operator></content>' +
236           '<children>' +
237           '<identifier>b</identifier>' +
238           '</children>' +
239           '</prefixop>' +
240           '</children>' +
241           '</postfixop>' +
242           '</children>' +
243           '</infixop>');
244   // Three identifiers with pre- and postfixes.
245   this.executeTreeTest(
246       '<mo>+</mo><mo>+</mo><mi>a</mi><mo>\u2213</mo><mo>+</mo>' +
247           '<mi>b</mi><mo>+</mo><mo>\u2213</mo><mi>c</mi><mo>+</mo>',
248       '<infixop>+' +
249           '<content><operator>+</operator></content>' +
250           '<children>' +
251           '<infixop>\u2213' +
252           '<content><operator>\u2213</operator></content>' +
253           '<children>' +
254           '<prefixop>+ +' +
255           '<content><operator>+</operator><operator>+</operator></content>' +
256           '<children>' +
257           '<identifier>a</identifier>' +
258           '</children>' +
259           '</prefixop>' +
260           '<prefixop>+' +
261           '<content><operator>+</operator></content>' +
262           '<children>' +
263           '<identifier>b</identifier>' +
264           '</children>' +
265           '</prefixop>' +
266           '</children>' +
267           '</infixop>' +
268           '<postfixop>+' +
269           '<content><operator>+</operator></content>' +
270           '<children>' +
271           '<prefixop>\u2213' +
272           '<content><operator>\u2213</operator></content>' +
273           '<children>' +
274           '<identifier>c</identifier>' +
275           '</children>' +
276           '</prefixop>' +
277           '</children>' +
278           '</postfixop>' +
279           '</children>' +
280           '</infixop>');
281 });
282
283
284 /**
285  * Test operator trees with single operator.
286  */
287 TEST_F('CvoxSemanticTreeUnitTest', 'StreeSingleOperators', function() {
288   this.brief = true;
289   // Single identifier.
290   this.executeTreeTest(
291       '<mi>a</mi>',
292       '<identifier>a</identifier>');
293   // Single implicit node.
294   this.executeTreeTest(
295       '<mi>a</mi><mi>b</mi>',
296       '<infixop>\u2062' +
297           '<content><operator>\u2062</operator></content>' +
298           '<children>' +
299           '<identifier>a</identifier>' +
300           '<identifier>b</identifier>' +
301           '</children>' +
302           '</infixop>');
303   // Implicit multi node.
304   this.executeTreeTest(
305       '<mi>a</mi><mi>b</mi><mi>c</mi>',
306       '<infixop>\u2062' +
307           '<content><operator>\u2062</operator></content>' +
308           '<children>' +
309           '<identifier>a</identifier>' +
310           '<identifier>b</identifier>' +
311           '<identifier>c</identifier>' +
312           '</children>' +
313           '</infixop>');
314   // Single addition.
315   this.executeTreeTest(
316       '<mi>a</mi><mo>+</mo><mi>b</mi>',
317       '<infixop>+' +
318           '<content><operator>+</operator></content>' +
319           '<children>' +
320           '<identifier>a</identifier>' +
321           '<identifier>b</identifier>' +
322           '</children>' +
323           '</infixop>');
324   // Multi addition.
325   this.executeTreeTest(
326       '<mi>a</mi><mo>+</mo><mi>b</mi><mo>+</mo><mi>c</mi>',
327       '<infixop>+' +
328           '<content><operator>+</operator><operator>+</operator></content>' +
329           '<children>' +
330           '<identifier>a</identifier>' +
331           '<identifier>b</identifier>' +
332           '<identifier>c</identifier>' +
333           '</children>' +
334           '</infixop>');
335   // Multi addition with implicit node.
336   this.executeTreeTest(
337       '<mi>a</mi><mo>+</mo><mi>b</mi><mi>c</mi><mo>+</mo><mi>d</mi>',
338       '<infixop>+' +
339           '<content><operator>+</operator><operator>+</operator></content>' +
340           '<children>' +
341           '<identifier>a</identifier>' +
342           '<infixop>\u2062' +
343           '<content><operator>\u2062</operator></content>' +
344           '<children>' +
345           '<identifier>b</identifier>' +
346           '<identifier>c</identifier>' +
347           '</children>' +
348           '</infixop>' +
349           '<identifier>d</identifier>' +
350           '</children>' +
351           '</infixop>');
352 });
353
354
355 /**
356  * Test operator trees with multiple operators.
357  */
358 TEST_F('CvoxSemanticTreeUnitTest', 'StreeMultipleOperators', function() {
359   this.brief = true;
360   // Addition and subtraction.
361   this.executeTreeTest(
362       '<mi>a</mi><mo>+</mo><mi>b</mi><mo>-</mo><mi>c</mi><mo>+</mo><mi>d</mi>',
363       '<infixop>+' +
364           '<content><operator>+</operator></content>' +
365           '<children>' +
366           '<infixop>-' +
367           '<content><operator>-</operator></content>' +
368           '<children>' +
369           '<infixop>+' +
370           '<content><operator>+</operator></content>' +
371           '<children>' +
372           '<identifier>a</identifier>' +
373           '<identifier>b</identifier>' +
374           '</children>' +
375           '</infixop>' +
376           '<identifier>c</identifier>' +
377           '</children>' +
378           '</infixop>' +
379           '<identifier>d</identifier>' +
380           '</children>' +
381           '</infixop>');
382   // Addition and subtraction.
383   this.executeTreeTest(
384       '<mi>a</mi><mo>+</mo><mi>b</mi><mo>+</mo><mi>c</mi><mo>-</mo>' +
385           '<mi>d</mi><mo>-</mo><mi>e</mi>',
386       '<infixop>-' +
387           '<content><operator>-</operator><operator>-</operator></content>' +
388           '<children>' +
389           '<infixop>+' +
390           '<content><operator>+</operator><operator>+</operator></content>' +
391           '<children>' +
392           '<identifier>a</identifier>' +
393           '<identifier>b</identifier>' +
394           '<identifier>c</identifier>' +
395           '</children>' +
396           '</infixop>' +
397           '<identifier>d</identifier>' +
398           '<identifier>e</identifier>' +
399           '</children>' +
400           '</infixop>');
401   // Addition and explicit multiplication.
402   this.executeTreeTest(
403       '<mi>a</mi><mo>+</mo><mi>b</mi><mo>\u2218</mo><mi>c</mi><mo>+</mo>' +
404       '<mi>d</mi>',
405       '<infixop>+' +
406           '<content><operator>+</operator><operator>+</operator></content>' +
407           '<children>' +
408           '<identifier>a</identifier>' +
409           '<infixop>\u2218' +
410           '<content><operator>\u2218</operator></content>' +
411           '<children>' +
412           '<identifier>b</identifier>' +
413           '<identifier>c</identifier>' +
414           '</children>' +
415           '</infixop>' +
416           '<identifier>d</identifier>' +
417           '</children>' +
418           '</infixop>');
419   // Addition with explicit and implicit multiplication.
420   this.executeTreeTest(
421       '<mi>a</mi><mo>+</mo><mi>b</mi><mo>\u2218</mo><mi>c</mi><mi>d</mi>' +
422       '<mo>+</mo><mi>e</mi><mo>\u2218</mo><mi>f</mi>',
423       '<infixop>+' +
424           '<content><operator>+</operator><operator>+</operator></content>' +
425           '<children>' +
426           '<identifier>a</identifier>' +
427           '<infixop>\u2218' +
428           '<content><operator>\u2218</operator></content>' +
429           '<children>' +
430           '<identifier>b</identifier>' +
431           '<infixop>\u2062' +
432           '<content><operator>\u2062</operator></content>' +
433           '<children>' +
434           '<identifier>c</identifier>' +
435           '<identifier>d</identifier>' +
436           '</children>' +
437           '</infixop>' +
438           '</children>' +
439           '</infixop>' +
440           '<infixop>\u2218' +
441           '<content><operator>\u2218</operator></content>' +
442           '<children>' +
443           '<identifier>e</identifier>' +
444           '<identifier>f</identifier>' +
445           '</children>' +
446           '</infixop>' +
447           '</children>' +
448           '</infixop>');
449   // Two Additions, subtraction plus explicit and implicit multiplication,
450   // one prefix and one postfix.
451   this.executeTreeTest(
452       '<mi>a</mi><mo>+</mo><mi>b</mi><mo>+</mo><mi>c</mi><mi>d</mi>' +
453           '<mo>+</mo><mi>e</mi><mo>\u2218</mo><mi>f</mi><mo>-</mo><mi>g</mi>' +
454           '<mo>+</mo><mo>+</mo><mi>h</mi><mo>\u2295</mo><mi>i</mi>' +
455           '<mo>\u2295</mo><mi>j</mi><mo>+</mo><mo>+</mo>',
456       '<infixop>\u2295' +
457           '<content><operator>\u2295</operator>' +
458           '<operator>\u2295</operator></content>' +
459           '<children>' +
460           '<infixop>+' +
461           '<content><operator>+</operator></content>' +
462           '<children>' +
463           '<infixop>-' +
464           '<content><operator>-</operator></content>' +
465           '<children>' +
466           '<infixop>+' +
467           '<content><operator>+</operator>' +
468           '<operator>+</operator><operator>+</operator></content>' +
469           '<children>' +
470           '<identifier>a</identifier>' +
471           '<identifier>b</identifier>' +
472           '<infixop>\u2062' +
473           '<content><operator>\u2062</operator></content>' +
474           '<children>' +
475           '<identifier>c</identifier>' +
476           '<identifier>d</identifier>' +
477           '</children>' +
478           '</infixop>' +
479           '<infixop>\u2218' +
480           '<content><operator>\u2218</operator></content>' +
481           '<children>' +
482           '<identifier>e</identifier>' +
483           '<identifier>f</identifier>' +
484           '</children>' +
485           '</infixop>' +
486           '</children>' +
487           '</infixop>' +
488           '<identifier>g</identifier>' +
489           '</children>' +
490           '</infixop>' +
491           '<prefixop>+' +
492           '<content><operator>+</operator></content>' +
493           '<children>' +
494           '<identifier>h</identifier>' +
495           '</children>' +
496           '</prefixop>' +
497           '</children>' +
498           '</infixop>' +
499           '<identifier>i</identifier>' +
500           '<postfixop>+ +' +
501           '<content><operator>+</operator><operator>+</operator></content>' +
502           '<children>' +
503           '<identifier>j</identifier>' +
504           '</children>' +
505           '</postfixop>' +
506           '</children>' +
507           '</infixop>');
508 });
509
510
511 // Fences.
512 /**
513  * Test regular directed fences.
514  */
515 TEST_F('CvoxSemanticTreeUnitTest', 'StreeRegularFences', function() {
516   this.brief = true;
517   // No fence.
518   this.executeTreeTest(
519       '<mrow><mi>a</mi><mo>+</mo><mi>b</mi></mrow>',
520       '<infixop>+' +
521       '<content>' +
522       '<operator>+</operator>' +
523       '</content>' +
524       '<children>' +
525       '<identifier>a</identifier>' +
526       '<identifier>b</identifier>' +
527       '</children>' +
528       '</infixop>');
529   // Empty parentheses.
530   this.executeTreeTest(
531       '<mrow><mo>(</mo><mo>)</mo></mrow>',
532       '<fenced>' +
533       '<content>' +
534       '<fence>(</fence>' +
535       '<fence>)</fence>' +
536       '</content>' +
537       '<children>' +
538       '<empty/>' +
539       '</children>' +
540       '</fenced>');
541   // Single Fenced Expression.
542   this.executeTreeTest(
543       '<mrow><mo>(</mo><mi>a</mi><mo>+</mo><mi>b</mi><mo>)</mo></mrow>',
544       '<fenced>' +
545       '<content>' +
546       '<fence>(</fence>' +
547       '<fence>)</fence>' +
548       '</content>' +
549       '<children>' +
550       '<infixop>+' +
551       '<content>' +
552       '<operator>+</operator>' +
553       '</content>' +
554       '<children>' +
555       '<identifier>a</identifier>' +
556       '<identifier>b</identifier>' +
557       '</children>' +
558       '</infixop>' +
559       '</children>' +
560       '</fenced>');
561   // Single Fenced Expression and operators.
562   this.executeTreeTest(
563       '<mrow><mi>a</mi><mo>+</mo><mo>(</mo><mi>b</mi><mo>+</mo><mi>c</mi>' +
564       '<mo>)</mo><mo>+</mo><mi>d</mi></mrow>',
565       '<infixop>+' +
566       '<content>' +
567       '<operator>+</operator>' +
568       '<operator>+</operator>' +
569       '</content>' +
570       '<children>' +
571       '<identifier>a</identifier>' +
572       '<fenced>' +
573       '<content>' +
574       '<fence>(</fence>' +
575       '<fence>)</fence>' +
576       '</content>' +
577       '<children>' +
578       '<infixop>+' +
579       '<content>' +
580       '<operator>+</operator>' +
581       '</content>' +
582       '<children>' +
583       '<identifier>b</identifier>' +
584       '<identifier>c</identifier>' +
585       '</children>' +
586       '</infixop>' +
587       '</children>' +
588       '</fenced>' +
589       '<identifier>d</identifier>' +
590       '</children>' +
591       '</infixop>');
592   // Parallel Parenthesis.
593   this.executeTreeTest(
594       '<mrow><mo>(</mo><mi>a</mi><mo>+</mo><mi>b</mi><mo>)</mo><mo>(</mo>' +
595       '<mi>c</mi><mo>+</mo><mi>d</mi><mo>)</mo></mrow>',
596       '<infixop>\u2062' +
597       '<content>' +
598       '<operator>\u2062</operator>' +
599       '</content>' +
600       '<children>' +
601       '<fenced>' +
602       '<content>' +
603       '<fence>(</fence>' +
604       '<fence>)</fence>' +
605       '</content>' +
606       '<children>' +
607       '<infixop>+' +
608       '<content>' +
609       '<operator>+</operator>' +
610       '</content>' +
611       '<children>' +
612       '<identifier>a</identifier>' +
613       '<identifier>b</identifier>' +
614       '</children>' +
615       '</infixop>' +
616       '</children>' +
617       '</fenced>' +
618       '<fenced>' +
619       '<content>' +
620       '<fence>(</fence>' +
621       '<fence>)</fence>' +
622       '</content>' +
623       '<children>' +
624       '<infixop>+' +
625       '<content>' +
626       '<operator>+</operator>' +
627       '</content>' +
628       '<children>' +
629       '<identifier>c</identifier>' +
630       '<identifier>d</identifier>' +
631       '</children>' +
632       '</infixop>' +
633       '</children>' +
634       '</fenced>' +
635       '</children>' +
636       '</infixop>');
637   // Nested Parenthesis.
638   this.executeTreeTest(
639       '<mrow><mo>(</mo><mo>(</mo><mi>a</mi><mo>+</mo><mi>b</mi><mo>)</mo>' +
640       '<mo>(</mo><mi>c</mi><mo>+</mo><mi>d</mi><mo>)</mo><mo>)</mo></mrow>',
641       '<fenced>' +
642       '<content>' +
643       '<fence>(</fence>' +
644       '<fence>)</fence>' +
645       '</content>' +
646       '<children>' +
647       '<infixop>\u2062' +
648       '<content>' +
649       '<operator>\u2062</operator>' +
650       '</content>' +
651       '<children>' +
652       '<fenced>' +
653       '<content>' +
654       '<fence>(</fence>' +
655       '<fence>)</fence>' +
656       '</content>' +
657       '<children>' +
658       '<infixop>+' +
659       '<content>' +
660       '<operator>+</operator>' +
661       '</content>' +
662       '<children>' +
663       '<identifier>a</identifier>' +
664       '<identifier>b</identifier>' +
665       '</children>' +
666       '</infixop>' +
667       '</children>' +
668       '</fenced>' +
669       '<fenced>' +
670       '<content>' +
671       '<fence>(</fence>' +
672       '<fence>)</fence>' +
673       '</content>' +
674       '<children>' +
675       '<infixop>+' +
676       '<content>' +
677       '<operator>+</operator>' +
678       '</content>' +
679       '<children>' +
680       '<identifier>c</identifier>' +
681       '<identifier>d</identifier>' +
682       '</children>' +
683       '</infixop>' +
684       '</children>' +
685       '</fenced>' +
686       '</children>' +
687       '</infixop>' +
688       '</children>' +
689       '</fenced>');
690   // Nested parenthesis and brackets.
691   this.executeTreeTest(
692       '<mrow><mo>(</mo><mo>[</mo><mi>a</mi><mo>+</mo><mi>b</mi><mo>+</mo>' +
693       '<mi>c</mi><mo>]</mo><mo>+</mo><mi>d</mi><mo>)</mo></mrow>',
694       '<fenced>' +
695       '<content>' +
696       '<fence>(</fence>' +
697       '<fence>)</fence>' +
698       '</content>' +
699       '<children>' +
700       '<infixop>+' +
701       '<content>' +
702       '<operator>+</operator>' +
703       '</content>' +
704       '<children>' +
705       '<fenced>' +
706       '<content>' +
707       '<fence>[</fence>' +
708       '<fence>]</fence>' +
709       '</content>' +
710       '<children>' +
711       '<infixop>+' +
712       '<content>' +
713       '<operator>+</operator>' +
714       '<operator>+</operator>' +
715       '</content>' +
716       '<children>' +
717       '<identifier>a</identifier>' +
718       '<identifier>b</identifier>' +
719       '<identifier>c</identifier>' +
720       '</children>' +
721       '</infixop>' +
722       '</children>' +
723       '</fenced>' +
724       '<identifier>d</identifier>' +
725       '</children>' +
726       '</infixop>' +
727       '</children>' +
728       '</fenced>');
729   // Nested parenthesis, brackets, braces and superscript operator.
730   this.executeTreeTest(
731       '<mrow><mo>(</mo><msup><mi>a</mi><mrow><mn>2</mn><mo>[</mo><mi>i</mi>' +
732       '<mo>+</mo><mi>n</mi><mo>]</mo></mrow></msup><mo>+</mo><mi>b</mi>' +
733       '<mo>)</mo><mo>+</mo><mo>{</mo><mi>c</mi><mi>d</mi><mo>-</mo><mo>[</mo>' +
734       '<mi>e</mi><mo>+</mo><mi>f</mi><mo>]</mo><mo>}</mo></mrow>',
735       '<infixop>+' +
736       '<content>' +
737       '<operator>+</operator>' +
738       '</content>' +
739       '<children>' +
740       '<fenced>' +
741       '<content>' +
742       '<fence>(</fence>' +
743       '<fence>)</fence>' +
744       '</content>' +
745       '<children>' +
746       '<infixop>+' +
747       '<content>' +
748       '<operator>+</operator>' +
749       '</content>' +
750       '<children>' +
751       '<superscript>' +
752       '<children>' +
753       '<identifier>a</identifier>' +
754       '<infixop>\u2062' +
755       '<content>' +
756       '<operator>\u2062</operator>' +
757       '</content>' +
758       '<children>' +
759       '<number>2</number>' +
760       '<fenced>' +
761       '<content>' +
762       '<fence>[</fence>' +
763       '<fence>]</fence>' +
764       '</content>' +
765       '<children>' +
766       '<infixop>+' +
767       '<content>' +
768       '<operator>+</operator>' +
769       '</content>' +
770       '<children>' +
771       '<identifier>i</identifier>' +
772       '<identifier>n</identifier>' +
773       '</children>' +
774       '</infixop>' +
775       '</children>' +
776       '</fenced>' +
777       '</children>' +
778       '</infixop>' +
779       '</children>' +
780       '</superscript>' +
781       '<identifier>b</identifier>' +
782       '</children>' +
783       '</infixop>' +
784       '</children>' +
785       '</fenced>' +
786       '<fenced>' +
787       '<content>' +
788       '<fence>{</fence>' +
789       '<fence>}</fence>' +
790       '</content>' +
791       '<children>' +
792       '<infixop>-' +
793       '<content>' +
794       '<operator>-</operator>' +
795       '</content>' +
796       '<children>' +
797       '<infixop>\u2062' +
798       '<content>' +
799       '<operator>\u2062</operator>' +
800       '</content>' +
801       '<children>' +
802       '<identifier>c</identifier>' +
803       '<identifier>d</identifier>' +
804       '</children>' +
805       '</infixop>' +
806       '<fenced>' +
807       '<content>' +
808       '<fence>[</fence>' +
809       '<fence>]</fence>' +
810       '</content>' +
811       '<children>' +
812       '<infixop>+' +
813       '<content>' +
814       '<operator>+</operator>' +
815       '</content>' +
816       '<children>' +
817       '<identifier>e</identifier>' +
818       '<identifier>f</identifier>' +
819       '</children>' +
820       '</infixop>' +
821       '</children>' +
822       '</fenced>' +
823       '</children>' +
824       '</infixop>' +
825       '</children>' +
826       '</fenced>' +
827       '</children>' +
828       '</infixop>');
829 });
830
831
832 /**
833  * Test neutral fences.
834  */
835 TEST_F('CvoxSemanticTreeUnitTest', 'StreeNeutralFences', function() {
836   this.brief = true;
837   // Empty bars.
838   this.executeTreeTest(
839       '<mrow><mo>|</mo><mo>|</mo></mrow>',
840       '<fenced>' +
841       '<content>' +
842       '<fence>|</fence>' +
843       '<fence>|</fence>' +
844       '</content>' +
845       '<children>' +
846       '<empty/>' +
847       '</children>' +
848       '</fenced>');
849   // Simple bar fence.
850   this.executeTreeTest(
851       '<mrow><mo>|</mo><mi>a</mi><mo>|</mo></mrow>',
852       '<fenced>' +
853       '<content>' +
854       '<fence>|</fence>' +
855       '<fence>|</fence>' +
856       '</content>' +
857       '<children>' +
858       '<identifier>a</identifier>' +
859       '</children>' +
860       '</fenced>');
861   // Parallel bar fences.
862   this.executeTreeTest(
863       '<mrow><mo>|</mo><mi>a</mi><mo>|</mo><mi>b</mi><mo>+</mo>' +
864       '<mo>\u00A6</mo><mi>c</mi><mo>\u00A6</mo></mrow>',
865       '<infixop>+' +
866       '<content>' +
867       '<operator>+</operator>' +
868       '</content>' +
869       '<children>' +
870       '<infixop>\u2062' +
871       '<content>' +
872       '<operator>\u2062</operator>' +
873       '</content>' +
874       '<children>' +
875       '<fenced>' +
876       '<content>' +
877       '<fence>|</fence>' +
878       '<fence>|</fence>' +
879       '</content>' +
880       '<children>' +
881       '<identifier>a</identifier>' +
882       '</children>' +
883       '</fenced>' +
884       '<identifier>b</identifier>' +
885       '</children>' +
886       '</infixop>' +
887       '<fenced>' +
888       '<content>' +
889       '<fence>\u00A6</fence>' +
890       '<fence>\u00A6</fence>' +
891       '</content>' +
892       '<children>' +
893       '<identifier>c</identifier>' +
894       '</children>' +
895       '</fenced>' +
896       '</children>' +
897       '</infixop>');
898   // Nested bar fences.
899   this.executeTreeTest(
900       '<mrow><mo>\u00A6</mo><mo>|</mo><mi>a</mi><mo>|</mo><mi>b</mi>' +
901       '<mo>+</mo><mi>c</mi><mo>\u00A6</mo></mrow>',
902       '<fenced>' +
903       '<content>' +
904       '<fence>\u00A6</fence>' +
905       '<fence>\u00A6</fence>' +
906       '</content>' +
907       '<children>' +
908       '<infixop>+' +
909       '<content>' +
910       '<operator>+</operator>' +
911       '</content>' +
912       '<children>' +
913       '<infixop>\u2062' +
914       '<content>' +
915       '<operator>\u2062</operator>' +
916       '</content>' +
917       '<children>' +
918       '<fenced>' +
919       '<content>' +
920       '<fence>|</fence>' +
921       '<fence>|</fence>' +
922       '</content>' +
923       '<children>' +
924       '<identifier>a</identifier>' +
925       '</children>' +
926       '</fenced>' +
927       '<identifier>b</identifier>' +
928       '</children>' +
929       '</infixop>' +
930       '<identifier>c</identifier>' +
931       '</children>' +
932       '</infixop>' +
933       '</children>' +
934       '</fenced>');
935 });
936
937
938 /**
939  * Mixed neutral and regular fences.
940  */
941 TEST_F('CvoxSemanticTreeUnitTest', 'StreeMixedFences', function() {
942   this.brief = true;
943   // Empty parenthsis inside bars.
944   this.executeTreeTest(
945       '<mrow><mo>|</mo><mo>(</mo><mo>)</mo><mo>|</mo></mrow>',
946       '<fenced>' +
947       '<content>' +
948       '<fence>|</fence>' +
949       '<fence>|</fence>' +
950       '</content>' +
951       '<children>' +
952       '<fenced>' +
953       '<content>' +
954       '<fence>(</fence>' +
955       '<fence>)</fence>' +
956       '</content>' +
957       '<children>' +
958       '<empty/>' +
959       '</children>' +
960       '</fenced>' +
961       '</children>' +
962       '</fenced>');
963   // Bars inside parentheses.
964   this.executeTreeTest(
965       '<mrow><mo>(</mo><mo>|</mo><mi>a</mi><mo>|</mo><mi>b</mi>' +
966         '<mo>&#x00A6;</mo><mi>c</mi><mo>&#x00A6;</mo><mi>d</mi>' +
967         '<mo>)</mo></mrow>',
968         '<fenced>' +
969         '<content>' +
970         '<fence>(</fence>' +
971         '<fence>)</fence>' +
972         '</content>' +
973         '<children>' +
974         '<infixop>\u2062' +
975         '<content>' +
976         '<operator>\u2062</operator>' +
977         '</content>' +
978         '<children>' +
979         '<fenced>' +
980         '<content>' +
981         '<fence>|</fence>' +
982         '<fence>|</fence>' +
983         '</content>' +
984         '<children>' +
985         '<identifier>a</identifier>' +
986         '</children>' +
987         '</fenced>' +
988         '<identifier>b</identifier>' +
989         '<fenced>' +
990         '<content>' +
991         '<fence>\u00A6</fence>' +
992         '<fence>\u00A6</fence>' +
993         '</content>' +
994         '<children>' +
995         '<identifier>c</identifier>' +
996         '</children>' +
997         '</fenced>' +
998         '<identifier>d</identifier>' +
999         '</children>' +
1000         '</infixop>' +
1001         '</children>' +
1002         '</fenced>');
1003   // Parentheses inside bards.
1004   this.executeTreeTest(
1005       '<mrow><mo>|</mo><mo>(</mo><mi>a</mi><mo>+</mo><mi>b</mi><mo>)</mo>' +
1006       '<mo>&#x00A6;</mo><mi>c</mi><mo>&#x00A6;</mo><mi>d</mi><mo>|</mo></mrow>',
1007       '<fenced>' +
1008       '<content>' +
1009       '<fence>|</fence>' +
1010       '<fence>|</fence>' +
1011       '</content>' +
1012       '<children>' +
1013       '<infixop>\u2062' +
1014       '<content>' +
1015       '<operator>\u2062</operator>' +
1016       '</content>' +
1017       '<children>' +
1018       '<fenced>' +
1019       '<content>' +
1020       '<fence>(</fence>' +
1021       '<fence>)</fence>' +
1022       '</content>' +
1023       '<children>' +
1024       '<infixop>+' +
1025       '<content>' +
1026       '<operator>+</operator>' +
1027       '</content>' +
1028       '<children>' +
1029       '<identifier>a</identifier>' +
1030       '<identifier>b</identifier>' +
1031       '</children>' +
1032       '</infixop>' +
1033       '</children>' +
1034       '</fenced>' +
1035       '<fenced>' +
1036       '<content>' +
1037       '<fence>\u00A6</fence>' +
1038       '<fence>\u00A6</fence>' +
1039       '</content>' +
1040       '<children>' +
1041       '<identifier>c</identifier>' +
1042       '</children>' +
1043       '</fenced>' +
1044       '<identifier>d</identifier>' +
1045       '</children>' +
1046       '</infixop>' +
1047       '</children>' +
1048       '</fenced>');
1049   // Parentheses inside bards.
1050   this.executeTreeTest(
1051       '<mrow><mo>[</mo><mo>|</mo><mi>a</mi><mo>+</mo><mi>b</mi><mo>|</mo>' +
1052       '<mo>+</mo><mi>c</mi><mo>]</mo><mo>+</mo><mo>\u00A6</mo><mi>d</mi>' +
1053       '<mo>+</mo><mo>(</mo><mi>e</mi><mo>+</mo><mi>f</mi><mo>)</mo>' +
1054       '<mo>\u00A6</mo></mrow>',
1055       '<infixop>+' +
1056       '<content>' +
1057       '<operator>+</operator>' +
1058       '</content>' +
1059       '<children>' +
1060       '<fenced>' +
1061       '<content>' +
1062       '<fence>[</fence>' +
1063       '<fence>]</fence>' +
1064       '</content>' +
1065       '<children>' +
1066       '<infixop>+' +
1067       '<content>' +
1068       '<operator>+</operator>' +
1069       '</content>' +
1070       '<children>' +
1071       '<fenced>' +
1072       '<content>' +
1073       '<fence>|</fence>' +
1074       '<fence>|</fence>' +
1075       '</content>' +
1076       '<children>' +
1077       '<infixop>+' +
1078       '<content>' +
1079       '<operator>+</operator>' +
1080       '</content>' +
1081       '<children>' +
1082       '<identifier>a</identifier>' +
1083       '<identifier>b</identifier>' +
1084       '</children>' +
1085       '</infixop>' +
1086       '</children>' +
1087       '</fenced>' +
1088       '<identifier>c</identifier>' +
1089       '</children>' +
1090       '</infixop>' +
1091       '</children>' +
1092       '</fenced>' +
1093       '<fenced>' +
1094       '<content>' +
1095       '<fence>\u00A6</fence>' +
1096       '<fence>\u00A6</fence>' +
1097       '</content>' +
1098       '<children>' +
1099       '<infixop>+' +
1100       '<content>' +
1101       '<operator>+</operator>' +
1102       '</content>' +
1103       '<children>' +
1104       '<identifier>d</identifier>' +
1105       '<fenced>' +
1106       '<content>' +
1107       '<fence>(</fence>' +
1108       '<fence>)</fence>' +
1109       '</content>' +
1110       '<children>' +
1111       '<infixop>+' +
1112       '<content>' +
1113       '<operator>+</operator>' +
1114       '</content>' +
1115       '<children>' +
1116       '<identifier>e</identifier>' +
1117       '<identifier>f</identifier>' +
1118       '</children>' +
1119       '</infixop>' +
1120       '</children>' +
1121       '</fenced>' +
1122       '</children>' +
1123       '</infixop>' +
1124       '</children>' +
1125       '</fenced>' +
1126       '</children>' +
1127       '</infixop>');
1128 });
1129
1130
1131 /**
1132  * Mixed with isolated bars.
1133  */
1134 TEST_F('CvoxSemanticTreeUnitTest', 'StreeMixedFencesWithBars', function() {
1135   this.brief = true;
1136   this.xpathBlacklist = ['descendant::punctuated/content'];
1137   // Set notation.
1138   this.executeTreeTest(
1139       '<mrow><mo>{</mo><mo>(</mo><mi>x</mi><mo>,</mo><mi>y</mi><mo>,</mo>' +
1140       '<mi>z</mi><mo>)</mo><mo>|</mo><mi>x</mi><mi>y</mi><mo>=</mo>' +
1141       '<mo>z</mo><mo>}</mo></mrow>',
1142       '<fenced>' +
1143       '<content>' +
1144       '<fence>{</fence>' +
1145       '<fence>}</fence>' +
1146       '</content>' +
1147       '<children>' +
1148       '<punctuated>' +
1149       '<children>' +
1150       '<fenced>' +
1151       '<content>' +
1152       '<fence>(</fence>' +
1153       '<fence>)</fence>' +
1154       '</content>' +
1155       '<children>' +
1156       '<punctuated>' +
1157       '<children>' +
1158       '<identifier>x</identifier>' +
1159       '<punctuation>,</punctuation>' +
1160       '<identifier>y</identifier>' +
1161       '<punctuation>,</punctuation>' +
1162       '<identifier>z</identifier>' +
1163       '</children>' +
1164       '</punctuated>' +
1165       '</children>' +
1166       '</fenced>' +
1167       '<punctuation>|</punctuation>' +
1168       '<relseq>=' +
1169       '<content>' +
1170       '<relation>=</relation>' +
1171       '</content>' +
1172       '<children>' +
1173       '<infixop>\u2062' +
1174       '<content>' +
1175       '<operator>\u2062</operator>' +
1176       '</content>' +
1177       '<children>' +
1178       '<identifier>x</identifier>' +
1179       '<identifier>y</identifier>' +
1180       '</children>' +
1181       '</infixop>' +
1182       '<identifier>z</identifier>' +
1183       '</children>' +
1184       '</relseq>' +
1185       '</children>' +
1186       '</punctuated>' +
1187       '</children>' +
1188       '</fenced>');
1189   // Disjunction of bracketed parallel statements.
1190   this.executeTreeTest(
1191       '<mrow><mo>[</mo><mi>a</mi><mo>&#x2016;</mo><mi>b</mi><mo>]</mo>' +
1192       '<mo>|</mo><mo>[</mo><mi>x</mi><mo>&#x2016;</mo><mi>y</mi><mo>]</mo>' +
1193       '</mrow>',
1194       '<punctuated>' +
1195       '<children>' +
1196       '<fenced>' +
1197       '<content>' +
1198       '<fence>[</fence>' +
1199       '<fence>]</fence>' +
1200       '</content>' +
1201       '<children>' +
1202       '<punctuated>' +
1203       '<children>' +
1204       '<identifier>a</identifier>' +
1205       '<punctuation>\u2016</punctuation>' +
1206       '<identifier>b</identifier>' +
1207       '</children>' +
1208       '</punctuated>' +
1209       '</children>' +
1210       '</fenced>' +
1211       '<punctuation>|</punctuation>' +
1212       '<fenced>' +
1213       '<content>' +
1214       '<fence>[</fence>' +
1215       '<fence>]</fence>' +
1216       '</content>' +
1217       '<children>' +
1218       '<punctuated>' +
1219       '<children>' +
1220       '<identifier>x</identifier>' +
1221       '<punctuation>\u2016</punctuation>' +
1222       '<identifier>y</identifier>' +
1223       '</children>' +
1224       '</punctuated>' +
1225       '</children>' +
1226       '</fenced>' +
1227       '</children>' +
1228       '</punctuated>'
1229   );
1230   // Metric over the above.
1231   this.executeTreeTest(
1232       '<mrow><mo>&#x2016;</mo><mo>[</mo><mi>a</mi><mo>&#x2016;</mo>' +
1233       '<mi>b</mi><mo>]</mo><mo>|</mo><mo>[</mo><mi>x</mi><mo>&#x2016;</mo>' +
1234       '<mi>y</mi><mo>]</mo><mo>&#x2016;</mo></mrow>',
1235       '<fenced>' +
1236       '<content>' +
1237       '<fence>\u2016</fence>' +
1238       '<fence>\u2016</fence>' +
1239       '</content>' +
1240       '<children>' +
1241       '<punctuated>' +
1242       '<children>' +
1243       '<fenced>' +
1244       '<content>' +
1245       '<fence>[</fence>' +
1246       '<fence>]</fence>' +
1247       '</content>' +
1248       '<children>' +
1249       '<punctuated>' +
1250       '<children>' +
1251       '<identifier>a</identifier>' +
1252       '<punctuation>\u2016</punctuation>' +
1253       '<identifier>b</identifier>' +
1254       '</children>' +
1255       '</punctuated>' +
1256       '</children>' +
1257       '</fenced>' +
1258       '<punctuation>|</punctuation>' +
1259       '<fenced>' +
1260       '<content>' +
1261       '<fence>[</fence>' +
1262       '<fence>]</fence>' +
1263       '</content>' +
1264       '<children>' +
1265       '<punctuated>' +
1266       '<children>' +
1267       '<identifier>x</identifier>' +
1268       '<punctuation>\u2016</punctuation>' +
1269       '<identifier>y</identifier>' +
1270       '</children>' +
1271       '</punctuated>' +
1272       '</children>' +
1273       '</fenced>' +
1274       '</children>' +
1275       '</punctuated>' +
1276       '</children>' +
1277       '</fenced>');
1278   // Mix of metrics and bracketed expression and single bars.
1279   this.executeTreeTest(
1280       '<mrow><mo>&#x2016;</mo><mo>[</mo><mi>a</mi><mo>&#x2016;</mo><mi>b</mi>' +
1281       '<mo>]</mo><mo>|</mo><mo>[</mo><mi>c</mi><mo>&#x2016;</mo>' +
1282       '<mo>&#x00A6;</mo><mi>d</mi><mo>]</mo><mo>&#x2016;</mo><mo>[</mo>' +
1283       '<mi>u</mi><mo>&#x2016;</mo><mi>v</mi><mo>]</mo><mo>|</mo><mi>x</mi>' +
1284       '<mo>&#x2016;</mo><mi>y</mi><mo>&#x00A6;</mo><mi>z</mi></mrow>',
1285       '<punctuated>' +
1286       '<children>' +
1287       '<infixop>\u2062' +
1288       '<content>' +
1289       '<operator>\u2062</operator>' +
1290       '</content>' +
1291       '<children>' +
1292       '<fenced>' +
1293       '<content>' +
1294       '<fence>\u2016</fence>' +
1295       '<fence>\u2016</fence>' +
1296       '</content>' +
1297       '<children>' +
1298       '<punctuated>' +
1299       '<children>' +
1300       '<fenced>' +
1301       '<content>' +
1302       '<fence>[</fence>' +
1303       '<fence>]</fence>' +
1304       '</content>' +
1305       '<children>' +
1306       '<punctuated>' +
1307       '<children>' +
1308       '<identifier>a</identifier>' +
1309       '<punctuation>\u2016</punctuation>' +
1310       '<identifier>b</identifier>' +
1311       '</children>' +
1312       '</punctuated>' +
1313       '</children>' +
1314       '</fenced>' +
1315       '<punctuation>|</punctuation>' +
1316       '<fenced>' +
1317       '<content>' +
1318       '<fence>[</fence>' +
1319       '<fence>]</fence>' +
1320       '</content>' +
1321       '<children>' +
1322       '<punctuated>' +
1323       '<children>' +
1324       '<identifier>c</identifier>' +
1325       '<punctuation>\u2016</punctuation>' +
1326       '<punctuation>\u00A6</punctuation>' +
1327       '<identifier>d</identifier>' +
1328       '</children>' +
1329       '</punctuated>' +
1330       '</children>' +
1331       '</fenced>' +
1332       '</children>' +
1333       '</punctuated>' +
1334       '</children>' +
1335       '</fenced>' +
1336       '<fenced>' +
1337       '<content>' +
1338       '<fence>[</fence>' +
1339       '<fence>]</fence>' +
1340       '</content>' +
1341       '<children>' +
1342       '<punctuated>' +
1343       '<children>' +
1344       '<identifier>u</identifier>' +
1345       '<punctuation>\u2016</punctuation>' +
1346       '<identifier>v</identifier>' +
1347       '</children>' +
1348       '</punctuated>' +
1349       '</children>' +
1350       '</fenced>' +
1351       '</children>' +
1352       '</infixop>' +
1353       '<punctuation>|</punctuation>' +
1354       '<identifier>x</identifier>' +
1355       '<punctuation>\u2016</punctuation>' +
1356       '<identifier>y</identifier>' +
1357       '<punctuation>\u00A6</punctuation>' +
1358       '<identifier>z</identifier>' +
1359       '</children>' +
1360       '</punctuated>');
1361   this.xpathBlacklist = [];
1362 });
1363
1364
1365 /**
1366  * Pathological cases with only opening fences.
1367  */
1368 TEST_F('CvoxSemanticTreeUnitTest', 'StreeOpeningFencesOnly', function() {
1369   this.brief = true;
1370   this.xpathBlacklist = ['descendant::punctuated/content'];
1371   // Single.
1372   this.executeTreeTest(
1373       '<mrow><mo>[</mo></mrow>',
1374       '<fence>[</fence>');
1375   // Single right.
1376   this.executeTreeTest(
1377       '<mrow><mi>a</mi><mo>[</mo></mrow>',
1378       '<punctuated>' +
1379       '<children>' +
1380       '<identifier>a</identifier>' +
1381       '<punctuation>[</punctuation>' +
1382       '</children>' +
1383       '</punctuated>');
1384   // Single middle.
1385   this.executeTreeTest(
1386       '<mrow><mi>a</mi><mo>[</mo><mi>b</mi></mrow>',
1387       '<punctuated>' +
1388       '<children>' +
1389       '<identifier>a</identifier>' +
1390       '<punctuation>[</punctuation>' +
1391       '<identifier>b</identifier>' +
1392       '</children>' +
1393       '</punctuated>');
1394   // Single left.
1395   this.executeTreeTest(
1396    '<mrow><mo>[</mo><mi>b</mi></mrow>',
1397    '<punctuated>' +
1398    '<children>' +
1399    '<punctuation>[</punctuation>' +
1400    '<identifier>b</identifier>' +
1401    '</children>' +
1402    '</punctuated>');
1403   // Multiple.
1404   this.executeTreeTest(
1405       '<mrow><mi>a</mi><mo>[</mo><mi>b</mi><mi>c</mi><mo>(</mo><mi>d</mi>' +
1406       '<mo>{</mo><mi>e</mi><mo>&#x3008;</mo><mi>f</mi></mrow>',
1407       '<punctuated>' +
1408       '<children>' +
1409       '<identifier>a</identifier>' +
1410       '<punctuation>[</punctuation>' +
1411       '<infixop>\u2062' +
1412       '<content>' +
1413       '<operator>\u2062</operator>' +
1414       '</content>' +
1415       '<children>' +
1416       '<identifier>b</identifier>' +
1417       '<identifier>c</identifier>' +
1418       '</children>' +
1419       '</infixop>' +
1420       '<punctuation>(</punctuation>' +
1421       '<identifier>d</identifier>' +
1422       '<punctuation>{</punctuation>' +
1423       '<identifier>e</identifier>' +
1424       '<punctuation>\u3008</punctuation>' +
1425       '<identifier>f</identifier>' +
1426       '</children>' +
1427       '</punctuated>');
1428   // Multiple plus inner fenced.
1429   this.executeTreeTest(
1430       '<mrow><mi>a</mi><mo>[</mo><mi>b</mi><mo>[</mo><mo>(</mo><mo>(</mo>' +
1431       '<mi>c</mi><mo>)</mo><mi>d</mi><mo>{</mo><mi>e</mi><mo>&#x3008;</mo>' +
1432       '<mi>f</mi></mrow>',
1433       '<punctuated>' +
1434       '<children>' +
1435       '<identifier>a</identifier>' +
1436       '<punctuation>[</punctuation>' +
1437       '<identifier>b</identifier>' +
1438       '<punctuation>[</punctuation>' +
1439       '<punctuation>(</punctuation>' +
1440       '<infixop>\u2062' +
1441       '<content>' +
1442       '<operator>\u2062</operator>' +
1443       '</content>' +
1444       '<children>' +
1445       '<fenced>' +
1446       '<content>' +
1447       '<fence>(</fence>' +
1448       '<fence>)</fence>' +
1449       '</content>' +
1450       '<children>' +
1451       '<identifier>c</identifier>' +
1452       '</children>' +
1453       '</fenced>' +
1454       '<identifier>d</identifier>' +
1455       '</children>' +
1456       '</infixop>' +
1457       '<punctuation>{</punctuation>' +
1458       '<identifier>e</identifier>' +
1459       '<punctuation>\u3008</punctuation>' +
1460       '<identifier>f</identifier>' +
1461       '</children>' +
1462       '</punctuated>');
1463   this.xpathBlacklist = [];
1464 });
1465
1466
1467 /**
1468  * Pathological cases with only closing fences.
1469  */
1470 TEST_F('CvoxSemanticTreeUnitTest', 'StreeClosingFencesOnly', function() {
1471   this.brief = true;
1472   this.xpathBlacklist = ['descendant::punctuated/content'];
1473   // Single.
1474   this.executeTreeTest(
1475       '<mrow><mo>]</mo></mrow>',
1476       '<fence>]</fence>');
1477   // Single right.
1478   this.executeTreeTest(
1479       '<mrow><mi>a</mi><mo>]</mo></mrow>',
1480       '<punctuated>' +
1481       '<children>' +
1482       '<identifier>a</identifier>' +
1483       '<punctuation>]</punctuation>' +
1484       '</children>' +
1485       '</punctuated>');
1486   // Single middle.
1487   this.executeTreeTest(
1488       '<mrow><mi>a</mi><mo>]</mo><mi>b</mi></mrow>',
1489       '<punctuated>' +
1490       '<children>' +
1491       '<identifier>a</identifier>' +
1492       '<punctuation>]</punctuation>' +
1493       '<identifier>b</identifier>' +
1494       '</children>' +
1495       '</punctuated>');
1496   // Single left.
1497   this.executeTreeTest(
1498       '<mrow><mo>]</mo><mi>b</mi></mrow>',
1499       '<punctuated>' +
1500       '<children>' +
1501       '<punctuation>]</punctuation>' +
1502       '<identifier>b</identifier>' +
1503       '</children>' +
1504       '</punctuated>');
1505   // Multiple.
1506   this.executeTreeTest(
1507       '<mrow><mi>a</mi><mo>]</mo><mi>b</mi><mi>c</mi><mo>)</mo><mi>d</mi>' +
1508       '<mo>}</mo><mi>e</mi><mo>&#x3009;</mo><mi>f</mi></mrow>',
1509       '<punctuated>' +
1510       '<children>' +
1511       '<identifier>a</identifier>' +
1512       '<punctuation>]</punctuation>' +
1513       '<infixop>\u2062' +
1514       '<content>' +
1515       '<operator>\u2062</operator>' +
1516       '</content>' +
1517       '<children>' +
1518       '<identifier>b</identifier>' +
1519       '<identifier>c</identifier>' +
1520       '</children>' +
1521       '</infixop>' +
1522       '<punctuation>)</punctuation>' +
1523       '<identifier>d</identifier>' +
1524       '<punctuation>}</punctuation>' +
1525       '<identifier>e</identifier>' +
1526       '<punctuation>\u3009</punctuation>' +
1527       '<identifier>f</identifier>' +
1528       '</children>' +
1529       '</punctuated>');
1530   // Multiple plus inner fenced.
1531   this.executeTreeTest(
1532       '<mrow><mi>a</mi><mo>]</mo><mi>b</mi><mo>]</mo><mo>(</mo><mi>c</mi>' +
1533       '<mo>)</mo><mo>)</mo><mi>d</mi><mo>}</mo><mi>e</mi><mo>&#x3009;</mo>' +
1534       '<mi>f</mi></mrow>',
1535       '<punctuated>' +
1536       '<children>' +
1537       '<identifier>a</identifier>' +
1538       '<punctuation>]</punctuation>' +
1539       '<identifier>b</identifier>' +
1540       '<punctuation>]</punctuation>' +
1541       '<fenced>' +
1542       '<content>' +
1543       '<fence>(</fence>' +
1544       '<fence>)</fence>' +
1545       '</content>' +
1546       '<children>' +
1547       '<identifier>c</identifier>' +
1548       '</children>' +
1549       '</fenced>' +
1550       '<punctuation>)</punctuation>' +
1551       '<identifier>d</identifier>' +
1552       '<punctuation>}</punctuation>' +
1553       '<identifier>e</identifier>' +
1554       '<punctuation>\u3009</punctuation>' +
1555       '<identifier>f</identifier>' +
1556       '</children>' +
1557       '</punctuated>');
1558   this.xpathBlacklist = [];
1559 });
1560
1561
1562 /**
1563  * Pathological cases with only neutral fences.
1564  */
1565 TEST_F('CvoxSemanticTreeUnitTest', 'StreeNeutralFencesOnly', function() {
1566   this.brief = true;
1567   this.xpathBlacklist = ['descendant::punctuated/content'];
1568   // Single.
1569   this.executeTreeTest(
1570       '<mrow><mo>|</mo></mrow>',
1571       '<fence>|</fence>');
1572   // Single right.
1573   this.executeTreeTest(
1574       '<mrow><mi>a</mi><mo>|</mo></mrow>',
1575       '<punctuated>' +
1576       '<children>' +
1577       '<identifier>a</identifier>' +
1578       '<punctuation>|</punctuation>' +
1579       '</children>' +
1580       '</punctuated>');
1581   // Single middle.
1582   this.executeTreeTest(
1583       '<mrow><mi>a</mi><mo>|</mo><mi>b</mi></mrow>',
1584       '<punctuated>' +
1585       '<children>' +
1586       '<identifier>a</identifier>' +
1587       '<punctuation>|</punctuation>' +
1588       '<identifier>b</identifier>' +
1589       '</children>' +
1590       '</punctuated>');
1591   // Single left.
1592   this.executeTreeTest(
1593       '<mrow><mo>|</mo><mi>b</mi></mrow>',
1594       '<punctuated>' +
1595       '<children>' +
1596       '<punctuation>|</punctuation>' +
1597       '<identifier>b</identifier>' +
1598       '</children>' +
1599       '</punctuated>');
1600   // Two different bars.
1601   this.executeTreeTest(
1602       '<mrow><mi>a</mi><mo>|</mo><mi>b</mi><mo>&#x00A6;</mo><mi>c</mi></mrow>',
1603       '<punctuated>' +
1604       '<children>' +
1605       '<identifier>a</identifier>' +
1606       '<punctuation>|</punctuation>' +
1607       '<identifier>b</identifier>' +
1608       '<punctuation>\u00A6</punctuation>' +
1609       '<identifier>c</identifier>' +
1610       '</children>' +
1611       '</punctuated>');
1612   // Three different bars.
1613   this.executeTreeTest(
1614       '<mrow><mi>a</mi><mo>&#x2016;</mo><mi>b</mi><mo>|</mo><mi>c</mi>' +
1615       '<mo>&#x00A6;</mo><mi>d</mi></mrow>',
1616       '<punctuated>' +
1617       '<children>' +
1618       '<identifier>a</identifier>' +
1619       '<punctuation>\u2016</punctuation>' +
1620       '<identifier>b</identifier>' +
1621       '<punctuation>|</punctuation>' +
1622       '<identifier>c</identifier>' +
1623       '<punctuation>\u00A6</punctuation>' +
1624       '<identifier>d</identifier>' +
1625       '</children>' +
1626       '</punctuated>');
1627   // Multiple plus inner fenced.
1628   this.executeTreeTest(
1629       '<mrow><mo>&#x2016;</mo><mo>[</mo><mi>a</mi><mo>&#x2016;</mo><mi>b</mi>' +
1630       '<mo>]</mo><mo>&#x2016;</mo><mo>|</mo><mi>x</mi><mo>&#x2016;</mo>' +
1631       '<mi>y</mi><mo>&#x00A6;</mo><mi>z</mi></mrow>',
1632       '<punctuated>' +
1633       '<children>' +
1634       '<fenced>' +
1635       '<content>' +
1636       '<fence>\u2016</fence>' +
1637       '<fence>\u2016</fence>' +
1638       '</content>' +
1639       '<children>' +
1640       '<fenced>' +
1641       '<content>' +
1642       '<fence>[</fence>' +
1643       '<fence>]</fence>' +
1644       '</content>' +
1645       '<children>' +
1646       '<punctuated>' +
1647       '<children>' +
1648       '<identifier>a</identifier>' +
1649       '<punctuation>\u2016</punctuation>' +
1650       '<identifier>b</identifier>' +
1651       '</children>' +
1652       '</punctuated>' +
1653       '</children>' +
1654       '</fenced>' +
1655       '</children>' +
1656       '</fenced>' +
1657       '<punctuation>|</punctuation>' +
1658       '<identifier>x</identifier>' +
1659       '<punctuation>\u2016</punctuation>' +
1660       '<identifier>y</identifier>' +
1661       '<punctuation>\u00A6</punctuation>' +
1662       '<identifier>z</identifier>' +
1663       '</children>' +
1664       '</punctuated>');
1665   this.xpathBlacklist = [];
1666 });
1667
1668
1669 /**
1670  * Pathological cases with mixed fences.
1671  */
1672 TEST_F('CvoxSemanticTreeUnitTest', 'StreeMixedUnmatchedFences', function() {
1673   this.brief = true;
1674   this.xpathBlacklist = ['descendant::punctuated/content'];
1675   // Close, neutral, open.
1676   this.executeTreeTest(
1677       '<mrow><mo>]</mo><mo>&#x2016;</mo><mi>b</mi><mo>|</mo><mi>c</mi>' +
1678       '<mo>(</mo></mrow>',
1679       '<punctuated>' +
1680       '<children>' +
1681       '<punctuation>]</punctuation>' +
1682       '<punctuation>\u2016</punctuation>' +
1683       '<identifier>b</identifier>' +
1684       '<punctuation>|</punctuation>' +
1685       '<identifier>c</identifier>' +
1686       '<punctuation>(</punctuation>' +
1687       '</children>' +
1688       '</punctuated>');
1689   // Neutrals and close.
1690   this.executeTreeTest(
1691       '<mrow><mi>a</mi><mo>&#x2016;</mo><mi>b</mi><mo>|</mo><mi>c</mi>' +
1692       '<mo>&#x00A6;</mo><mi>d</mi><mo>]</mo><mi>e</mi></mrow>',
1693       '<punctuated>' +
1694       '<children>' +
1695       '<identifier>a</identifier>' +
1696       '<punctuation>\u2016</punctuation>' +
1697       '<identifier>b</identifier>' +
1698       '<punctuation>|</punctuation>' +
1699       '<identifier>c</identifier>' +
1700       '<punctuation>\u00A6</punctuation>' +
1701       '<identifier>d</identifier>' +
1702       '<punctuation>]</punctuation>' +
1703       '<identifier>e</identifier>' +
1704       '</children>' +
1705       '</punctuated>');
1706   // Neutrals and open.
1707   this.executeTreeTest(
1708       '<mrow><mo>[</mo><mi>a</mi><mo>&#x2016;</mo><mi>b</mi><mo>|</mo>' +
1709       '<mi>c</mi><mo>&#x00A6;</mo><mi>d</mi></mrow>',
1710       '<punctuated>' +
1711       '<children>' +
1712       '<punctuation>[</punctuation>' +
1713       '<identifier>a</identifier>' +
1714       '<punctuation>\u2016</punctuation>' +
1715       '<identifier>b</identifier>' +
1716       '<punctuation>|</punctuation>' +
1717       '<identifier>c</identifier>' +
1718       '<punctuation>\u00A6</punctuation>' +
1719       '<identifier>d</identifier>' +
1720       '</children>' +
1721       '</punctuated>');
1722   // Multiple fences, fenced and operations
1723   this.executeTreeTest(
1724       '<mrow><mo>&#x2016;</mo><mo>[</mo><mi>a</mi><mo>&#x2016;</mo><mi>b</mi>' +
1725       '<mo>]</mo><mo>|</mo><mo>[</mo><mi>c</mi><mo>&#x2016;</mo>' +
1726       '<mo>&#x00A6;</mo><mi>d</mi><mo>]</mo><mo>&#x2016;</mo><mo>|</mo>' +
1727       '<mi>x</mi><mo>&#x2016;</mo><mi>y</mi><mo>&#x00A6;</mo><mi>z</mi>' +
1728       '<mo>]</mo></mrow>',
1729       '<punctuated>' +
1730       '<children>' +
1731       '<fenced>' +
1732       '<content>' +
1733       '<fence>\u2016</fence>' +
1734       '<fence>\u2016</fence>' +
1735       '</content>' +
1736       '<children>' +
1737       '<punctuated>' +
1738       '<children>' +
1739       '<fenced>' +
1740       '<content>' +
1741       '<fence>[</fence>' +
1742       '<fence>]</fence>' +
1743       '</content>' +
1744       '<children>' +
1745       '<punctuated>' +
1746       '<children>' +
1747       '<identifier>a</identifier>' +
1748       '<punctuation>\u2016</punctuation>' +
1749       '<identifier>b</identifier>' +
1750       '</children>' +
1751       '</punctuated>' +
1752       '</children>' +
1753       '</fenced>' +
1754       '<punctuation>|</punctuation>' +
1755       '<fenced>' +
1756       '<content>' +
1757       '<fence>[</fence>' +
1758       '<fence>]</fence>' +
1759       '</content>' +
1760       '<children>' +
1761       '<punctuated>' +
1762       '<children>' +
1763       '<identifier>c</identifier>' +
1764       '<punctuation>\u2016</punctuation>' +
1765       '<punctuation>\u00A6</punctuation>' +
1766       '<identifier>d</identifier>' +
1767       '</children>' +
1768       '</punctuated>' +
1769       '</children>' +
1770       '</fenced>' +
1771       '</children>' +
1772       '</punctuated>' +
1773       '</children>' +
1774       '</fenced>' +
1775       '<punctuation>|</punctuation>' +
1776       '<identifier>x</identifier>' +
1777       '<punctuation>\u2016</punctuation>' +
1778       '<identifier>y</identifier>' +
1779       '<punctuation>\u00A6</punctuation>' +
1780       '<identifier>z</identifier>' +
1781       '<punctuation>]</punctuation>' +
1782       '</children>' +
1783       '</punctuated>');
1784   // Multiple fences, fenced and operations
1785   this.executeTreeTest(
1786       '<mrow><mo>&#x2016;</mo><mo>]</mo><mo>&#x00A6;</mo><mo>&#x2016;</mo>' +
1787       '<mo>[</mo><mo>|</mo><mo>[</mo><mi>a</mi><mo>&#x2016;</mo><mi>b</mi>' +
1788       '<mo>]</mo><mo>&#x2016;</mo><mo>|</mo><mi>[</mi><mo>&#x2016;</mo>' +
1789       '<mi>y</mi><mo>&#x00A6;</mo><mi>z</mi></mrow>',
1790       '<punctuated>' +
1791       '<children>' +
1792       '<fenced>' +
1793       '<content>' +
1794       '<fence>\u2016</fence>' +
1795       '<fence>\u2016</fence>' +
1796       '</content>' +
1797       '<children>' +
1798       '<punctuated>' +
1799       '<children>' +
1800       '<punctuation>]</punctuation>' +
1801       '<punctuation>\u00A6</punctuation>' +
1802       '</children>' +
1803       '</punctuated>' +
1804       '</children>' +
1805       '</fenced>' +
1806       '<punctuation>[</punctuation>' +
1807       '<fenced>' +
1808       '<content>' +
1809       '<fence>|</fence>' +
1810       '<fence>|</fence>' +
1811       '</content>' +
1812       '<children>' +
1813       '<punctuated>' +
1814       '<children>' +
1815       '<fenced>' +
1816       '<content>' +
1817       '<fence>[</fence>' +
1818       '<fence>]</fence>' +
1819       '</content>' +
1820       '<children>' +
1821       '<punctuated>' +
1822       '<children>' +
1823       '<identifier>a</identifier>' +
1824       '<punctuation>\u2016</punctuation>' +
1825       '<identifier>b</identifier>' +
1826       '</children>' +
1827       '</punctuated>' +
1828       '</children>' +
1829       '</fenced>' +
1830       '<punctuation>\u2016</punctuation>' +
1831       '</children>' +
1832       '</punctuated>' +
1833       '</children>' +
1834       '</fenced>' +
1835       '<punctuation>[</punctuation>' +
1836       '<punctuation>\u2016</punctuation>' +
1837       '<identifier>y</identifier>' +
1838       '<punctuation>\u00A6</punctuation>' +
1839       '<identifier>z</identifier>' +
1840       '</children>' +
1841       '</punctuated>');
1842   // Multiple fences, fenced and operations
1843   this.executeTreeTest(
1844       '<mrow><mo>&#x2016;</mo><mo>[</mo><mi>a</mi><mo>&#x00A6;</mo>' +
1845       '<mo>&#x2016;</mo><mo>[</mo><mo>+</mo><mo>[</mo><mi>b</mi>' +
1846       '<mo>&#x2016;</mo><mi>c</mi><mo>]</mo><mo>+</mo><mo>&#x2016;</mo>' +
1847       '<mo>|</mo><mi>d</mi><mo>+</mo><mi>e</mi><mi>[</mi><mo>&#x2016;</mo>' +
1848       '<mi>y</mi><mo>&#x00A6;</mo><mo>+</mo><mi>z</mi></mrow>',
1849       '<punctuated>' +
1850       '<children>' +
1851       '<punctuation>\u2016</punctuation>' +
1852       '<punctuation>[</punctuation>' +
1853       '<identifier>a</identifier>' +
1854       '<punctuation>\u00A6</punctuation>' +
1855       '<punctuation>\u2016</punctuation>' +
1856       '<punctuation>[</punctuation>' +
1857       '<postfixop>+' +
1858       '<content>' +
1859       '<operator>+</operator>' +
1860       '</content>' +
1861       '<children>' +
1862       '<prefixop>+' +
1863       '<content>' +
1864       '<operator>+</operator>' +
1865       '</content>' +
1866       '<children>' +
1867       '<fenced>' +
1868       '<content>' +
1869       '<fence>[</fence>' +
1870       '<fence>]</fence>' +
1871       '</content>' +
1872       '<children>' +
1873       '<punctuated>' +
1874       '<children>' +
1875       '<identifier>b</identifier>' +
1876       '<punctuation>\u2016</punctuation>' +
1877       '<identifier>c</identifier>' +
1878       '</children>' +
1879       '</punctuated>' +
1880       '</children>' +
1881       '</fenced>' +
1882       '</children>' +
1883       '</prefixop>' +
1884       '</children>' +
1885       '</postfixop>' +
1886       '<punctuation>\u2016</punctuation>' +
1887       '<punctuation>|</punctuation>' +
1888       '<infixop>+' +
1889       '<content>' +
1890       '<operator>+</operator>' +
1891       '</content>' +
1892       '<children>' +
1893       '<identifier>d</identifier>' +
1894       '<identifier>e</identifier>' +
1895       '</children>' +
1896       '</infixop>' +
1897       '<punctuation>[</punctuation>' +
1898       '<punctuation>\u2016</punctuation>' +
1899       '<identifier>y</identifier>' +
1900       '<punctuation>\u00A6</punctuation>' +
1901       '<prefixop>+' +
1902       '<content>' +
1903       '<operator>+</operator>' +
1904       '</content>' +
1905       '<children>' +
1906       '<identifier>z</identifier>' +
1907       '</children>' +
1908       '</prefixop>' +
1909       '</children>' +
1910       '</punctuated>');
1911   this.xpathBlacklist = [];
1912 });
1913
1914
1915 /**
1916  * Simple function applications
1917  */
1918 TEST_F('CvoxSemanticTreeUnitTest', 'StreeSimpleFuncsSingle', function() {
1919   this.brief = true;
1920   this.executeTreeTest(
1921       '<mrow><mi>f</mi></mrow>',
1922       '<identifier>f</identifier>');
1923
1924   this.executeTreeTest(
1925       '<mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo></mrow>',
1926       '<appl>' +
1927       '<content>' +
1928       '<punctuation>\u2061</punctuation>' +
1929       '</content>' +
1930       '<children>' +
1931       '<identifier>f</identifier>' +
1932       '<fenced>' +
1933       '<content>' +
1934       '<fence>(</fence>' +
1935       '<fence>)</fence>' +
1936       '</content>' +
1937       '<children>' +
1938       '<identifier>x</identifier>' +
1939       '</children>' +
1940       '</fenced>' +
1941       '</children>' +
1942       '</appl>');
1943
1944   this.executeTreeTest(
1945       '<mrow><mi>f</mi><mo>(</mo><mi>x</mi><mi>y</mi><mo>)</mo></mrow>',
1946       '<appl>' +
1947       '<content>' +
1948       '<punctuation>\u2061</punctuation>' +
1949       '</content>' +
1950       '<children>' +
1951       '<identifier>f</identifier>' +
1952       '<fenced>' +
1953       '<content>' +
1954       '<fence>(</fence>' +
1955       '<fence>)</fence>' +
1956       '</content>' +
1957       '<children>' +
1958       '<infixop>\u2062' +
1959       '<content>' +
1960       '<operator>\u2062</operator>' +
1961       '</content>' +
1962       '<children>' +
1963       '<identifier>x</identifier>' +
1964       '<identifier>y</identifier>' +
1965       '</children>' +
1966       '</infixop>' +
1967       '</children>' +
1968       '</fenced>' +
1969       '</children>' +
1970       '</appl>');
1971
1972   this.executeTreeTest(
1973       '<mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>,</mo><mi>y</mi>' +
1974       '<mo>,</mo><mi>z</mi><mo>)</mo></mrow>',
1975       '<appl>' +
1976       '<content>' +
1977       '<punctuation>\u2061</punctuation>' +
1978       '</content>' +
1979       '<children>' +
1980       '<identifier>f</identifier>' +
1981       '<fenced>' +
1982       '<content>' +
1983       '<fence>(</fence>' +
1984       '<fence>)</fence>' +
1985       '</content>' +
1986       '<children>' +
1987       '<punctuated>' +
1988       '<content>' +
1989       '<punctuation>,</punctuation>' +
1990       '<punctuation>,</punctuation>' +
1991       '</content>' +
1992       '<children>' +
1993       '<identifier>x</identifier>' +
1994       '<punctuation>,</punctuation>' +
1995       '<identifier>y</identifier>' +
1996       '<punctuation>,</punctuation>' +
1997       '<identifier>z</identifier>' +
1998       '</children>' +
1999       '</punctuated>' +
2000       '</children>' +
2001       '</fenced>' +
2002       '</children>' +
2003       '</appl>');
2004
2005   this.executeTreeTest(
2006       '<mrow><mi>f</mi><mo>(</mo><msup><mi>x</mi><mn>2</mn></msup>' +
2007       '<mo>)</mo></mrow>',
2008       '<appl>' +
2009       '<content>' +
2010       '<punctuation>\u2061</punctuation>' +
2011       '</content>' +
2012       '<children>' +
2013       '<identifier>f</identifier>' +
2014       '<fenced>' +
2015       '<content>' +
2016       '<fence>(</fence>' +
2017       '<fence>)</fence>' +
2018       '</content>' +
2019       '<children>' +
2020       '<superscript>' +
2021       '<children>' +
2022       '<identifier>x</identifier>' +
2023       '<number>2</number>' +
2024       '</children>' +
2025       '</superscript>' +
2026       '</children>' +
2027       '</fenced>' +
2028       '</children>' +
2029       '</appl>');
2030
2031   this.executeTreeTest(
2032       '<mrow><mi>f</mi><mo>(</mo><msub><mi>x</mi><mn>2</mn></msub>' +
2033       '<mo>)</mo></mrow>',
2034       '<appl>' +
2035       '<content>' +
2036       '<punctuation>\u2061</punctuation>' +
2037       '</content>' +
2038       '<children>' +
2039       '<identifier>f</identifier>' +
2040       '<fenced>' +
2041       '<content>' +
2042       '<fence>(</fence>' +
2043       '<fence>)</fence>' +
2044       '</content>' +
2045       '<children>' +
2046       '<subscript>' +
2047       '<children>' +
2048       '<identifier>x</identifier>' +
2049       '<number>2</number>' +
2050       '</children>' +
2051       '</subscript>' +
2052       '</children>' +
2053       '</fenced>' +
2054       '</children>' +
2055       '</appl>');
2056
2057   this.executeTreeTest(
2058       '<mrow><mi>f</mi><mo>(</mo><msubsup><mi>x</mi><mn>2</mn>' +
2059       '<mn>1</mn></msubsup><mo>)</mo></mrow>',
2060       '<appl>' +
2061       '<content>' +
2062       '<punctuation>\u2061</punctuation>' +
2063       '</content>' +
2064       '<children>' +
2065       '<identifier>f</identifier>' +
2066       '<fenced>' +
2067       '<content>' +
2068       '<fence>(</fence>' +
2069       '<fence>)</fence>' +
2070       '</content>' +
2071       '<children>' +
2072       '<superscript>' +
2073       '<children>' +
2074       '<subscript>' +
2075       '<children>' +
2076       '<identifier>x</identifier>' +
2077       '<number>2</number>' +
2078       '</children>' +
2079       '</subscript>' +
2080       '<number>1</number>' +
2081       '</children>' +
2082       '</superscript>' +
2083       '</children>' +
2084       '</fenced>' +
2085       '</children>' +
2086       '</appl>');
2087
2088   this.executeTreeTest(
2089       '<mrow><mi>f</mi><mo>(</mo><mover><mi>x</mi><mn>2</mn></mover>' +
2090       '<mo>)</mo></mrow>',
2091       '<appl>' +
2092       '<content>' +
2093       '<punctuation>\u2061</punctuation>' +
2094       '</content>' +
2095       '<children>' +
2096       '<identifier>f</identifier>' +
2097       '<fenced>' +
2098       '<content>' +
2099       '<fence>(</fence>' +
2100       '<fence>)</fence>' +
2101       '</content>' +
2102       '<children>' +
2103       '<overscore>' +
2104       '<children>' +
2105       '<identifier>x</identifier>' +
2106       '<number>2</number>' +
2107       '</children>' +
2108       '</overscore>' +
2109       '</children>' +
2110       '</fenced>' +
2111       '</children>' +
2112       '</appl>');
2113
2114   this.executeTreeTest(
2115       '<mrow><mi>f</mi><mo>(</mo><munder><mi>x</mi><mn>2</mn></munder>' +
2116       '<mo>)</mo></mrow>',
2117       '<appl>' +
2118       '<content>' +
2119       '<punctuation>\u2061</punctuation>' +
2120       '</content>' +
2121       '<children>' +
2122       '<identifier>f</identifier>' +
2123       '<fenced>' +
2124       '<content>' +
2125       '<fence>(</fence>' +
2126       '<fence>)</fence>' +
2127       '</content>' +
2128       '<children>' +
2129       '<underscore>' +
2130       '<children>' +
2131       '<identifier>x</identifier>' +
2132       '<number>2</number>' +
2133       '</children>' +
2134       '</underscore>' +
2135       '</children>' +
2136       '</fenced>' +
2137       '</children>' +
2138       '</appl>');
2139
2140   this.executeTreeTest(
2141       '<mrow><mi>f</mi><mo>(</mo><munderover><mi>x</mi><mn>2</mn>' +
2142       '<mn>1</mn></munderover><mo>)</mo></mrow>',
2143       '<appl>' +
2144       '<content>' +
2145       '<punctuation>\u2061</punctuation>' +
2146       '</content>' +
2147       '<children>' +
2148       '<identifier>f</identifier>' +
2149       '<fenced>' +
2150       '<content>' +
2151       '<fence>(</fence>' +
2152       '<fence>)</fence>' +
2153       '</content>' +
2154       '<children>' +
2155       '<overscore>' +
2156       '<children>' +
2157       '<underscore>' +
2158       '<children>' +
2159       '<identifier>x</identifier>' +
2160       '<number>2</number>' +
2161       '</children>' +
2162       '</underscore>' +
2163       '<number>1</number>' +
2164       '</children>' +
2165       '</overscore>' +
2166       '</children>' +
2167       '</fenced>' +
2168       '</children>' +
2169       '</appl>');
2170
2171   this.executeTreeTest(
2172       '<mrow><mi>f</mi><mo>(</mo><mfrac><mn>1</mn><mn>2</mn></mfrac>' +
2173       '<mo>)</mo></mrow>',
2174       '<appl>' +
2175       '<content>' +
2176       '<punctuation>\u2061</punctuation>' +
2177       '</content>' +
2178       '<children>' +
2179       '<identifier>f</identifier>' +
2180       '<fenced>' +
2181       '<content>' +
2182       '<fence>(</fence>' +
2183       '<fence>)</fence>' +
2184       '</content>' +
2185       '<children>' +
2186       '<fraction>' +
2187       '<children>' +
2188       '<number>1</number>' +
2189       '<number>2</number>' +
2190       '</children>' +
2191       '</fraction>' +
2192       '</children>' +
2193       '</fenced>' +
2194       '</children>' +
2195       '</appl>');
2196
2197   this.executeTreeTest(
2198       '<mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>+</mo><mi>y</mi>' +
2199       '<mo>)</mo></mrow>',
2200       '<infixop>\u2062' +
2201       '<content>' +
2202       '<operator>\u2062</operator>' +
2203       '</content>' +
2204       '<children>' +
2205       '<identifier>f</identifier>' +
2206       '<fenced>' +
2207       '<content>' +
2208       '<fence>(</fence>' +
2209       '<fence>)</fence>' +
2210       '</content>' +
2211       '<children>' +
2212       '<infixop>+' +
2213       '<content>' +
2214       '<operator>+</operator>' +
2215       '</content>' +
2216       '<children>' +
2217       '<identifier>x</identifier>' +
2218       '<identifier>y</identifier>' +
2219       '</children>' +
2220       '</infixop>' +
2221       '</children>' +
2222       '</fenced>' +
2223       '</children>' +
2224       '</infixop>');
2225 });
2226
2227
2228 /**
2229  * Simple functions with surrounding operators.
2230  */
2231 TEST_F('CvoxSemanticTreeUnitTest', 'StreeSimpleFuncsWithOps', function() {
2232   this.brief = true;
2233   this.executeTreeTest(
2234       '<mrow><mn>1</mn><mo>+</mo><mi>f</mi><mo>(</mo><mi>x</mi>' +
2235       '<mo>)</mo></mrow>',
2236       '<infixop>+' +
2237       '<content>' +
2238       '<operator>+</operator>' +
2239       '</content>' +
2240       '<children>' +
2241       '<number>1</number>' +
2242       '<appl>' +
2243       '<content>' +
2244       '<punctuation>\u2061</punctuation>' +
2245       '</content>' +
2246       '<children>' +
2247       '<identifier>f</identifier>' +
2248       '<fenced>' +
2249       '<content>' +
2250       '<fence>(</fence>' +
2251       '<fence>)</fence>' +
2252       '</content>' +
2253       '<children>' +
2254       '<identifier>x</identifier>' +
2255       '</children>' +
2256       '</fenced>' +
2257       '</children>' +
2258       '</appl>' +
2259       '</children>' +
2260       '</infixop>');
2261
2262   this.executeTreeTest(
2263       '<mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>+</mo>' +
2264       '<mn>2</mn></mrow>',
2265       '<infixop>+' +
2266       '<content>' +
2267       '<operator>+</operator>' +
2268       '</content>' +
2269       '<children>' +
2270       '<appl>' +
2271       '<content>' +
2272       '<punctuation>\u2061</punctuation>' +
2273       '</content>' +
2274       '<children>' +
2275       '<identifier>f</identifier>' +
2276       '<fenced>' +
2277       '<content>' +
2278       '<fence>(</fence>' +
2279       '<fence>)</fence>' +
2280       '</content>' +
2281       '<children>' +
2282       '<identifier>x</identifier>' +
2283       '</children>' +
2284       '</fenced>' +
2285       '</children>' +
2286       '</appl>' +
2287       '<number>2</number>' +
2288       '</children>' +
2289       '</infixop>');
2290
2291   this.executeTreeTest(
2292       '<mrow><mn>1</mn><mo>+</mo><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo>' +
2293       '<mo>+</mo><mn>2</mn></mrow>',
2294       '<infixop>+' +
2295       '<content>' +
2296       '<operator>+</operator>' +
2297       '<operator>+</operator>' +
2298       '</content>' +
2299       '<children>' +
2300       '<number>1</number>' +
2301       '<appl>' +
2302       '<content>' +
2303       '<punctuation>\u2061</punctuation>' +
2304       '</content>' +
2305       '<children>' +
2306       '<identifier>f</identifier>' +
2307       '<fenced>' +
2308       '<content>' +
2309       '<fence>(</fence>' +
2310       '<fence>)</fence>' +
2311       '</content>' +
2312       '<children>' +
2313       '<identifier>x</identifier>' +
2314       '</children>' +
2315       '</fenced>' +
2316       '</children>' +
2317       '</appl>' +
2318       '<number>2</number>' +
2319       '</children>' +
2320       '</infixop>');
2321
2322   this.executeTreeTest(
2323       '<mrow><mo>a</mo><mo>+</mo><mi>f</mi><mo>(</mo><mi>x</mi>' +
2324       '<mo>)</mo></mrow>',
2325       '<infixop>+' +
2326       '<content>' +
2327       '<operator>+</operator>' +
2328       '</content>' +
2329       '<children>' +
2330       '<identifier>a</identifier>' +
2331       '<appl>' +
2332       '<content>' +
2333       '<punctuation>\u2061</punctuation>' +
2334       '</content>' +
2335       '<children>' +
2336       '<identifier>f</identifier>' +
2337       '<fenced>' +
2338       '<content>' +
2339       '<fence>(</fence>' +
2340       '<fence>)</fence>' +
2341       '</content>' +
2342       '<children>' +
2343       '<identifier>x</identifier>' +
2344       '</children>' +
2345       '</fenced>' +
2346       '</children>' +
2347       '</appl>' +
2348       '</children>' +
2349       '</infixop>');
2350
2351   this.executeTreeTest(
2352       '<mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>+</mo>' +
2353       '<mo>b</mo></mrow>',
2354       '<infixop>+' +
2355       '<content>' +
2356       '<operator>+</operator>' +
2357       '</content>' +
2358       '<children>' +
2359       '<appl>' +
2360       '<content>' +
2361       '<punctuation>\u2061</punctuation>' +
2362       '</content>' +
2363       '<children>' +
2364       '<identifier>f</identifier>' +
2365       '<fenced>' +
2366       '<content>' +
2367       '<fence>(</fence>' +
2368       '<fence>)</fence>' +
2369       '</content>' +
2370       '<children>' +
2371       '<identifier>x</identifier>' +
2372       '</children>' +
2373       '</fenced>' +
2374       '</children>' +
2375       '</appl>' +
2376       '<identifier>b</identifier>' +
2377       '</children>' +
2378       '</infixop>');
2379
2380   this.executeTreeTest(
2381       '<mrow><mo>a</mo><mo>+</mo><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo>' +
2382       '<mo>+</mo><mo>b</mo></mrow>',
2383       '<infixop>+' +
2384       '<content>' +
2385       '<operator>+</operator>' +
2386       '<operator>+</operator>' +
2387       '</content>' +
2388       '<children>' +
2389       '<identifier>a</identifier>' +
2390       '<appl>' +
2391       '<content>' +
2392       '<punctuation>\u2061</punctuation>' +
2393       '</content>' +
2394       '<children>' +
2395       '<identifier>f</identifier>' +
2396       '<fenced>' +
2397       '<content>' +
2398       '<fence>(</fence>' +
2399       '<fence>)</fence>' +
2400       '</content>' +
2401       '<children>' +
2402       '<identifier>x</identifier>' +
2403       '</children>' +
2404       '</fenced>' +
2405       '</children>' +
2406       '</appl>' +
2407       '<identifier>b</identifier>' +
2408       '</children>' +
2409       '</infixop>');
2410
2411   this.executeTreeTest(
2412       '<mrow><mo>a</mo><mo>=</mo><mi>f</mi><mo>(</mo><mi>x</mi>' +
2413       '<mo>)</mo></mrow>',
2414       '<relseq>=' +
2415       '<content>' +
2416       '<relation>=</relation>' +
2417       '</content>' +
2418       '<children>' +
2419       '<identifier>a</identifier>' +
2420       '<appl>' +
2421       '<content>' +
2422       '<punctuation>\u2061</punctuation>' +
2423       '</content>' +
2424       '<children>' +
2425       '<identifier>f</identifier>' +
2426       '<fenced>' +
2427       '<content>' +
2428       '<fence>(</fence>' +
2429       '<fence>)</fence>' +
2430       '</content>' +
2431       '<children>' +
2432       '<identifier>x</identifier>' +
2433       '</children>' +
2434       '</fenced>' +
2435       '</children>' +
2436       '</appl>' +
2437       '</children>' +
2438       '</relseq>');
2439
2440   this.executeTreeTest(
2441       '<mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>=</mo>' +
2442       '<mo>b</mo></mrow>',
2443       '<relseq>=' +
2444       '<content>' +
2445       '<relation>=</relation>' +
2446       '</content>' +
2447       '<children>' +
2448       '<appl>' +
2449       '<content>' +
2450       '<punctuation>\u2061</punctuation>' +
2451       '</content>' +
2452       '<children>' +
2453       '<identifier>f</identifier>' +
2454       '<fenced>' +
2455       '<content>' +
2456       '<fence>(</fence>' +
2457       '<fence>)</fence>' +
2458       '</content>' +
2459       '<children>' +
2460       '<identifier>x</identifier>' +
2461       '</children>' +
2462       '</fenced>' +
2463       '</children>' +
2464       '</appl>' +
2465       '<identifier>b</identifier>' +
2466       '</children>' +
2467       '</relseq>');
2468
2469   this.executeTreeTest(
2470       '<mrow><mo>a</mo><mo>=</mo><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo>' +
2471       '<mo>=</mo><mo>b</mo></mrow>',
2472       '<relseq>=' +
2473       '<content>' +
2474       '<relation>=</relation>' +
2475       '<relation>=</relation>' +
2476       '</content>' +
2477       '<children>' +
2478       '<identifier>a</identifier>' +
2479       '<appl>' +
2480       '<content>' +
2481       '<punctuation>\u2061</punctuation>' +
2482       '</content>' +
2483       '<children>' +
2484       '<identifier>f</identifier>' +
2485       '<fenced>' +
2486       '<content>' +
2487       '<fence>(</fence>' +
2488       '<fence>)</fence>' +
2489       '</content>' +
2490       '<children>' +
2491       '<identifier>x</identifier>' +
2492       '</children>' +
2493       '</fenced>' +
2494       '</children>' +
2495       '</appl>' +
2496       '<identifier>b</identifier>' +
2497       '</children>' +
2498       '</relseq>');
2499 });
2500
2501
2502 /**
2503  * Multiple simple functions.
2504  */
2505 TEST_F('CvoxSemanticTreeUnitTest', 'StreeSimpleFuncsMulti', function() {
2506   this.brief = true;
2507   this.executeTreeTest(
2508       '<mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>+</mo><mi>g</mi>' +
2509       '<mo>(</mo><mi>x</mi><mo>)</mo></mrow>',
2510       '<infixop>+' +
2511       '<content>' +
2512       '<operator>+</operator>' +
2513       '</content>' +
2514       '<children>' +
2515       '<appl>' +
2516       '<content>' +
2517       '<punctuation>\u2061</punctuation>' +
2518       '</content>' +
2519       '<children>' +
2520       '<identifier>f</identifier>' +
2521       '<fenced>' +
2522       '<content>' +
2523       '<fence>(</fence>' +
2524       '<fence>)</fence>' +
2525       '</content>' +
2526       '<children>' +
2527       '<identifier>x</identifier>' +
2528       '</children>' +
2529       '</fenced>' +
2530       '</children>' +
2531       '</appl>' +
2532       '<appl>' +
2533       '<content>' +
2534       '<punctuation>\u2061</punctuation>' +
2535       '</content>' +
2536       '<children>' +
2537       '<identifier>g</identifier>' +
2538       '<fenced>' +
2539       '<content>' +
2540       '<fence>(</fence>' +
2541       '<fence>)</fence>' +
2542       '</content>' +
2543       '<children>' +
2544       '<identifier>x</identifier>' +
2545       '</children>' +
2546       '</fenced>' +
2547       '</children>' +
2548       '</appl>' +
2549       '</children>' +
2550       '</infixop>');
2551
2552   this.executeTreeTest(
2553       '<mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>+</mo><mi>g</mi>' +
2554       '<mo>(</mo><mi>x</mi><mo>)</mo><mo>=</mo><mi>h</mi><mo>(</mo>' +
2555       '<mi>x</mi><mo>)</mo></mrow>',
2556       '<relseq>=' +
2557       '<content>' +
2558       '<relation>=</relation>' +
2559       '</content>' +
2560       '<children>' +
2561       '<infixop>+' +
2562       '<content>' +
2563       '<operator>+</operator>' +
2564       '</content>' +
2565       '<children>' +
2566       '<appl>' +
2567       '<content>' +
2568       '<punctuation>\u2061</punctuation>' +
2569       '</content>' +
2570       '<children>' +
2571       '<identifier>f</identifier>' +
2572       '<fenced>' +
2573       '<content>' +
2574       '<fence>(</fence>' +
2575       '<fence>)</fence>' +
2576       '</content>' +
2577       '<children>' +
2578       '<identifier>x</identifier>' +
2579       '</children>' +
2580       '</fenced>' +
2581       '</children>' +
2582       '</appl>' +
2583       '<appl>' +
2584       '<content>' +
2585       '<punctuation>\u2061</punctuation>' +
2586       '</content>' +
2587       '<children>' +
2588       '<identifier>g</identifier>' +
2589       '<fenced>' +
2590       '<content>' +
2591       '<fence>(</fence>' +
2592       '<fence>)</fence>' +
2593       '</content>' +
2594       '<children>' +
2595       '<identifier>x</identifier>' +
2596       '</children>' +
2597       '</fenced>' +
2598       '</children>' +
2599       '</appl>' +
2600       '</children>' +
2601       '</infixop>' +
2602       '<appl>' +
2603       '<content>' +
2604       '<punctuation>\u2061</punctuation>' +
2605       '</content>' +
2606       '<children>' +
2607       '<identifier>h</identifier>' +
2608       '<fenced>' +
2609       '<content>' +
2610       '<fence>(</fence>' +
2611       '<fence>)</fence>' +
2612       '</content>' +
2613       '<children>' +
2614       '<identifier>x</identifier>' +
2615       '</children>' +
2616       '</fenced>' +
2617       '</children>' +
2618       '</appl>' +
2619       '</children>' +
2620       '</relseq>');
2621
2622   this.executeTreeTest(
2623       '<mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>+</mo><mi>g</mi>' +
2624       '<mo>(</mo><mi>y</mi><mo>)</mo><mo>=</mo><mi>h</mi><mo>(</mo>' +
2625       '<mi>x</mi><mi>y</mi><mo>)</mo></mrow>',
2626       '<relseq>=' +
2627       '<content>' +
2628       '<relation>=</relation>' +
2629       '</content>' +
2630       '<children>' +
2631       '<infixop>+' +
2632       '<content>' +
2633       '<operator>+</operator>' +
2634       '</content>' +
2635       '<children>' +
2636       '<appl>' +
2637       '<content>' +
2638       '<punctuation>\u2061</punctuation>' +
2639       '</content>' +
2640       '<children>' +
2641       '<identifier>f</identifier>' +
2642       '<fenced>' +
2643       '<content>' +
2644       '<fence>(</fence>' +
2645       '<fence>)</fence>' +
2646       '</content>' +
2647       '<children>' +
2648       '<identifier>x</identifier>' +
2649       '</children>' +
2650       '</fenced>' +
2651       '</children>' +
2652       '</appl>' +
2653       '<appl>' +
2654       '<content>' +
2655       '<punctuation>\u2061</punctuation>' +
2656       '</content>' +
2657       '<children>' +
2658       '<identifier>g</identifier>' +
2659       '<fenced>' +
2660       '<content>' +
2661       '<fence>(</fence>' +
2662       '<fence>)</fence>' +
2663       '</content>' +
2664       '<children>' +
2665       '<identifier>y</identifier>' +
2666       '</children>' +
2667       '</fenced>' +
2668       '</children>' +
2669       '</appl>' +
2670       '</children>' +
2671       '</infixop>' +
2672       '<appl>' +
2673       '<content>' +
2674       '<punctuation>\u2061</punctuation>' +
2675       '</content>' +
2676       '<children>' +
2677       '<identifier>h</identifier>' +
2678       '<fenced>' +
2679       '<content>' +
2680       '<fence>(</fence>' +
2681       '<fence>)</fence>' +
2682       '</content>' +
2683       '<children>' +
2684       '<infixop>\u2062' +
2685       '<content>' +
2686       '<operator>\u2062</operator>' +
2687       '</content>' +
2688       '<children>' +
2689       '<identifier>x</identifier>' +
2690       '<identifier>y</identifier>' +
2691       '</children>' +
2692       '</infixop>' +
2693       '</children>' +
2694       '</fenced>' +
2695       '</children>' +
2696       '</appl>' +
2697       '</children>' +
2698       '</relseq>');
2699 });
2700
2701
2702 /**
2703  * Nested simple functions.
2704  */
2705 TEST_F('CvoxSemanticTreeUnitTest', 'StreeSimpleFuncsNested', function() {
2706   this.brief = true;
2707   this.executeTreeTest(
2708       '<mrow><mi>g</mi><mo>(</mo><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo>' +
2709       '<mo>)</mo></mrow>',
2710       '<appl>' +
2711       '<content>' +
2712       '<punctuation>\u2061</punctuation>' +
2713       '</content>' +
2714       '<children>' +
2715       '<identifier>g</identifier>' +
2716       '<fenced>' +
2717       '<content>' +
2718       '<fence>(</fence>' +
2719       '<fence>)</fence>' +
2720       '</content>' +
2721       '<children>' +
2722       '<appl>' +
2723       '<content>' +
2724       '<punctuation>\u2061</punctuation>' +
2725       '</content>' +
2726       '<children>' +
2727       '<identifier>f</identifier>' +
2728       '<fenced>' +
2729       '<content>' +
2730       '<fence>(</fence>' +
2731       '<fence>)</fence>' +
2732       '</content>' +
2733       '<children>' +
2734       '<identifier>x</identifier>' +
2735       '</children>' +
2736       '</fenced>' +
2737       '</children>' +
2738       '</appl>' +
2739       '</children>' +
2740       '</fenced>' +
2741       '</children>' +
2742       '</appl>');
2743
2744   this.executeTreeTest(
2745       '<mrow><mi>h</mi><mo>(</mo><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo>' +
2746       '<mi>g</mi><mo>(</mo><mi>y</mi><mo>)</mo><mo>)</mo></mrow>',
2747       '<appl>' +
2748       '<content>' +
2749       '<punctuation>\u2061</punctuation>' +
2750       '</content>' +
2751       '<children>' +
2752       '<identifier>h</identifier>' +
2753       '<fenced>' +
2754       '<content>' +
2755       '<fence>(</fence>' +
2756       '<fence>)</fence>' +
2757       '</content>' +
2758       '<children>' +
2759       '<infixop>\u2062' +
2760       '<content>' +
2761       '<operator>\u2062</operator>' +
2762       '</content>' +
2763       '<children>' +
2764       '<appl>' +
2765       '<content>' +
2766       '<punctuation>\u2061</punctuation>' +
2767       '</content>' +
2768       '<children>' +
2769       '<identifier>f</identifier>' +
2770       '<fenced>' +
2771       '<content>' +
2772       '<fence>(</fence>' +
2773       '<fence>)</fence>' +
2774       '</content>' +
2775       '<children>' +
2776       '<identifier>x</identifier>' +
2777       '</children>' +
2778       '</fenced>' +
2779       '</children>' +
2780       '</appl>' +
2781       '<appl>' +
2782       '<content>' +
2783       '<punctuation>\u2061</punctuation>' +
2784       '</content>' +
2785       '<children>' +
2786       '<identifier>g</identifier>' +
2787       '<fenced>' +
2788       '<content>' +
2789       '<fence>(</fence>' +
2790       '<fence>)</fence>' +
2791       '</content>' +
2792       '<children>' +
2793       '<identifier>y</identifier>' +
2794       '</children>' +
2795       '</fenced>' +
2796       '</children>' +
2797       '</appl>' +
2798       '</children>' +
2799       '</infixop>' +
2800       '</children>' +
2801       '</fenced>' +
2802       '</children>' +
2803       '</appl>');
2804
2805   this.executeTreeTest(
2806       '<mrow><mi>h</mi><mo>(</mo><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo>' +
2807       '<mo>+</mo><mi>g</mi><mo>(</mo><mi>y</mi><mo>)</mo><mo>)</mo></mrow>',
2808       '<infixop>\u2062' +
2809       '<content>' +
2810       '<operator>\u2062</operator>' +
2811       '</content>' +
2812       '<children>' +
2813       '<identifier>h</identifier>' +
2814       '<fenced>' +
2815       '<content>' +
2816       '<fence>(</fence>' +
2817       '<fence>)</fence>' +
2818       '</content>' +
2819       '<children>' +
2820       '<infixop>+' +
2821       '<content>' +
2822       '<operator>+</operator>' +
2823       '</content>' +
2824       '<children>' +
2825       '<appl>' +
2826       '<content>' +
2827       '<punctuation>\u2061</punctuation>' +
2828       '</content>' +
2829       '<children>' +
2830       '<identifier>f</identifier>' +
2831       '<fenced>' +
2832       '<content>' +
2833       '<fence>(</fence>' +
2834       '<fence>)</fence>' +
2835       '</content>' +
2836       '<children>' +
2837       '<identifier>x</identifier>' +
2838       '</children>' +
2839       '</fenced>' +
2840       '</children>' +
2841       '</appl>' +
2842       '<appl>' +
2843       '<content>' +
2844       '<punctuation>\u2061</punctuation>' +
2845       '</content>' +
2846       '<children>' +
2847       '<identifier>g</identifier>' +
2848       '<fenced>' +
2849       '<content>' +
2850       '<fence>(</fence>' +
2851       '<fence>)</fence>' +
2852       '</content>' +
2853       '<children>' +
2854       '<identifier>y</identifier>' +
2855       '</children>' +
2856       '</fenced>' +
2857       '</children>' +
2858       '</appl>' +
2859       '</children>' +
2860       '</infixop>' +
2861       '</children>' +
2862       '</fenced>' +
2863       '</children>' +
2864       '</infixop>');
2865
2866   this.executeTreeTest(
2867       '<mi>P</mi><mo>[</mo><mi>x</mi><mo>=</mo><mn>2</mn><mo>]</mo>',
2868       '<appl>' +
2869       '<content>' +
2870       '<punctuation>\u2061</punctuation>' +
2871       '</content>' +
2872       '<children>' +
2873       '<identifier>P</identifier>' +
2874       '<fenced>' +
2875       '<content>' +
2876       '<fence>[</fence>' +
2877       '<fence>]</fence>' +
2878       '</content>' +
2879       '<children>' +
2880       '<relseq>=' +
2881       '<content>' +
2882       '<relation>=</relation>' +
2883       '</content>' +
2884       '<children>' +
2885       '<identifier>x</identifier>' +
2886       '<number>2</number>' +
2887       '</children>' +
2888       '</relseq>' +
2889       '</children>' +
2890       '</fenced>' +
2891       '</children>' +
2892       '</appl>');
2893 });
2894
2895
2896 /**
2897  * Simple functions with explicit function application.
2898  */
2899 TEST_F('CvoxSemanticTreeUnitTest', 'StreeSimpleFuncsExplicitApp', function() {
2900   this.brief = true;
2901   this.executeTreeTest(
2902       '<mi>f</mi><mo>\u2061</mo><mo>(</mo><mi>x</mi><mo>+</mo><mi>y</mi>' +
2903       '<mo>)</mo>',
2904       '<appl>' +
2905       '<content>' +
2906       '<punctuation>\u2061</punctuation>' +
2907       '</content>' +
2908       '<children>' +
2909       '<identifier>f</identifier>' +
2910       '<fenced>' +
2911       '<content>' +
2912       '<fence>(</fence>' +
2913       '<fence>)</fence>' +
2914       '</content>' +
2915       '<children>' +
2916       '<infixop>+' +
2917       '<content>' +
2918       '<operator>+</operator>' +
2919       '</content>' +
2920       '<children>' +
2921       '<identifier>x</identifier>' +
2922       '<identifier>y</identifier>' +
2923       '</children>' +
2924       '</infixop>' +
2925       '</children>' +
2926       '</fenced>' +
2927       '</children>' +
2928       '</appl>');
2929
2930   this.executeTreeTest(
2931       '<mi>f</mi><mo>\u2061</mo><mo>(</mo><mi>x</mi><mo>+</mo><mi>y</mi>' +
2932       '<mo>)</mo><mo>+</mo><mi>f</mi><mo>(</mo><mi>x</mi><mo>+</mo>' +
2933       '<mi>y</mi><mo>)</mo>',
2934       '<infixop>+' +
2935       '<content>' +
2936       '<operator>+</operator>' +
2937       '</content>' +
2938       '<children>' +
2939       '<appl>' +
2940       '<content>' +
2941       '<punctuation>\u2061</punctuation>' +
2942       '</content>' +
2943       '<children>' +
2944       '<identifier>f</identifier>' +
2945       '<fenced>' +
2946       '<content>' +
2947       '<fence>(</fence>' +
2948       '<fence>)</fence>' +
2949       '</content>' +
2950       '<children>' +
2951       '<infixop>+' +
2952       '<content>' +
2953       '<operator>+</operator>' +
2954       '</content>' +
2955       '<children>' +
2956       '<identifier>x</identifier>' +
2957       '<identifier>y</identifier>' +
2958       '</children>' +
2959       '</infixop>' +
2960       '</children>' +
2961       '</fenced>' +
2962       '</children>' +
2963       '</appl>' +
2964       '<infixop>\u2062' +
2965       '<content>' +
2966       '<operator>\u2062</operator>' +
2967       '</content>' +
2968       '<children>' +
2969       '<identifier>f</identifier>' +
2970       '<fenced>' +
2971       '<content>' +
2972       '<fence>(</fence>' +
2973       '<fence>)</fence>' +
2974       '</content>' +
2975       '<children>' +
2976       '<infixop>+' +
2977       '<content>' +
2978       '<operator>+</operator>' +
2979       '</content>' +
2980       '<children>' +
2981       '<identifier>x</identifier>' +
2982       '<identifier>y</identifier>' +
2983       '</children>' +
2984       '</infixop>' +
2985       '</children>' +
2986       '</fenced>' +
2987       '</children>' +
2988       '</infixop>' +
2989       '</children>' +
2990       '</infixop>');
2991
2992   this.executeTreeTest(
2993       '<msub><mi>f</mi><mn>1</mn></msub><mo>\u2061</mo><mo>(</mo><mi>x</mi>' +
2994       '<mo>+</mo><mi>y</mi><mo>)</mo>',
2995       '<appl>' +
2996       '<content>' +
2997       '<punctuation>\u2061</punctuation>' +
2998       '</content>' +
2999       '<children>' +
3000       '<subscript>' +
3001       '<children>' +
3002       '<identifier>f</identifier>' +
3003       '<number>1</number>' +
3004       '</children>' +
3005       '</subscript>' +
3006       '<fenced>' +
3007       '<content>' +
3008       '<fence>(</fence>' +
3009       '<fence>)</fence>' +
3010       '</content>' +
3011       '<children>' +
3012       '<infixop>+' +
3013       '<content>' +
3014       '<operator>+</operator>' +
3015       '</content>' +
3016       '<children>' +
3017       '<identifier>x</identifier>' +
3018       '<identifier>y</identifier>' +
3019       '</children>' +
3020       '</infixop>' +
3021       '</children>' +
3022       '</fenced>' +
3023       '</children>' +
3024       '</appl>');
3025
3026   this.executeTreeTest(
3027       '<msup><msub><mi>f</mi><mn>n</mn></msub><mn>2</mn></msup>' +
3028       '<mo>\u2061</mo><mo>(</mo><mi>x</mi><mo>+</mo><mi>y</mi><mo>)</mo>' +
3029       '<mo>+</mo><msup><msub><mi>f</mi><mn>m</mn></msub><mn>2</mn></msup>' +
3030       '<mo>(</mo><mi>x</mi><mo>+</mo><mi>y</mi><mo>)</mo>',
3031       '<infixop>+' +
3032       '<content>' +
3033       '<operator>+</operator>' +
3034       '</content>' +
3035       '<children>' +
3036       '<appl>' +
3037       '<content>' +
3038       '<punctuation>\u2061</punctuation>' +
3039       '</content>' +
3040       '<children>' +
3041       '<superscript>' +
3042       '<children>' +
3043       '<subscript>' +
3044       '<children>' +
3045       '<identifier>f</identifier>' +
3046       '<identifier>n</identifier>' +
3047       '</children>' +
3048       '</subscript>' +
3049       '<number>2</number>' +
3050       '</children>' +
3051       '</superscript>' +
3052       '<fenced>' +
3053       '<content>' +
3054       '<fence>(</fence>' +
3055       '<fence>)</fence>' +
3056       '</content>' +
3057       '<children>' +
3058       '<infixop>+' +
3059       '<content>' +
3060       '<operator>+</operator>' +
3061       '</content>' +
3062       '<children>' +
3063       '<identifier>x</identifier>' +
3064       '<identifier>y</identifier>' +
3065       '</children>' +
3066       '</infixop>' +
3067       '</children>' +
3068       '</fenced>' +
3069       '</children>' +
3070       '</appl>' +
3071       '<infixop>\u2062' +
3072       '<content>' +
3073       '<operator>\u2062</operator>' +
3074       '</content>' +
3075       '<children>' +
3076       '<superscript>' +
3077       '<children>' +
3078       '<subscript>' +
3079       '<children>' +
3080       '<identifier>f</identifier>' +
3081       '<identifier>m</identifier>' +
3082       '</children>' +
3083       '</subscript>' +
3084       '<number>2</number>' +
3085       '</children>' +
3086       '</superscript>' +
3087       '<fenced>' +
3088       '<content>' +
3089       '<fence>(</fence>' +
3090       '<fence>)</fence>' +
3091       '</content>' +
3092       '<children>' +
3093       '<infixop>+' +
3094       '<content>' +
3095       '<operator>+</operator>' +
3096       '</content>' +
3097       '<children>' +
3098       '<identifier>x</identifier>' +
3099       '<identifier>y</identifier>' +
3100       '</children>' +
3101       '</infixop>' +
3102       '</children>' +
3103       '</fenced>' +
3104       '</children>' +
3105       '</infixop>' +
3106       '</children>' +
3107       '</infixop>');
3108 });
3109
3110
3111 /**
3112  * Prefix function applications
3113  */
3114 TEST_F('CvoxSemanticTreeUnitTest', 'StreePrefixFuncsSingle', function() {
3115   this.brief = true;
3116   this.executeTreeTest(
3117       '<mrow><mi>sin</mi><mo>(</mo><mi>x</mi><mo>)</mo></mrow>',
3118       '<appl>' +
3119       '<content>' +
3120       '<punctuation>\u2061</punctuation>' +
3121       '</content>' +
3122       '<children>' +
3123       '<function>sin</function>' +
3124       '<fenced>' +
3125       '<content>' +
3126       '<fence>(</fence>' +
3127       '<fence>)</fence>' +
3128       '</content>' +
3129       '<children>' +
3130       '<identifier>x</identifier>' +
3131       '</children>' +
3132       '</fenced>' +
3133       '</children>' +
3134       '</appl>');
3135
3136   this.executeTreeTest(
3137       '<mrow><mi>sin</mi><mo>(</mo><mi>x</mi><mi>y</mi><mo>)</mo></mrow>',
3138       '<appl>' +
3139       '<content>' +
3140       '<punctuation>\u2061</punctuation>' +
3141       '</content>' +
3142       '<children>' +
3143       '<function>sin</function>' +
3144       '<fenced>' +
3145       '<content>' +
3146       '<fence>(</fence>' +
3147       '<fence>)</fence>' +
3148       '</content>' +
3149       '<children>' +
3150       '<infixop>\u2062' +
3151       '<content>' +
3152       '<operator>\u2062</operator>' +
3153       '</content>' +
3154       '<children>' +
3155       '<identifier>x</identifier>' +
3156       '<identifier>y</identifier>' +
3157       '</children>' +
3158       '</infixop>' +
3159       '</children>' +
3160       '</fenced>' +
3161       '</children>' +
3162       '</appl>');
3163
3164   this.executeTreeTest(
3165       '<mrow><mi>sin</mi><mo>(</mo><msup><mi>x</mi><mn>2</mn></msup>' +
3166       '<mo>)</mo></mrow>',
3167       '<appl>' +
3168       '<content>' +
3169       '<punctuation>\u2061</punctuation>' +
3170       '</content>' +
3171       '<children>' +
3172       '<function>sin</function>' +
3173       '<fenced>' +
3174       '<content>' +
3175       '<fence>(</fence>' +
3176       '<fence>)</fence>' +
3177       '</content>' +
3178       '<children>' +
3179       '<superscript>' +
3180       '<children>' +
3181       '<identifier>x</identifier>' +
3182       '<number>2</number>' +
3183       '</children>' +
3184       '</superscript>' +
3185       '</children>' +
3186       '</fenced>' +
3187       '</children>' +
3188       '</appl>');
3189
3190   this.executeTreeTest(
3191       '<mrow><mi>sin</mi><mo>(</mo><msub><mi>x</mi><mn>2</mn></msub>' +
3192       '<mo>)</mo></mrow>',
3193       '<appl>' +
3194       '<content>' +
3195       '<punctuation>\u2061</punctuation>' +
3196       '</content>' +
3197       '<children>' +
3198       '<function>sin</function>' +
3199       '<fenced>' +
3200       '<content>' +
3201       '<fence>(</fence>' +
3202       '<fence>)</fence>' +
3203       '</content>' +
3204       '<children>' +
3205       '<subscript>' +
3206       '<children>' +
3207       '<identifier>x</identifier>' +
3208       '<number>2</number>' +
3209       '</children>' +
3210       '</subscript>' +
3211       '</children>' +
3212       '</fenced>' +
3213       '</children>' +
3214       '</appl>');
3215
3216   this.executeTreeTest(
3217       '<mrow><mi>sin</mi><mo>(</mo><msubsup><mi>x</mi><mn>2</mn>' +
3218       '<mn>1</mn></msubsup><mo>)</mo></mrow>',
3219       '<appl>' +
3220       '<content>' +
3221       '<punctuation>\u2061</punctuation>' +
3222       '</content>' +
3223       '<children>' +
3224       '<function>sin</function>' +
3225       '<fenced>' +
3226       '<content>' +
3227       '<fence>(</fence>' +
3228       '<fence>)</fence>' +
3229       '</content>' +
3230       '<children>' +
3231       '<superscript>' +
3232       '<children>' +
3233       '<subscript>' +
3234       '<children>' +
3235       '<identifier>x</identifier>' +
3236       '<number>2</number>' +
3237       '</children>' +
3238       '</subscript>' +
3239       '<number>1</number>' +
3240       '</children>' +
3241       '</superscript>' +
3242       '</children>' +
3243       '</fenced>' +
3244       '</children>' +
3245       '</appl>');
3246
3247   this.executeTreeTest(
3248       '<mrow><mi>sin</mi><mo>(</mo><mover><mi>x</mi><mn>2</mn></mover>' +
3249       '<mo>)</mo></mrow>',
3250       '<appl>' +
3251       '<content>' +
3252       '<punctuation>\u2061</punctuation>' +
3253       '</content>' +
3254       '<children>' +
3255       '<function>sin</function>' +
3256       '<fenced>' +
3257       '<content>' +
3258       '<fence>(</fence>' +
3259       '<fence>)</fence>' +
3260       '</content>' +
3261       '<children>' +
3262       '<overscore>' +
3263       '<children>' +
3264       '<identifier>x</identifier>' +
3265       '<number>2</number>' +
3266       '</children>' +
3267       '</overscore>' +
3268       '</children>' +
3269       '</fenced>' +
3270       '</children>' +
3271       '</appl>');
3272
3273   this.executeTreeTest(
3274       '<mrow><mi>sin</mi><mo>(</mo><munder><mi>x</mi><mn>2</mn></munder>' +
3275       '<mo>)</mo></mrow>',
3276       '<appl>' +
3277       '<content>' +
3278       '<punctuation>\u2061</punctuation>' +
3279       '</content>' +
3280       '<children>' +
3281       '<function>sin</function>' +
3282       '<fenced>' +
3283       '<content>' +
3284       '<fence>(</fence>' +
3285       '<fence>)</fence>' +
3286       '</content>' +
3287       '<children>' +
3288       '<underscore>' +
3289       '<children>' +
3290       '<identifier>x</identifier>' +
3291       '<number>2</number>' +
3292       '</children>' +
3293       '</underscore>' +
3294       '</children>' +
3295       '</fenced>' +
3296       '</children>' +
3297       '</appl>');
3298
3299   this.executeTreeTest(
3300       '<mrow><mi>sin</mi><mo>(</mo><munderover><mi>x</mi><mn>2</mn>' +
3301       '<mn>1</mn></munderover><mo>)</mo></mrow>',
3302       '<appl>' +
3303       '<content>' +
3304       '<punctuation>\u2061</punctuation>' +
3305       '</content>' +
3306       '<children>' +
3307       '<function>sin</function>' +
3308       '<fenced>' +
3309       '<content>' +
3310       '<fence>(</fence>' +
3311       '<fence>)</fence>' +
3312       '</content>' +
3313       '<children>' +
3314       '<overscore>' +
3315       '<children>' +
3316       '<underscore>' +
3317       '<children>' +
3318       '<identifier>x</identifier>' +
3319       '<number>2</number>' +
3320       '</children>' +
3321       '</underscore>' +
3322       '<number>1</number>' +
3323       '</children>' +
3324       '</overscore>' +
3325       '</children>' +
3326       '</fenced>' +
3327       '</children>' +
3328       '</appl>');
3329
3330   this.executeTreeTest(
3331       '<mrow><mi>sin</mi><mo>(</mo><mfrac><mn>1</mn><mn>2</mn></mfrac>' +
3332       '<mo>)</mo></mrow>',
3333       '<appl>' +
3334       '<content>' +
3335       '<punctuation>\u2061</punctuation>' +
3336       '</content>' +
3337       '<children>' +
3338       '<function>sin</function>' +
3339       '<fenced>' +
3340       '<content>' +
3341       '<fence>(</fence>' +
3342       '<fence>)</fence>' +
3343       '</content>' +
3344       '<children>' +
3345       '<fraction>' +
3346       '<children>' +
3347       '<number>1</number>' +
3348       '<number>2</number>' +
3349       '</children>' +
3350       '</fraction>' +
3351       '</children>' +
3352       '</fenced>' +
3353       '</children>' +
3354       '</appl>');
3355
3356   this.executeTreeTest(
3357       '<mrow><mi>sin</mi><mo>(</mo><mi>x</mi><mo>+</mo><mi>y</mi>' +
3358       '<mo>)</mo></mrow>',
3359       '<appl>' +
3360       '<content>' +
3361       '<punctuation>\u2061</punctuation>' +
3362       '</content>' +
3363       '<children>' +
3364       '<function>sin</function>' +
3365       '<fenced>' +
3366       '<content>' +
3367       '<fence>(</fence>' +
3368       '<fence>)</fence>' +
3369       '</content>' +
3370       '<children>' +
3371       '<infixop>+' +
3372       '<content>' +
3373       '<operator>+</operator>' +
3374       '</content>' +
3375       '<children>' +
3376       '<identifier>x</identifier>' +
3377       '<identifier>y</identifier>' +
3378       '</children>' +
3379       '</infixop>' +
3380       '</children>' +
3381       '</fenced>' +
3382       '</children>' +
3383       '</appl>');
3384 });
3385
3386
3387 /**
3388  * Prefix functions applications with surrounding operators.
3389  */
3390 TEST_F('CvoxSemanticTreeUnitTest', 'StreePrefixFuncsWithOps', function() {
3391   this.brief = true;
3392   this.executeTreeTest(
3393       '<mrow><mn>1</mn><mo>+</mo><mi>sin</mi><mo>(</mo><mi>x</mi>' +
3394       '<mo>)</mo></mrow>',
3395       '<infixop>+' +
3396       '<content>' +
3397       '<operator>+</operator>' +
3398       '</content>' +
3399       '<children>' +
3400       '<number>1</number>' +
3401       '<appl>' +
3402       '<content>' +
3403       '<punctuation>\u2061</punctuation>' +
3404       '</content>' +
3405       '<children>' +
3406       '<function>sin</function>' +
3407       '<fenced>' +
3408       '<content>' +
3409       '<fence>(</fence>' +
3410       '<fence>)</fence>' +
3411       '</content>' +
3412       '<children>' +
3413       '<identifier>x</identifier>' +
3414       '</children>' +
3415       '</fenced>' +
3416       '</children>' +
3417       '</appl>' +
3418       '</children>' +
3419       '</infixop>');
3420
3421   this.executeTreeTest(
3422       '<mrow><mi>sin</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>+</mo>' +
3423       '<mn>2</mn></mrow>',
3424       '<infixop>+' +
3425       '<content>' +
3426       '<operator>+</operator>' +
3427       '</content>' +
3428       '<children>' +
3429       '<appl>' +
3430       '<content>' +
3431       '<punctuation>\u2061</punctuation>' +
3432       '</content>' +
3433       '<children>' +
3434       '<function>sin</function>' +
3435       '<fenced>' +
3436       '<content>' +
3437       '<fence>(</fence>' +
3438       '<fence>)</fence>' +
3439       '</content>' +
3440       '<children>' +
3441       '<identifier>x</identifier>' +
3442       '</children>' +
3443       '</fenced>' +
3444       '</children>' +
3445       '</appl>' +
3446       '<number>2</number>' +
3447       '</children>' +
3448       '</infixop>');
3449
3450   this.executeTreeTest(
3451       '<mrow><mn>1</mn><mo>+</mo><mi>sin</mi><mo>(</mo><mi>x</mi><mo>)</mo>' +
3452       '<mo>+</mo><mn>2</mn></mrow>',
3453       '<infixop>+' +
3454       '<content>' +
3455       '<operator>+</operator>' +
3456       '<operator>+</operator>' +
3457       '</content>' +
3458       '<children>' +
3459       '<number>1</number>' +
3460       '<appl>' +
3461       '<content>' +
3462       '<punctuation>\u2061</punctuation>' +
3463       '</content>' +
3464       '<children>' +
3465       '<function>sin</function>' +
3466       '<fenced>' +
3467       '<content>' +
3468       '<fence>(</fence>' +
3469       '<fence>)</fence>' +
3470       '</content>' +
3471       '<children>' +
3472       '<identifier>x</identifier>' +
3473       '</children>' +
3474       '</fenced>' +
3475       '</children>' +
3476       '</appl>' +
3477       '<number>2</number>' +
3478       '</children>' +
3479       '</infixop>');
3480
3481   this.executeTreeTest(
3482       '<mrow><mo>a</mo><mo>+</mo><mi>sin</mi><mo>(</mo><mi>x</mi>' +
3483       '<mo>)</mo></mrow>',
3484       '<infixop>+' +
3485       '<content>' +
3486       '<operator>+</operator>' +
3487       '</content>' +
3488       '<children>' +
3489       '<identifier>a</identifier>' +
3490       '<appl>' +
3491       '<content>' +
3492       '<punctuation>\u2061</punctuation>' +
3493       '</content>' +
3494       '<children>' +
3495       '<function>sin</function>' +
3496       '<fenced>' +
3497       '<content>' +
3498       '<fence>(</fence>' +
3499       '<fence>)</fence>' +
3500       '</content>' +
3501       '<children>' +
3502       '<identifier>x</identifier>' +
3503       '</children>' +
3504       '</fenced>' +
3505       '</children>' +
3506       '</appl>' +
3507       '</children>' +
3508       '</infixop>');
3509
3510   this.executeTreeTest(
3511       '<mrow><mi>sin</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>+</mo>' +
3512       '<mo>b</mo></mrow>',
3513       '<infixop>+' +
3514       '<content>' +
3515       '<operator>+</operator>' +
3516       '</content>' +
3517       '<children>' +
3518       '<appl>' +
3519       '<content>' +
3520       '<punctuation>\u2061</punctuation>' +
3521       '</content>' +
3522       '<children>' +
3523       '<function>sin</function>' +
3524       '<fenced>' +
3525       '<content>' +
3526       '<fence>(</fence>' +
3527       '<fence>)</fence>' +
3528       '</content>' +
3529       '<children>' +
3530       '<identifier>x</identifier>' +
3531       '</children>' +
3532       '</fenced>' +
3533       '</children>' +
3534       '</appl>' +
3535       '<identifier>b</identifier>' +
3536       '</children>' +
3537       '</infixop>');
3538
3539   this.executeTreeTest(
3540       '<mrow><mo>a</mo><mo>+</mo><mi>sin</mi><mo>(</mo><mi>x</mi>' +
3541       '<mo>)</mo><mo>+</mo><mo>b</mo></mrow>',
3542       '<infixop>+' +
3543       '<content>' +
3544       '<operator>+</operator>' +
3545       '<operator>+</operator>' +
3546       '</content>' +
3547       '<children>' +
3548       '<identifier>a</identifier>' +
3549       '<appl>' +
3550       '<content>' +
3551       '<punctuation>\u2061</punctuation>' +
3552       '</content>' +
3553       '<children>' +
3554       '<function>sin</function>' +
3555       '<fenced>' +
3556       '<content>' +
3557       '<fence>(</fence>' +
3558       '<fence>)</fence>' +
3559       '</content>' +
3560       '<children>' +
3561       '<identifier>x</identifier>' +
3562       '</children>' +
3563       '</fenced>' +
3564       '</children>' +
3565       '</appl>' +
3566       '<identifier>b</identifier>' +
3567       '</children>' +
3568       '</infixop>');
3569
3570   this.executeTreeTest(
3571       '<mrow><mo>a</mo><mo>=</mo><mi>sin</mi><mo>(</mo><mi>x</mi>' +
3572       '<mo>)</mo></mrow>',
3573       '<relseq>=' +
3574       '<content>' +
3575       '<relation>=</relation>' +
3576       '</content>' +
3577       '<children>' +
3578       '<identifier>a</identifier>' +
3579       '<appl>' +
3580       '<content>' +
3581       '<punctuation>\u2061</punctuation>' +
3582       '</content>' +
3583       '<children>' +
3584       '<function>sin</function>' +
3585       '<fenced>' +
3586       '<content>' +
3587       '<fence>(</fence>' +
3588       '<fence>)</fence>' +
3589       '</content>' +
3590       '<children>' +
3591       '<identifier>x</identifier>' +
3592       '</children>' +
3593       '</fenced>' +
3594       '</children>' +
3595       '</appl>' +
3596       '</children>' +
3597       '</relseq>');
3598
3599   this.executeTreeTest(
3600       '<mrow><mi>sin</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>=</mo>' +
3601       '<mo>b</mo></mrow>',
3602       '<relseq>=' +
3603       '<content>' +
3604       '<relation>=</relation>' +
3605       '</content>' +
3606       '<children>' +
3607       '<appl>' +
3608       '<content>' +
3609       '<punctuation>\u2061</punctuation>' +
3610       '</content>' +
3611       '<children>' +
3612       '<function>sin</function>' +
3613       '<fenced>' +
3614       '<content>' +
3615       '<fence>(</fence>' +
3616       '<fence>)</fence>' +
3617       '</content>' +
3618       '<children>' +
3619       '<identifier>x</identifier>' +
3620       '</children>' +
3621       '</fenced>' +
3622       '</children>' +
3623       '</appl>' +
3624       '<identifier>b</identifier>' +
3625       '</children>' +
3626       '</relseq>');
3627
3628   this.executeTreeTest(
3629       '<mrow><mo>a</mo><mo>=</mo><mi>sin</mi><mo>(</mo><mi>x</mi><mo>)</mo>' +
3630       '<mo>=</mo><mo>b</mo></mrow>',
3631       '<relseq>=' +
3632       '<content>' +
3633       '<relation>=</relation>' +
3634       '<relation>=</relation>' +
3635       '</content>' +
3636       '<children>' +
3637       '<identifier>a</identifier>' +
3638       '<appl>' +
3639       '<content>' +
3640       '<punctuation>\u2061</punctuation>' +
3641       '</content>' +
3642       '<children>' +
3643       '<function>sin</function>' +
3644       '<fenced>' +
3645       '<content>' +
3646       '<fence>(</fence>' +
3647       '<fence>)</fence>' +
3648       '</content>' +
3649       '<children>' +
3650       '<identifier>x</identifier>' +
3651       '</children>' +
3652       '</fenced>' +
3653       '</children>' +
3654       '</appl>' +
3655       '<identifier>b</identifier>' +
3656       '</children>' +
3657       '</relseq>');
3658 });
3659
3660
3661 /**
3662  * Multiple prefix function applications.
3663  */
3664 TEST_F('CvoxSemanticTreeUnitTest', 'StreePrefixFuncsMulti', function() {
3665   this.brief = true;
3666   this.executeTreeTest(
3667       '<mrow><mi>sin</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>+</mo><mi>cos</mi>' +
3668       '<mo>(</mo><mi>x</mi><mo>)</mo></mrow>',
3669       '<infixop>+' +
3670       '<content>' +
3671       '<operator>+</operator>' +
3672       '</content>' +
3673       '<children>' +
3674       '<appl>' +
3675       '<content>' +
3676       '<punctuation>\u2061</punctuation>' +
3677       '</content>' +
3678       '<children>' +
3679       '<function>sin</function>' +
3680       '<fenced>' +
3681       '<content>' +
3682       '<fence>(</fence>' +
3683       '<fence>)</fence>' +
3684       '</content>' +
3685       '<children>' +
3686       '<identifier>x</identifier>' +
3687       '</children>' +
3688       '</fenced>' +
3689       '</children>' +
3690       '</appl>' +
3691       '<appl>' +
3692       '<content>' +
3693       '<punctuation>\u2061</punctuation>' +
3694       '</content>' +
3695       '<children>' +
3696       '<function>cos</function>' +
3697       '<fenced>' +
3698       '<content>' +
3699       '<fence>(</fence>' +
3700       '<fence>)</fence>' +
3701       '</content>' +
3702       '<children>' +
3703       '<identifier>x</identifier>' +
3704       '</children>' +
3705       '</fenced>' +
3706       '</children>' +
3707       '</appl>' +
3708       '</children>' +
3709       '</infixop>');
3710
3711   this.executeTreeTest(
3712       '<mrow><mi>sin</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>+</mo><mi>cos</mi>' +
3713       '<mo>(</mo><mi>x</mi><mo>)</mo><mo>=</mo><mi>tan</mi><mo>(</mo>' +
3714       '<mi>x</mi><mo>)</mo></mrow>',
3715       '<relseq>=' +
3716       '<content>' +
3717       '<relation>=</relation>' +
3718       '</content>' +
3719       '<children>' +
3720       '<infixop>+' +
3721       '<content>' +
3722       '<operator>+</operator>' +
3723       '</content>' +
3724       '<children>' +
3725       '<appl>' +
3726       '<content>' +
3727       '<punctuation>\u2061</punctuation>' +
3728       '</content>' +
3729       '<children>' +
3730       '<function>sin</function>' +
3731       '<fenced>' +
3732       '<content>' +
3733       '<fence>(</fence>' +
3734       '<fence>)</fence>' +
3735       '</content>' +
3736       '<children>' +
3737       '<identifier>x</identifier>' +
3738       '</children>' +
3739       '</fenced>' +
3740       '</children>' +
3741       '</appl>' +
3742       '<appl>' +
3743       '<content>' +
3744       '<punctuation>\u2061</punctuation>' +
3745       '</content>' +
3746       '<children>' +
3747       '<function>cos</function>' +
3748       '<fenced>' +
3749       '<content>' +
3750       '<fence>(</fence>' +
3751       '<fence>)</fence>' +
3752       '</content>' +
3753       '<children>' +
3754       '<identifier>x</identifier>' +
3755       '</children>' +
3756       '</fenced>' +
3757       '</children>' +
3758       '</appl>' +
3759       '</children>' +
3760       '</infixop>' +
3761       '<appl>' +
3762       '<content>' +
3763       '<punctuation>\u2061</punctuation>' +
3764       '</content>' +
3765       '<children>' +
3766       '<function>tan</function>' +
3767       '<fenced>' +
3768       '<content>' +
3769       '<fence>(</fence>' +
3770       '<fence>)</fence>' +
3771       '</content>' +
3772       '<children>' +
3773       '<identifier>x</identifier>' +
3774       '</children>' +
3775       '</fenced>' +
3776       '</children>' +
3777       '</appl>' +
3778       '</children>' +
3779       '</relseq>');
3780
3781   this.executeTreeTest(
3782       '<mrow><mi>sin</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>+</mo><mi>cos</mi>' +
3783       '<mo>(</mo><mi>y</mi><mo>)</mo><mo>=</mo><mi>tan</mi><mo>(</mo>' +
3784       '<mi>x</mi><mi>y</mi><mo>)</mo></mrow>',
3785       '<relseq>=' +
3786       '<content>' +
3787       '<relation>=</relation>' +
3788       '</content>' +
3789       '<children>' +
3790       '<infixop>+' +
3791       '<content>' +
3792       '<operator>+</operator>' +
3793       '</content>' +
3794       '<children>' +
3795       '<appl>' +
3796       '<content>' +
3797       '<punctuation>\u2061</punctuation>' +
3798       '</content>' +
3799       '<children>' +
3800       '<function>sin</function>' +
3801       '<fenced>' +
3802       '<content>' +
3803       '<fence>(</fence>' +
3804       '<fence>)</fence>' +
3805       '</content>' +
3806       '<children>' +
3807       '<identifier>x</identifier>' +
3808       '</children>' +
3809       '</fenced>' +
3810       '</children>' +
3811       '</appl>' +
3812       '<appl>' +
3813       '<content>' +
3814       '<punctuation>\u2061</punctuation>' +
3815       '</content>' +
3816       '<children>' +
3817       '<function>cos</function>' +
3818       '<fenced>' +
3819       '<content>' +
3820       '<fence>(</fence>' +
3821       '<fence>)</fence>' +
3822       '</content>' +
3823       '<children>' +
3824       '<identifier>y</identifier>' +
3825       '</children>' +
3826       '</fenced>' +
3827       '</children>' +
3828       '</appl>' +
3829       '</children>' +
3830       '</infixop>' +
3831       '<appl>' +
3832       '<content>' +
3833       '<punctuation>\u2061</punctuation>' +
3834       '</content>' +
3835       '<children>' +
3836       '<function>tan</function>' +
3837       '<fenced>' +
3838       '<content>' +
3839       '<fence>(</fence>' +
3840       '<fence>)</fence>' +
3841       '</content>' +
3842       '<children>' +
3843       '<infixop>\u2062' +
3844       '<content>' +
3845       '<operator>\u2062</operator>' +
3846       '</content>' +
3847       '<children>' +
3848       '<identifier>x</identifier>' +
3849       '<identifier>y</identifier>' +
3850       '</children>' +
3851       '</infixop>' +
3852       '</children>' +
3853       '</fenced>' +
3854       '</children>' +
3855       '</appl>' +
3856       '</children>' +
3857       '</relseq>');
3858 });
3859
3860
3861 /**
3862  * Prefix function applications with sub- and superscripts.
3863  */
3864 TEST_F('CvoxSemanticTreeUnitTest', 'StreePrefixFuncsScripts', function() {
3865   this.brief = true;
3866   this.executeTreeTest(
3867       '<mrow><msup><mi>sin</mi><mn>2</mn></msup><mo>(</mo><mi>x</mi>' +
3868       '<mo>)</mo></mrow>',
3869       '<appl>' +
3870       '<content>' +
3871       '<punctuation>\u2061</punctuation>' +
3872       '</content>' +
3873       '<children>' +
3874       '<superscript>' +
3875       '<children>' +
3876       '<function>sin</function>' +
3877       '<number>2</number>' +
3878       '</children>' +
3879       '</superscript>' +
3880       '<fenced>' +
3881       '<content>' +
3882       '<fence>(</fence>' +
3883       '<fence>)</fence>' +
3884       '</content>' +
3885       '<children>' +
3886       '<identifier>x</identifier>' +
3887       '</children>' +
3888       '</fenced>' +
3889       '</children>' +
3890       '</appl>');
3891
3892   this.executeTreeTest(
3893       '<mrow><msub><mi>sin</mi><mn>1</mn></msub><mo>(</mo><mi>x</mi>' +
3894       '<mo>)</mo></mrow>',
3895       '<appl>' +
3896       '<content>' +
3897       '<punctuation>\u2061</punctuation>' +
3898       '</content>' +
3899       '<children>' +
3900       '<subscript>' +
3901       '<children>' +
3902       '<function>sin</function>' +
3903       '<number>1</number>' +
3904       '</children>' +
3905       '</subscript>' +
3906       '<fenced>' +
3907       '<content>' +
3908       '<fence>(</fence>' +
3909       '<fence>)</fence>' +
3910       '</content>' +
3911       '<children>' +
3912       '<identifier>x</identifier>' +
3913       '</children>' +
3914       '</fenced>' +
3915       '</children>' +
3916       '</appl>');
3917
3918   this.executeTreeTest(
3919       '<mrow><msubsup><mi>sin</mi><mn>2</mn><mn>1</mn></msubsup><mo>(</mo>' +
3920       '<mi>x</mi><mo>)</mo></mrow>',
3921       '<appl>' +
3922       '<content>' +
3923       '<punctuation>\u2061</punctuation>' +
3924       '</content>' +
3925       '<children>' +
3926       '<superscript>' +
3927       '<children>' +
3928       '<subscript>' +
3929       '<children>' +
3930       '<function>sin</function>' +
3931       '<number>2</number>' +
3932       '</children>' +
3933       '</subscript>' +
3934       '<number>1</number>' +
3935       '</children>' +
3936       '</superscript>' +
3937       '<fenced>' +
3938       '<content>' +
3939       '<fence>(</fence>' +
3940       '<fence>)</fence>' +
3941       '</content>' +
3942       '<children>' +
3943       '<identifier>x</identifier>' +
3944       '</children>' +
3945       '</fenced>' +
3946       '</children>' +
3947       '</appl>');
3948
3949   this.executeTreeTest(
3950       '<mrow><msup><mi>sin</mi><mn>2</mn></msup><mo>(</mo><mi>x</mi>' +
3951       '<mo>)</mo><mo>+</mo><msup><mi>cos</mi><mn>2</mn></msup><mo>(</mo>' +
3952       '<mi>y</mi><mo>)</mo><mo>=</mo><mn>1</mn></mrow>',
3953       '<relseq>=' +
3954       '<content>' +
3955       '<relation>=</relation>' +
3956       '</content>' +
3957       '<children>' +
3958       '<infixop>+' +
3959       '<content>' +
3960       '<operator>+</operator>' +
3961       '</content>' +
3962       '<children>' +
3963       '<appl>' +
3964       '<content>' +
3965       '<punctuation>\u2061</punctuation>' +
3966       '</content>' +
3967       '<children>' +
3968       '<superscript>' +
3969       '<children>' +
3970       '<function>sin</function>' +
3971       '<number>2</number>' +
3972       '</children>' +
3973       '</superscript>' +
3974       '<fenced>' +
3975       '<content>' +
3976       '<fence>(</fence>' +
3977       '<fence>)</fence>' +
3978       '</content>' +
3979       '<children>' +
3980       '<identifier>x</identifier>' +
3981       '</children>' +
3982       '</fenced>' +
3983       '</children>' +
3984       '</appl>' +
3985       '<appl>' +
3986       '<content>' +
3987       '<punctuation>\u2061</punctuation>' +
3988       '</content>' +
3989       '<children>' +
3990       '<superscript>' +
3991       '<children>' +
3992       '<function>cos</function>' +
3993       '<number>2</number>' +
3994       '</children>' +
3995       '</superscript>' +
3996       '<fenced>' +
3997       '<content>' +
3998       '<fence>(</fence>' +
3999       '<fence>)</fence>' +
4000       '</content>' +
4001       '<children>' +
4002       '<identifier>y</identifier>' +
4003       '</children>' +
4004       '</fenced>' +
4005       '</children>' +
4006       '</appl>' +
4007       '</children>' +
4008       '</infixop>' +
4009       '<number>1</number>' +
4010       '</children>' +
4011       '</relseq>');
4012 });
4013
4014
4015 /**
4016  * Prefix function applications with unfenced arguments.
4017  */
4018 TEST_F('CvoxSemanticTreeUnitTest', 'StreePrefixFuncsUnfenced', function() {
4019   this.brief = true;
4020   this.executeTreeTest(
4021       '<mrow><mi>sin</mi><mi>x</mi></mrow>',
4022       '<appl>' +
4023       '<content>' +
4024       '<punctuation>\u2061</punctuation>' +
4025       '</content>' +
4026       '<children>' +
4027       '<function>sin</function>' +
4028       '<identifier>x</identifier>' +
4029       '</children>' +
4030       '</appl>');
4031
4032   this.executeTreeTest(
4033       '<mrow><mi>sin</mi><mi>x</mi><mi>y</mi></mrow>',
4034       '<appl>' +
4035       '<content>' +
4036       '<punctuation>\u2061</punctuation>' +
4037       '</content>' +
4038       '<children>' +
4039       '<function>sin</function>' +
4040       '<infixop>\u2062' +
4041       '<content>' +
4042       '<operator>\u2062</operator>' +
4043       '</content>' +
4044       '<children>' +
4045       '<identifier>x</identifier>' +
4046       '<identifier>y</identifier>' +
4047       '</children>' +
4048       '</infixop>' +
4049       '</children>' +
4050       '</appl>');
4051
4052   this.executeTreeTest(
4053       '<mrow><mi>sin</mi><msup><mi>x</mi><mn>2</mn></msup></mrow>',
4054       '<appl>' +
4055       '<content>' +
4056       '<punctuation>\u2061</punctuation>' +
4057       '</content>' +
4058       '<children>' +
4059       '<function>sin</function>' +
4060       '<superscript>' +
4061       '<children>' +
4062       '<identifier>x</identifier>' +
4063       '<number>2</number>' +
4064       '</children>' +
4065       '</superscript>' +
4066       '</children>' +
4067       '</appl>');
4068
4069   this.executeTreeTest(
4070       '<mrow><mi>sin</mi><msub><mi>x</mi><mn>2</mn></msub></mrow>',
4071       '<appl>' +
4072       '<content>' +
4073       '<punctuation>\u2061</punctuation>' +
4074       '</content>' +
4075       '<children>' +
4076       '<function>sin</function>' +
4077       '<subscript>' +
4078       '<children>' +
4079       '<identifier>x</identifier>' +
4080       '<number>2</number>' +
4081       '</children>' +
4082       '</subscript>' +
4083       '</children>' +
4084       '</appl>');
4085
4086   this.executeTreeTest(
4087       '<mrow><mi>sin</mi><msubsup><mi>x</mi><mn>2</mn><mn>1</mn>' +
4088       '</msubsup></mrow>',
4089       '<appl>' +
4090       '<content>' +
4091       '<punctuation>\u2061</punctuation>' +
4092       '</content>' +
4093       '<children>' +
4094       '<function>sin</function>' +
4095       '<superscript>' +
4096       '<children>' +
4097       '<subscript>' +
4098       '<children>' +
4099       '<identifier>x</identifier>' +
4100       '<number>2</number>' +
4101       '</children>' +
4102       '</subscript>' +
4103       '<number>1</number>' +
4104       '</children>' +
4105       '</superscript>' +
4106       '</children>' +
4107       '</appl>');
4108
4109   this.executeTreeTest(
4110       '<mrow><mi>sin</mi><mover><mi>x</mi><mn>2</mn></mover></mrow>',
4111       '<appl>' +
4112       '<content>' +
4113       '<punctuation>\u2061</punctuation>' +
4114       '</content>' +
4115       '<children>' +
4116       '<function>sin</function>' +
4117       '<overscore>' +
4118       '<children>' +
4119       '<identifier>x</identifier>' +
4120       '<number>2</number>' +
4121       '</children>' +
4122       '</overscore>' +
4123       '</children>' +
4124       '</appl>');
4125
4126   this.executeTreeTest(
4127       '<mrow><mi>sin</mi><munder><mi>x</mi><mn>2</mn></munder></mrow>',
4128       '<appl>' +
4129       '<content>' +
4130       '<punctuation>\u2061</punctuation>' +
4131       '</content>' +
4132       '<children>' +
4133       '<function>sin</function>' +
4134       '<underscore>' +
4135       '<children>' +
4136       '<identifier>x</identifier>' +
4137       '<number>2</number>' +
4138       '</children>' +
4139       '</underscore>' +
4140       '</children>' +
4141       '</appl>');
4142
4143   this.executeTreeTest(
4144       '<mrow><mi>sin</mi><munderover><mi>x</mi><mn>2</mn><mn>1</mn>' +
4145       '</munderover></mrow>',
4146       '<appl>' +
4147       '<content>' +
4148       '<punctuation>\u2061</punctuation>' +
4149       '</content>' +
4150       '<children>' +
4151       '<function>sin</function>' +
4152       '<overscore>' +
4153       '<children>' +
4154       '<underscore>' +
4155       '<children>' +
4156       '<identifier>x</identifier>' +
4157       '<number>2</number>' +
4158       '</children>' +
4159       '</underscore>' +
4160       '<number>1</number>' +
4161       '</children>' +
4162       '</overscore>' +
4163       '</children>' +
4164       '</appl>');
4165
4166   this.executeTreeTest(
4167       '<mrow><mi>sin</mi><mfrac><mn>1</mn><mn>2</mn></mfrac></mrow>',
4168       '<appl>' +
4169       '<content>' +
4170       '<punctuation>\u2061</punctuation>' +
4171       '</content>' +
4172       '<children>' +
4173       '<function>sin</function>' +
4174       '<fraction>' +
4175       '<children>' +
4176       '<number>1</number>' +
4177       '<number>2</number>' +
4178       '</children>' +
4179       '</fraction>' +
4180       '</children>' +
4181       '</appl>');
4182 });
4183
4184
4185 /**
4186  * Prefix function applications with unfenced arguments in an operator
4187  * expression.
4188  */
4189 TEST_F('CvoxSemanticTreeUnitTest', 'StreePrefixFuncsUnfencedOps', function() {
4190   this.brief = true;
4191   this.executeTreeTest(
4192       '<mrow><mn>1</mn><mo>+</mo><mi>sin</mi><mi>x</mi></mrow>',
4193       '<infixop>+' +
4194       '<content>' +
4195       '<operator>+</operator>' +
4196       '</content>' +
4197       '<children>' +
4198       '<number>1</number>' +
4199       '<appl>' +
4200       '<content>' +
4201       '<punctuation>\u2061</punctuation>' +
4202       '</content>' +
4203       '<children>' +
4204       '<function>sin</function>' +
4205       '<identifier>x</identifier>' +
4206       '</children>' +
4207       '</appl>' +
4208       '</children>' +
4209       '</infixop>');
4210
4211   this.executeTreeTest(
4212       '<mrow><mi>sin</mi><mi>x</mi><mo>+</mo><mn>2</mn></mrow>',
4213       '<infixop>+' +
4214       '<content>' +
4215       '<operator>+</operator>' +
4216       '</content>' +
4217       '<children>' +
4218       '<appl>' +
4219       '<content>' +
4220       '<punctuation>\u2061</punctuation>' +
4221       '</content>' +
4222       '<children>' +
4223       '<function>sin</function>' +
4224       '<identifier>x</identifier>' +
4225       '</children>' +
4226       '</appl>' +
4227       '<number>2</number>' +
4228       '</children>' +
4229       '</infixop>');
4230
4231   this.executeTreeTest(
4232       '<mrow><mn>1</mn><mo>+</mo><mi>sin</mi><mi>x</mi><mo>+</mo>' +
4233       '<mn>2</mn></mrow>',
4234       '<infixop>+' +
4235       '<content>' +
4236       '<operator>+</operator>' +
4237       '<operator>+</operator>' +
4238       '</content>' +
4239       '<children>' +
4240       '<number>1</number>' +
4241       '<appl>' +
4242       '<content>' +
4243       '<punctuation>\u2061</punctuation>' +
4244       '</content>' +
4245       '<children>' +
4246       '<function>sin</function>' +
4247       '<identifier>x</identifier>' +
4248       '</children>' +
4249       '</appl>' +
4250       '<number>2</number>' +
4251       '</children>' +
4252       '</infixop>');
4253
4254   this.executeTreeTest(
4255       '<mrow><mo>a</mo><mo>+</mo><mi>sin</mi><mi>x</mi></mrow>',
4256       '<infixop>+' +
4257       '<content>' +
4258       '<operator>+</operator>' +
4259       '</content>' +
4260       '<children>' +
4261       '<identifier>a</identifier>' +
4262       '<appl>' +
4263       '<content>' +
4264       '<punctuation>\u2061</punctuation>' +
4265       '</content>' +
4266       '<children>' +
4267       '<function>sin</function>' +
4268       '<identifier>x</identifier>' +
4269       '</children>' +
4270       '</appl>' +
4271       '</children>' +
4272       '</infixop>');
4273
4274   this.executeTreeTest(
4275       '<mrow><mi>sin</mi><mi>x</mi><mo>+</mo><mo>b</mo></mrow>',
4276       '<infixop>+' +
4277       '<content>' +
4278       '<operator>+</operator>' +
4279       '</content>' +
4280       '<children>' +
4281       '<appl>' +
4282       '<content>' +
4283       '<punctuation>\u2061</punctuation>' +
4284       '</content>' +
4285       '<children>' +
4286       '<function>sin</function>' +
4287       '<identifier>x</identifier>' +
4288       '</children>' +
4289       '</appl>' +
4290       '<identifier>b</identifier>' +
4291       '</children>' +
4292       '</infixop>');
4293
4294   this.executeTreeTest(
4295       '<mrow><mo>a</mo><mo>+</mo><mi>sin</mi><mi>x</mi><mo>+</mo>' +
4296       '<mo>b</mo></mrow>',
4297       '<infixop>+' +
4298       '<content>' +
4299       '<operator>+</operator>' +
4300       '<operator>+</operator>' +
4301       '</content>' +
4302       '<children>' +
4303       '<identifier>a</identifier>' +
4304       '<appl>' +
4305       '<content>' +
4306       '<punctuation>\u2061</punctuation>' +
4307       '</content>' +
4308       '<children>' +
4309       '<function>sin</function>' +
4310       '<identifier>x</identifier>' +
4311       '</children>' +
4312       '</appl>' +
4313       '<identifier>b</identifier>' +
4314       '</children>' +
4315       '</infixop>');
4316
4317   this.executeTreeTest(
4318       '<mrow><mo>a</mo><mo>=</mo><mi>sin</mi><mi>x</mi></mrow>',
4319       '<relseq>=' +
4320       '<content>' +
4321       '<relation>=</relation>' +
4322       '</content>' +
4323       '<children>' +
4324       '<identifier>a</identifier>' +
4325       '<appl>' +
4326       '<content>' +
4327       '<punctuation>\u2061</punctuation>' +
4328       '</content>' +
4329       '<children>' +
4330       '<function>sin</function>' +
4331       '<identifier>x</identifier>' +
4332       '</children>' +
4333       '</appl>' +
4334       '</children>' +
4335       '</relseq>');
4336
4337   this.executeTreeTest(
4338       '<mrow><mi>sin</mi><mi>x</mi><mo>=</mo><mo>b</mo></mrow>',
4339       '<relseq>=' +
4340       '<content>' +
4341       '<relation>=</relation>' +
4342       '</content>' +
4343       '<children>' +
4344       '<appl>' +
4345       '<content>' +
4346       '<punctuation>\u2061</punctuation>' +
4347       '</content>' +
4348       '<children>' +
4349       '<function>sin</function>' +
4350       '<identifier>x</identifier>' +
4351       '</children>' +
4352       '</appl>' +
4353       '<identifier>b</identifier>' +
4354       '</children>' +
4355       '</relseq>');
4356
4357   this.executeTreeTest(
4358       '<mrow><mo>a</mo><mo>=</mo><mi>sin</mi><mi>x</mi><mo>=</mo>' +
4359       '<mo>b</mo></mrow>',
4360       '<relseq>=' +
4361       '<content>' +
4362       '<relation>=</relation>' +
4363       '<relation>=</relation>' +
4364       '</content>' +
4365       '<children>' +
4366       '<identifier>a</identifier>' +
4367       '<appl>' +
4368       '<content>' +
4369       '<punctuation>\u2061</punctuation>' +
4370       '</content>' +
4371       '<children>' +
4372       '<function>sin</function>' +
4373       '<identifier>x</identifier>' +
4374       '</children>' +
4375       '</appl>' +
4376       '<identifier>b</identifier>' +
4377       '</children>' +
4378       '</relseq>');
4379 });
4380
4381
4382 /**
4383  * Multiple prefix function applications with unfenced arguments.
4384  */
4385 TEST_F('CvoxSemanticTreeUnitTest', 'StreePrefixFuncsMultiUnfenced', function() {
4386   this.brief = true;
4387   this.executeTreeTest(
4388       '<mrow><mi>sin</mi><mi>x</mi><mo>+</mo><mi>cos</mi><mi>x</mi></mrow>',
4389       '<infixop>+' +
4390       '<content>' +
4391       '<operator>+</operator>' +
4392       '</content>' +
4393       '<children>' +
4394       '<appl>' +
4395       '<content>' +
4396       '<punctuation>\u2061</punctuation>' +
4397       '</content>' +
4398       '<children>' +
4399       '<function>sin</function>' +
4400       '<identifier>x</identifier>' +
4401       '</children>' +
4402       '</appl>' +
4403       '<appl>' +
4404       '<content>' +
4405       '<punctuation>\u2061</punctuation>' +
4406       '</content>' +
4407       '<children>' +
4408       '<function>cos</function>' +
4409       '<identifier>x</identifier>' +
4410       '</children>' +
4411       '</appl>' +
4412       '</children>' +
4413       '</infixop>');
4414
4415   this.executeTreeTest(
4416       '<mrow><mi>sin</mi><mi>x</mi><mo>+</mo><mi>cos</mi><mi>x</mi><mo>=</mo>' +
4417       '<mi>tan</mi><mi>x</mi></mrow>',
4418       '<relseq>=' +
4419       '<content>' +
4420       '<relation>=</relation>' +
4421       '</content>' +
4422       '<children>' +
4423       '<infixop>+' +
4424       '<content>' +
4425       '<operator>+</operator>' +
4426       '</content>' +
4427       '<children>' +
4428       '<appl>' +
4429       '<content>' +
4430       '<punctuation>\u2061</punctuation>' +
4431       '</content>' +
4432       '<children>' +
4433       '<function>sin</function>' +
4434       '<identifier>x</identifier>' +
4435       '</children>' +
4436       '</appl>' +
4437       '<appl>' +
4438       '<content>' +
4439       '<punctuation>\u2061</punctuation>' +
4440       '</content>' +
4441       '<children>' +
4442       '<function>cos</function>' +
4443       '<identifier>x</identifier>' +
4444       '</children>' +
4445       '</appl>' +
4446       '</children>' +
4447       '</infixop>' +
4448       '<appl>' +
4449       '<content>' +
4450       '<punctuation>\u2061</punctuation>' +
4451       '</content>' +
4452       '<children>' +
4453       '<function>tan</function>' +
4454       '<identifier>x</identifier>' +
4455       '</children>' +
4456       '</appl>' +
4457       '</children>' +
4458       '</relseq>');
4459
4460   this.executeTreeTest(
4461       '<mrow><mi>sin</mi><mi>x</mi><mo>+</mo><mi>cos</mi><mi>y</mi><mo>=</mo>' +
4462       '<mi>tan</mi><mi>x</mi><mi>y</mi></mrow>',
4463       '<relseq>=' +
4464       '<content>' +
4465       '<relation>=</relation>' +
4466       '</content>' +
4467       '<children>' +
4468       '<infixop>+' +
4469       '<content>' +
4470       '<operator>+</operator>' +
4471       '</content>' +
4472       '<children>' +
4473       '<appl>' +
4474       '<content>' +
4475       '<punctuation>\u2061</punctuation>' +
4476       '</content>' +
4477       '<children>' +
4478       '<function>sin</function>' +
4479       '<identifier>x</identifier>' +
4480       '</children>' +
4481       '</appl>' +
4482       '<appl>' +
4483       '<content>' +
4484       '<punctuation>\u2061</punctuation>' +
4485       '</content>' +
4486       '<children>' +
4487       '<function>cos</function>' +
4488       '<identifier>y</identifier>' +
4489       '</children>' +
4490       '</appl>' +
4491       '</children>' +
4492       '</infixop>' +
4493       '<appl>' +
4494       '<content>' +
4495       '<punctuation>\u2061</punctuation>' +
4496       '</content>' +
4497       '<children>' +
4498       '<function>tan</function>' +
4499       '<infixop>\u2062' +
4500       '<content>' +
4501       '<operator>\u2062</operator>' +
4502       '</content>' +
4503       '<children>' +
4504       '<identifier>x</identifier>' +
4505       '<identifier>y</identifier>' +
4506       '</children>' +
4507       '</infixop>' +
4508       '</children>' +
4509       '</appl>' +
4510       '</children>' +
4511       '</relseq>');
4512 });
4513
4514
4515 /**
4516  * Prefix function applications with sub- and superscripts and unfenced
4517  * arguments.
4518  */
4519 TEST_F('CvoxSemanticTreeUnitTest', 'StreePrefixFuncsScriptUnfenced',
4520     function() {
4521   this.brief = true;
4522   this.executeTreeTest(
4523       '<mrow><msup><mi>sin</mi><mn>2</mn></msup><mi>x</mi></mrow>',
4524       '<appl>' +
4525       '<content>' +
4526       '<punctuation>\u2061</punctuation>' +
4527       '</content>' +
4528       '<children>' +
4529       '<superscript>' +
4530       '<children>' +
4531       '<function>sin</function>' +
4532       '<number>2</number>' +
4533       '</children>' +
4534       '</superscript>' +
4535       '<identifier>x</identifier>' +
4536       '</children>' +
4537       '</appl>');
4538
4539   this.executeTreeTest(
4540       '<mrow><msub><mi>sin</mi><mn>1</mn></msub><mi>x</mi></mrow>',
4541       '<appl>' +
4542       '<content>' +
4543       '<punctuation>\u2061</punctuation>' +
4544       '</content>' +
4545       '<children>' +
4546       '<subscript>' +
4547       '<children>' +
4548       '<function>sin</function>' +
4549       '<number>1</number>' +
4550       '</children>' +
4551       '</subscript>' +
4552       '<identifier>x</identifier>' +
4553       '</children>' +
4554       '</appl>');
4555
4556   this.executeTreeTest(
4557       '<mrow><msubsup><mi>sin</mi><mn>2</mn><mn>1</mn></msubsup>' +
4558       '<mi>x</mi></mrow>',
4559       '<appl>' +
4560       '<content>' +
4561       '<punctuation>\u2061</punctuation>' +
4562       '</content>' +
4563       '<children>' +
4564       '<superscript>' +
4565       '<children>' +
4566       '<subscript>' +
4567       '<children>' +
4568       '<function>sin</function>' +
4569       '<number>2</number>' +
4570       '</children>' +
4571       '</subscript>' +
4572       '<number>1</number>' +
4573       '</children>' +
4574       '</superscript>' +
4575       '<identifier>x</identifier>' +
4576       '</children>' +
4577       '</appl>');
4578
4579   this.executeTreeTest(
4580       '<mrow><msup><mi>sin</mi><mn>2</mn></msup><mi>x</mi><mo>+</mo><msup>' +
4581       '<mi>cos</mi><mn>2</mn></msup><mi>y</mi><mo>=</mo><mn>1</mn></mrow>',
4582       '<relseq>=' +
4583       '<content>' +
4584       '<relation>=</relation>' +
4585       '</content>' +
4586       '<children>' +
4587       '<infixop>+' +
4588       '<content>' +
4589       '<operator>+</operator>' +
4590       '</content>' +
4591       '<children>' +
4592       '<appl>' +
4593       '<content>' +
4594       '<punctuation>\u2061</punctuation>' +
4595       '</content>' +
4596       '<children>' +
4597       '<superscript>' +
4598       '<children>' +
4599       '<function>sin</function>' +
4600       '<number>2</number>' +
4601       '</children>' +
4602       '</superscript>' +
4603       '<identifier>x</identifier>' +
4604       '</children>' +
4605       '</appl>' +
4606       '<appl>' +
4607       '<content>' +
4608       '<punctuation>\u2061</punctuation>' +
4609       '</content>' +
4610       '<children>' +
4611       '<superscript>' +
4612       '<children>' +
4613       '<function>cos</function>' +
4614       '<number>2</number>' +
4615       '</children>' +
4616       '</superscript>' +
4617       '<identifier>y</identifier>' +
4618       '</children>' +
4619       '</appl>' +
4620       '</children>' +
4621       '</infixop>' +
4622       '<number>1</number>' +
4623       '</children>' +
4624       '</relseq>');
4625   this.executeTreeTest(
4626       '<mrow><msubsup><msubsup><mi>sin</mi><mn>2</mn><mn>1</mn>' +
4627       '</msubsup><mi>n</mi><mi>m</mi></msubsup><mi>x</mi></mrow>',
4628       '<appl>' +
4629       '<content>' +
4630       '<punctuation>\u2061</punctuation>' +
4631       '</content>' +
4632       '<children>' +
4633       '<superscript>' +
4634       '<children>' +
4635       '<subscript>' +
4636       '<children>' +
4637       '<superscript>' +
4638       '<children>' +
4639       '<subscript>' +
4640       '<children>' +
4641       '<function>sin</function>' +
4642       '<number>2</number>' +
4643       '</children>' +
4644       '</subscript>' +
4645       '<number>1</number>' +
4646       '</children>' +
4647       '</superscript>' +
4648       '<identifier>n</identifier>' +
4649       '</children>' +
4650       '</subscript>' +
4651       '<identifier>m</identifier>' +
4652       '</children>' +
4653       '</superscript>' +
4654       '<identifier>x</identifier>' +
4655       '</children>' +
4656       '</appl>');
4657 });
4658
4659
4660 /**
4661  * Prefix functions without arguments.
4662  */
4663 TEST_F('CvoxSemanticTreeUnitTest', 'StreePrefixFuncsNoArgs', function() {
4664   this.brief = true;
4665   this.executeTreeTest(
4666       '<mi>sin</mi>',
4667       '<function>sin</function>');
4668
4669   this.executeTreeTest(
4670       '<msup><mi>sin</mi><mn>2</mn></msup>',
4671       '<superscript>' +
4672       '<children>' +
4673       '<function>sin</function>' +
4674       '<number>2</number>' +
4675       '</children>' +
4676       '</superscript>');
4677
4678   this.executeTreeTest(
4679       '<msup><mi>sin</mi><mn>2</mn></msup><mo>+</mo><msup><mi>cos</mi>' +
4680       '<mn>2</mn></msup>',
4681       '<infixop>+' +
4682       '<content>' +
4683       '<operator>+</operator>' +
4684       '</content>' +
4685       '<children>' +
4686       '<appl>' +
4687       '<content>' +
4688       '<punctuation>\u2061</punctuation>' +
4689       '</content>' +
4690       '<children>' +
4691       '<superscript>' +
4692       '<children>' +
4693       '<function>sin</function>' +
4694       '<number>2</number>' +
4695       '</children>' +
4696       '</superscript>' +
4697       '<empty/>' +
4698       '</children>' +
4699       '</appl>' +
4700       '<appl>' +
4701       '<content>' +
4702       '<punctuation>\u2061</punctuation>' +
4703       '</content>' +
4704       '<children>' +
4705       '<superscript>' +
4706       '<children>' +
4707       '<function>cos</function>' +
4708       '<number>2</number>' +
4709       '</children>' +
4710       '</superscript>' +
4711       '<empty/>' +
4712       '</children>' +
4713       '</appl>' +
4714       '</children>' +
4715       '</infixop>');
4716
4717   this.executeTreeTest(
4718       '<mrow><msup><mi>sin</mi><mn>2</mn></msup><mo>+</mo>' +
4719       '<msup><mi>cos</mi><mn>2</mn></msup><mo>=</mo><mn>1</mn></mrow>',
4720       '<relseq>=' +
4721       '<content>' +
4722       '<relation>=</relation>' +
4723       '</content>' +
4724       '<children>' +
4725       '<infixop>+' +
4726       '<content>' +
4727       '<operator>+</operator>' +
4728       '</content>' +
4729       '<children>' +
4730       '<appl>' +
4731       '<content>' +
4732       '<punctuation>\u2061</punctuation>' +
4733       '</content>' +
4734       '<children>' +
4735       '<superscript>' +
4736       '<children>' +
4737       '<function>sin</function>' +
4738       '<number>2</number>' +
4739       '</children>' +
4740       '</superscript>' +
4741       '<empty/>' +
4742       '</children>' +
4743       '</appl>' +
4744       '<appl>' +
4745       '<content>' +
4746       '<punctuation>\u2061</punctuation>' +
4747       '</content>' +
4748       '<children>' +
4749       '<superscript>' +
4750       '<children>' +
4751       '<function>cos</function>' +
4752       '<number>2</number>' +
4753       '</children>' +
4754       '</superscript>' +
4755       '<empty/>' +
4756       '</children>' +
4757       '</appl>' +
4758       '</children>' +
4759       '</infixop>' +
4760       '<number>1</number>' +
4761       '</children>' +
4762       '</relseq>');
4763
4764   this.executeTreeTest(
4765       '<mrow><mi>sin</mi><mo>=</mo><mfrac><mn>1</mn>' +
4766       '<mi>csc</mi></mfrac></mrow>',
4767       '<relseq>=' +
4768       '<content>' +
4769       '<relation>=</relation>' +
4770       '</content>' +
4771       '<children>' +
4772       '<appl>' +
4773       '<content>' +
4774       '<punctuation>\u2061</punctuation>' +
4775       '</content>' +
4776       '<children>' +
4777       '<function>sin</function>' +
4778       '<empty/>' +
4779       '</children>' +
4780       '</appl>' +
4781       '<fraction>' +
4782       '<children>' +
4783       '<number>1</number>' +
4784       '<function>csc</function>' +
4785       '</children>' +
4786       '</fraction>' +
4787       '</children>' +
4788       '</relseq>');
4789 });
4790
4791
4792 /**
4793  * Nested prefix function applications, both with and without fenced arguments.
4794  */
4795 TEST_F('CvoxSemanticTreeUnitTest', 'StreePrefixFuncsNested', function() {
4796   this.brief = true;
4797   this.executeTreeTest(
4798     '<mrow><mi>log</mi><mi>cos</mi><mi>x</mi></mrow>',
4799     '<appl>' +
4800     '<content>' +
4801     '<punctuation>\u2061</punctuation>' +
4802     '</content>' +
4803     '<children>' +
4804     '<function>log</function>' +
4805     '<appl>' +
4806     '<content>' +
4807     '<punctuation>\u2061</punctuation>' +
4808     '</content>' +
4809     '<children>' +
4810     '<function>cos</function>' +
4811     '<identifier>x</identifier>' +
4812     '</children>' +
4813     '</appl>' +
4814     '</children>' +
4815     '</appl>');
4816
4817   this.executeTreeTest(
4818     '<mrow><mi>ln</mi><mo>' +
4819         '(</mo><mi>sin</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>)</mo></mrow>',
4820     '<appl>' +
4821     '<content>' +
4822     '<punctuation>\u2061</punctuation>' +
4823     '</content>' +
4824     '<children>' +
4825     '<function>ln</function>' +
4826     '<fenced>' +
4827     '<content>' +
4828     '<fence>(</fence>' +
4829     '<fence>)</fence>' +
4830     '</content>' +
4831     '<children>' +
4832     '<appl>' +
4833     '<content>' +
4834     '<punctuation>\u2061</punctuation>' +
4835     '</content>' +
4836     '<children>' +
4837     '<function>sin</function>' +
4838     '<fenced>' +
4839     '<content>' +
4840     '<fence>(</fence>' +
4841     '<fence>)</fence>' +
4842     '</content>' +
4843     '<children>' +
4844     '<identifier>x</identifier>' +
4845     '</children>' +
4846     '</fenced>' +
4847     '</children>' +
4848     '</appl>' +
4849     '</children>' +
4850     '</fenced>' +
4851     '</children>' +
4852     '</appl>');
4853
4854   this.executeTreeTest(
4855     '<mrow><mi>log</mi><mi>cos</mi><mi>x</mi><mo>=' +
4856         '</mo><mi>ln</mi><mo>(</mo><mi>sin</mi><mo>' +
4857         '(</mo><mi>x</mi><mo>)</mo><mo>)</mo></mrow>',
4858     '<relseq>=' +
4859     '<content>' +
4860     '<relation>=</relation>' +
4861     '</content>' +
4862     '<children>' +
4863     '<appl>' +
4864     '<content>' +
4865     '<punctuation>\u2061</punctuation>' +
4866     '</content>' +
4867     '<children>' +
4868     '<function>log</function>' +
4869     '<appl>' +
4870     '<content>' +
4871     '<punctuation>\u2061</punctuation>' +
4872     '</content>' +
4873     '<children>' +
4874     '<function>cos</function>' +
4875     '<identifier>x</identifier>' +
4876     '</children>' +
4877     '</appl>' +
4878     '</children>' +
4879     '</appl>' +
4880     '<appl>' +
4881     '<content>' +
4882     '<punctuation>\u2061</punctuation>' +
4883     '</content>' +
4884     '<children>' +
4885     '<function>ln</function>' +
4886     '<fenced>' +
4887     '<content>' +
4888     '<fence>(</fence>' +
4889     '<fence>)</fence>' +
4890     '</content>' +
4891     '<children>' +
4892     '<appl>' +
4893     '<content>' +
4894     '<punctuation>\u2061</punctuation>' +
4895     '</content>' +
4896     '<children>' +
4897     '<function>sin</function>' +
4898     '<fenced>' +
4899     '<content>' +
4900     '<fence>(</fence>' +
4901     '<fence>)</fence>' +
4902     '</content>' +
4903     '<children>' +
4904     '<identifier>x</identifier>' +
4905     '</children>' +
4906     '</fenced>' +
4907     '</children>' +
4908     '</appl>' +
4909     '</children>' +
4910     '</fenced>' +
4911     '</children>' +
4912     '</appl>' +
4913     '</children>' +
4914     '</relseq>');
4915 });
4916
4917
4918 /**
4919  * Variations of tables representing matrices, vectors, case statements,
4920  * multiline equations and regular tables.
4921  */
4922 TEST_F('CvoxSemanticTreeUnitTest', 'StreeTables', function() {
4923   this.brief = false;
4924   this.executeTreeTest(
4925       '<mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">A</mi>' +
4926       '<mo>=</mo><mo>[</mo><mtable rowspacing="4pt" columnspacing="1em">' +
4927       '<mtr><mtd><mn>0</mn></mtd><mtd><mn>1</mn></mtd></mtr><mtr><mtd>' +
4928       '<mn>2</mn></mtd><mtd><mn>3</mn></mtd></mtr></mtable><mo>]</mo>' +
4929       '</mrow>',
4930       '<relseq role="equality" id="16">=' +
4931       '<content>' +
4932       '<relation role="equality" id="1">=</relation>' +
4933       '</content>' +
4934       '<children>' +
4935       '<identifier role="latinletter" font="bold" id="0">A</identifier>' +
4936       '<matrix role="unknown" id="13">' +
4937       '<content>' +
4938       '<fence role="open" id="2">[</fence>' +
4939       '<fence role="close" id="14">]</fence>' +
4940       '</content>' +
4941       '<children>' +
4942       '<row role="matrix" id="7">' +
4943       '<children>' +
4944       '<cell role="matrix" id="4">' +
4945       '<children>' +
4946       '<number role="integer" font="normal" id="3">0</number>' +
4947       '</children>' +
4948       '</cell>' +
4949       '<cell role="matrix" id="6">' +
4950       '<children>' +
4951       '<number role="integer" font="normal" id="5">1</number>' +
4952       '</children>' +
4953       '</cell>' +
4954       '</children>' +
4955       '</row>' +
4956       '<row role="matrix" id="12">' +
4957       '<children>' +
4958       '<cell role="matrix" id="9">' +
4959       '<children>' +
4960       '<number role="integer" font="normal" id="8">2</number>' +
4961       '</children>' +
4962       '</cell>' +
4963       '<cell role="matrix" id="11">' +
4964       '<children>' +
4965       '<number role="integer" font="normal" id="10">3</number>' +
4966       '</children>' +
4967       '</cell>' +
4968       '</children>' +
4969       '</row>' +
4970       '</children>' +
4971       '</matrix>' +
4972       '</children>' +
4973       '</relseq>');
4974
4975   this.executeTreeTest(
4976       '<mo>[</mo><mtable rowspacing="4pt" columnspacing="1em"><mtr>' +
4977       '<mtd><mn>0</mn></mtd><mtd><mn>1</mn></mtd></mtr><mtr><mtd>' +
4978       '<mn>2</mn></mtd><mtd><mn>3</mn></mtd></mtr></mtable>' +
4979       '<mo>]</mo>',
4980       '<matrix role="unknown" id="11">' +
4981       '<content>' +
4982       '<fence role="open" id="0">[</fence>' +
4983       '<fence role="close" id="12">]</fence>' +
4984       '</content>' +
4985       '<children>' +
4986       '<row role="matrix" id="5">' +
4987       '<children>' +
4988       '<cell role="matrix" id="2">' +
4989       '<children>' +
4990       '<number role="integer" font="normal" id="1">0</number>' +
4991       '</children>' +
4992       '</cell>' +
4993       '<cell role="matrix" id="4">' +
4994       '<children>' +
4995       '<number role="integer" font="normal" id="3">1</number>' +
4996       '</children>' +
4997       '</cell>' +
4998       '</children>' +
4999       '</row>' +
5000       '<row role="matrix" id="10">' +
5001       '<children>' +
5002       '<cell role="matrix" id="7">' +
5003       '<children>' +
5004       '<number role="integer" font="normal" id="6">2</number>' +
5005       '</children>' +
5006       '</cell>' +
5007       '<cell role="matrix" id="9">' +
5008       '<children>' +
5009       '<number role="integer" font="normal" id="8">3</number>' +
5010       '</children>' +
5011       '</cell>' +
5012       '</children>' +
5013       '</row>' +
5014       '</children>' +
5015       '</matrix>');
5016
5017   this.executeTreeTest(
5018       '<mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">V</mi>' +
5019       '<mo>=</mo><mo>[</mo><mtable rowspacing="4pt" columnspacing="1em">' +
5020       '<mtr><mtd><mn>1</mn></mtd></mtr><mtr><mtd><mn>2</mn></mtd></mtr>' +
5021       '<mtr><mtd><mn>3</mn></mtd></mtr></mtable><mo>]</mo></mrow>',
5022       '<relseq role="equality" id="15">=' +
5023       '<content>' +
5024       '<relation role="equality" id="1">=</relation>' +
5025       '</content>' +
5026       '<children>' +
5027       '<identifier role="latinletter" font="bold" id="0">V</identifier>' +
5028       '<vector role="unknown" id="12">' +
5029       '<content>' +
5030       '<fence role="open" id="2">[</fence>' +
5031       '<fence role="close" id="13">]</fence>' +
5032       '</content>' +
5033       '<children>' +
5034       '<line role="vector" id="5">' +
5035       '<children>' +
5036       '<number role="integer" font="normal" id="3">1</number>' +
5037       '</children>' +
5038       '</line>' +
5039       '<line role="vector" id="8">' +
5040       '<children>' +
5041       '<number role="integer" font="normal" id="6">2</number>' +
5042       '</children>' +
5043       '</line>' +
5044       '<line role="vector" id="11">' +
5045       '<children>' +
5046       '<number role="integer" font="normal" id="9">3</number>' +
5047       '</children>' +
5048       '</line>' +
5049       '</children>' +
5050       '</vector>' +
5051       '</children>' +
5052       '</relseq>');
5053
5054   this.executeTreeTest(
5055       '<mo>[</mo><mtable rowspacing="4pt" columnspacing="1em">' +
5056       '<mtr><mtd><mn>1</mn></mtd></mtr><mtr><mtd><mn>2</mn></mtd></mtr>' +
5057       '<mtr><mtd><mn>3</mn></mtd></mtr></mtable><mo>]</mo>',
5058       '<vector role="unknown" id="10">' +
5059       '<content>' +
5060       '<fence role="open" id="0">[</fence>' +
5061       '<fence role="close" id="11">]</fence>' +
5062       '</content>' +
5063       '<children>' +
5064       '<line role="vector" id="3">' +
5065       '<children>' +
5066       '<number role="integer" font="normal" id="1">1</number>' +
5067       '</children>' +
5068       '</line>' +
5069       '<line role="vector" id="6">' +
5070       '<children>' +
5071       '<number role="integer" font="normal" id="4">2</number>' +
5072       '</children>' +
5073       '</line>' +
5074       '<line role="vector" id="9">' +
5075       '<children>' +
5076       '<number role="integer" font="normal" id="7">3</number>' +
5077       '</children>' +
5078       '</line>' +
5079       '</children>' +
5080       '</vector>');
5081
5082
5083   this.executeTreeTest(
5084       '<mrow><mo>{</mo><mtable><mtr><mtd><mi>a</mi></mtd><mtd>' +
5085       '<mtext>often</mtext></mtd></mtr><mtr><mtd><mi>b</mi></mtd>' +
5086       '<mtd><mtext>sometimes</mtext></mtd></mtr></mtable></mrow>',
5087       '<cases role="unknown" id="11">' +
5088       '<content>' +
5089       '<punctuation role="openfence" id="0">{</punctuation>' +
5090       '</content>' +
5091       '<children>' +
5092       '<row role="cases" id="5">' +
5093       '<children>' +
5094       '<cell role="cases" id="2">' +
5095       '<children>' +
5096       '<identifier role="latinletter" font="normal" id="1">a</identifier>' +
5097       '</children>' +
5098       '</cell>' +
5099       '<cell role="cases" id="4">' +
5100       '<children>' +
5101       '<text role="unknown" id="3">often</text>' +
5102       '</children>' +
5103       '</cell>' +
5104       '</children>' +
5105       '</row>' +
5106       '<row role="cases" id="10">' +
5107       '<children>' +
5108       '<cell role="cases" id="7">' +
5109       '<children>' +
5110       '<identifier role="latinletter" font="normal" id="6">b</identifier>' +
5111       '</children>' +
5112       '</cell>' +
5113       '<cell role="cases" id="9">' +
5114       '<children>' +
5115       '<text role="unknown" id="8">sometimes</text>' +
5116       '</children>' +
5117       '</cell>' +
5118       '</children>' +
5119       '</row>' +
5120       '</children>' +
5121       '</cases>');
5122
5123   this.executeTreeTest(
5124       '<mrow><mi mathvariant="bold">A</mi><mo>=</mo><mo>{</mo><mtable>' +
5125       '<mtr><mtd><mi>a</mi></mtd><mtd><mtext>often</mtext></mtd></mtr>' +
5126       '<mtr><mtd><mi>b</mi></mtd><mtd><mtext>sometimes</mtext></mtd></mtr>' +
5127       '</mtable></mrow>',
5128       '<relseq role="equality" id="14">=' +
5129       '<content>' +
5130       '<relation role="equality" id="1">=</relation>' +
5131       '</content>' +
5132       '<children>' +
5133       '<identifier role="latinletter" font="bold" id="0">A</identifier>' +
5134       '<cases role="unknown" id="13">' +
5135       '<content>' +
5136       '<punctuation role="openfence" id="2">{</punctuation>' +
5137       '</content>' +
5138       '<children>' +
5139       '<row role="cases" id="7">' +
5140       '<children>' +
5141       '<cell role="cases" id="4">' +
5142       '<children>' +
5143       '<identifier role="latinletter" font="normal" id="3">a</identifier>' +
5144       '</children>' +
5145       '</cell>' +
5146       '<cell role="cases" id="6">' +
5147       '<children>' +
5148       '<text role="unknown" id="5">often</text>' +
5149       '</children>' +
5150       '</cell>' +
5151       '</children>' +
5152       '</row>' +
5153       '<row role="cases" id="12">' +
5154       '<children>' +
5155       '<cell role="cases" id="9">' +
5156       '<children>' +
5157       '<identifier role="latinletter" font="normal" id="8">b</identifier>' +
5158       '</children>' +
5159       '</cell>' +
5160       '<cell role="cases" id="11">' +
5161       '<children>' +
5162       '<text role="unknown" id="10">sometimes</text>' +
5163       '</children>' +
5164       '</cell>' +
5165       '</children>' +
5166       '</row>' +
5167       '</children>' +
5168       '</cases>' +
5169       '</children>' +
5170       '</relseq>');
5171
5172   this.executeTreeTest(
5173       '<mrow><mo>{</mo><mtable><mtr><mtd><mi>a</mi></mtd><mtd>' +
5174       '<mtext>often</mtext></mtd></mtr><mtr><mtd><mi>b</mi></mtd><mtd>' +
5175       '<mtext>sometimes</mtext></mtd></mtr></mtable><mo>.</mo></mrow>',
5176       '<punctuated role="endpunct" id="13">' +
5177       '<content>' +
5178       '<punctuation role="fullstop" id="12">.</punctuation>' +
5179       '</content>' +
5180       '<children>' +
5181       '<cases role="unknown" id="11">' +
5182       '<content>' +
5183       '<punctuation role="openfence" id="0">{</punctuation>' +
5184       '</content>' +
5185       '<children>' +
5186       '<row role="cases" id="5">' +
5187       '<children>' +
5188       '<cell role="cases" id="2">' +
5189       '<children>' +
5190       '<identifier role="latinletter" font="normal" id="1">a</identifier>' +
5191       '</children>' +
5192       '</cell>' +
5193       '<cell role="cases" id="4">' +
5194       '<children>' +
5195       '<text role="unknown" id="3">often</text>' +
5196       '</children>' +
5197       '</cell>' +
5198       '</children>' +
5199       '</row>' +
5200       '<row role="cases" id="10">' +
5201       '<children>' +
5202       '<cell role="cases" id="7">' +
5203       '<children>' +
5204       '<identifier role="latinletter" font="normal" id="6">b</identifier>' +
5205       '</children>' +
5206       '</cell>' +
5207       '<cell role="cases" id="9">' +
5208       '<children>' +
5209       '<text role="unknown" id="8">sometimes</text>' +
5210       '</children>' +
5211       '</cell>' +
5212       '</children>' +
5213       '</row>' +
5214       '</children>' +
5215       '</cases>' +
5216       '<punctuation role="fullstop" id="12">.</punctuation>' +
5217       '</children>' +
5218       '</punctuated>');
5219
5220   this.executeTreeTest(
5221       '<mrow><mo>{</mo><mtable><mtr><mtd><mi>a</mi></mtd>' +
5222       '<mtd><mtext>often</mtext></mtd></mtr><mtr><mtd><mi>b</mi></mtd>' +
5223       '<mtd><mtext>sometimes</mtext></mtd></mtr></mtable>' +
5224       '<mo>,</mo><mi>b</mi><mo>,</mo><mi>c</mi><mo>.</mo></mrow>',
5225       '<punctuated role="sequence" id="17">' +
5226       '<content>' +
5227       '<punctuation role="unknown" id="12">,</punctuation>' +
5228       '<punctuation role="unknown" id="14">,</punctuation>' +
5229       '<punctuation role="fullstop" id="16">.</punctuation>' +
5230       '</content>' +
5231       '<children>' +
5232       '<cases role="unknown" id="11">' +
5233       '<content>' +
5234       '<punctuation role="openfence" id="0">{</punctuation>' +
5235       '</content>' +
5236       '<children>' +
5237       '<row role="cases" id="5">' +
5238       '<children>' +
5239       '<cell role="cases" id="2">' +
5240       '<children>' +
5241       '<identifier role="latinletter" font="normal" id="1">a</identifier>' +
5242       '</children>' +
5243       '</cell>' +
5244       '<cell role="cases" id="4">' +
5245       '<children>' +
5246       '<text role="unknown" id="3">often</text>' +
5247       '</children>' +
5248       '</cell>' +
5249       '</children>' +
5250       '</row>' +
5251       '<row role="cases" id="10">' +
5252       '<children>' +
5253       '<cell role="cases" id="7">' +
5254       '<children>' +
5255       '<identifier role="latinletter" font="normal" id="6">b</identifier>' +
5256       '</children>' +
5257       '</cell>' +
5258       '<cell role="cases" id="9">' +
5259       '<children>' +
5260       '<text role="unknown" id="8">sometimes</text>' +
5261       '</children>' +
5262       '</cell>' +
5263       '</children>' +
5264       '</row>' +
5265       '</children>' +
5266       '</cases>' +
5267       '<punctuation role="unknown" id="12">,</punctuation>' +
5268       '<identifier role="latinletter" font="normal" id="13">b</identifier>' +
5269       '<punctuation role="unknown" id="14">,</punctuation>' +
5270       '<identifier role="latinletter" font="normal" id="15">c</identifier>' +
5271       '<punctuation role="fullstop" id="16">.</punctuation>' +
5272       '</children>' +
5273       '</punctuated>');
5274
5275   this.executeTreeTest(
5276       '<mrow><mo>{</mo><mtable><mtr><mtd><mi>a</mi><mo>,</mo>' +
5277       '<mtext>often</mtext></mtd></mtr><mtr><mtd><mi>b</mi><mo>,</mo>' +
5278       '<mtext>sometimes</mtext></mtd></mtr></mtable><mo>,</mo><mi>b</mi>' +
5279       '<mo>,</mo><mi>c</mi><mo>.</mo></mrow>',
5280       '<punctuated role="sequence" id="19">' +
5281       '<content>' +
5282       '<punctuation role="unknown" id="14">,</punctuation>' +
5283       '<punctuation role="unknown" id="16">,</punctuation>' +
5284       '<punctuation role="fullstop" id="18">.</punctuation>' +
5285       '</content>' +
5286       '<children>' +
5287       '<cases role="unknown" id="13">' +
5288       '<content>' +
5289       '<punctuation role="openfence" id="0">{</punctuation>' +
5290       '</content>' +
5291       '<children>' +
5292       '<line role="cases" id="6">' +
5293       '<children>' +
5294       '<punctuated role="sequence" id="4">' +
5295       '<content>' +
5296       '<punctuation role="unknown" id="2">,</punctuation>' +
5297       '</content>' +
5298       '<children>' +
5299       '<identifier role="latinletter" font="normal" id="1">a</identifier>' +
5300       '<punctuation role="unknown" id="2">,</punctuation>' +
5301       '<text role="unknown" id="3">often</text>' +
5302       '</children>' +
5303       '</punctuated>' +
5304       '</children>' +
5305       '</line>' +
5306       '<line role="cases" id="12">' +
5307       '<children>' +
5308       '<punctuated role="sequence" id="10">' +
5309       '<content>' +
5310       '<punctuation role="unknown" id="8">,</punctuation>' +
5311       '</content>' +
5312       '<children>' +
5313       '<identifier role="latinletter" font="normal" id="7">b</identifier>' +
5314       '<punctuation role="unknown" id="8">,</punctuation>' +
5315       '<text role="unknown" id="9">sometimes</text>' +
5316       '</children>' +
5317       '</punctuated>' +
5318       '</children>' +
5319       '</line>' +
5320       '</children>' +
5321       '</cases>' +
5322       '<punctuation role="unknown" id="14">,</punctuation>' +
5323       '<identifier role="latinletter" font="normal" id="15">b</identifier>' +
5324       '<punctuation role="unknown" id="16">,</punctuation>' +
5325       '<identifier role="latinletter" font="normal" id="17">c</identifier>' +
5326       '<punctuation role="fullstop" id="18">.</punctuation>' +
5327       '</children>' +
5328       '</punctuated>');
5329
5330   this.executeTreeTest(
5331       '<mtable><mtr><mtd><mi>x</mi><maligngroup/><mo>=</mo><mn>4</mn>' +
5332       '</mtd></mtr><mtr><mtd><mi>y</mi><maligngroup/><mo>=</mo><mn>2</mn>' +
5333       '</mtd></mtr><mtr><mtd><mi>x</mi><mi>y</mi><maligngroup/><mo>=</mo>' +
5334       '<mn>6</mn></mtd></mtr></mtable>',
5335       '<multiline role="unknown" id="21">' +
5336       '<children>' +
5337       '<line role="multiline" id="5">' +
5338       '<children>' +
5339       '<relseq role="equality" id="3">=' +
5340       '<content>' +
5341       '<relation role="equality" id="1">=</relation>' +
5342       '</content>' +
5343       '<children>' +
5344       '<identifier role="latinletter" font="normal" id="0">x</identifier>' +
5345       '<number role="integer" font="normal" id="2">4</number>' +
5346       '</children>' +
5347       '</relseq>' +
5348       '</children>' +
5349       '</line>' +
5350       '<line role="multiline" id="11">' +
5351       '<children>' +
5352       '<relseq role="equality" id="9">=' +
5353       '<content>' +
5354       '<relation role="equality" id="7">=</relation>' +
5355       '</content>' +
5356       '<children>' +
5357       '<identifier role="latinletter" font="normal" id="6">y</identifier>' +
5358       '<number role="integer" font="normal" id="8">2</number>' +
5359       '</children>' +
5360       '</relseq>' +
5361       '</children>' +
5362       '</line>' +
5363       '<line role="multiline" id="20">' +
5364       '<children>' +
5365       '<relseq role="equality" id="18">=' +
5366       '<content>' +
5367       '<relation role="equality" id="14">=</relation>' +
5368       '</content>' +
5369       '<children>' +
5370       '<infixop role="implicit" id="17">\u2062' +
5371       '<content>' +
5372       '<operator role="multiplication" id="16">\u2062</operator>' +
5373       '</content>' +
5374       '<children>' +
5375       '<identifier role="latinletter" font="normal" id="12">x</identifier>' +
5376       '<identifier role="latinletter" font="normal" id="13">y</identifier>' +
5377       '</children>' +
5378       '</infixop>' +
5379       '<number role="integer" font="normal" id="15">6</number>' +
5380       '</children>' +
5381       '</relseq>' +
5382       '</children>' +
5383       '</line>' +
5384       '</children>' +
5385       '</multiline>');
5386
5387   this.executeTreeTest(
5388       '<mtable><mtr><mtd><mi>x</mi></mtd><mtd><mo>=</mo></mtd><mtd><mn>4</mn>' +
5389       '</mtd></mtr><mtr><mtd><mi>y</mi></mtd><mtd><mo>=</mo></mtd><mtd>' +
5390       '<mn>2</mn></mtd></mtr><mtr><mtd><mi>x</mi><mi>y</mi></mtd><mtd>' +
5391       '<mo>=</mo></mtd><mtd><mn>6</mn></mtd></mtr></mtable>',
5392       '<table role="unknown" id="24">' +
5393       '<children>' +
5394       '<row role="table" id="6">' +
5395       '<children>' +
5396       '<cell role="table" id="1">' +
5397       '<children>' +
5398       '<identifier role="latinletter" font="normal" id="0">x</identifier>' +
5399       '</children>' +
5400       '</cell>' +
5401       '<cell role="table" id="3">' +
5402       '<children>' +
5403       '<relation role="equality" id="2">=</relation>' +
5404       '</children>' +
5405       '</cell>' +
5406       '<cell role="table" id="5">' +
5407       '<children>' +
5408       '<number role="integer" font="normal" id="4">4</number>' +
5409       '</children>' +
5410       '</cell>' +
5411       '</children>' +
5412       '</row>' +
5413       '<row role="table" id="13">' +
5414       '<children>' +
5415       '<cell role="table" id="8">' +
5416       '<children>' +
5417       '<identifier role="latinletter" font="normal" id="7">y</identifier>' +
5418       '</children>' +
5419       '</cell>' +
5420       '<cell role="table" id="10">' +
5421       '<children>' +
5422       '<relation role="equality" id="9">=</relation>' +
5423       '</children>' +
5424       '</cell>' +
5425       '<cell role="table" id="12">' +
5426       '<children>' +
5427       '<number role="integer" font="normal" id="11">2</number>' +
5428       '</children>' +
5429       '</cell>' +
5430       '</children>' +
5431       '</row>' +
5432       '<row role="table" id="23">' +
5433       '<children>' +
5434       '<cell role="table" id="18">' +
5435       '<children>' +
5436       '<infixop role="implicit" id="17">\u2062' +
5437       '<content>' +
5438       '<operator role="multiplication" id="16">\u2062</operator>' +
5439       '</content>' +
5440       '<children>' +
5441       '<identifier role="latinletter" font="normal" id="14">x</identifier>' +
5442       '<identifier role="latinletter" font="normal" id="15">y</identifier>' +
5443       '</children>' +
5444       '</infixop>' +
5445       '</children>' +
5446       '</cell>' +
5447       '<cell role="table" id="20">' +
5448       '<children>' +
5449       '<relation role="equality" id="19">=</relation>' +
5450       '</children>' +
5451       '</cell>' +
5452       '<cell role="table" id="22">' +
5453       '<children>' +
5454       '<number role="integer" font="normal" id="21">6</number>' +
5455       '</children>' +
5456       '</cell>' +
5457       '</children>' +
5458       '</row>' +
5459       '</children>' +
5460       '</table>');
5461 });
5462
5463
5464 TEST_F('CvoxSemanticTreeUnitTest', 'StreeLimitFunctions', function() {
5465   this.brief = true;
5466   this.executeTreeTest(
5467     '<mrow><munder><mi>lim</mi><mrow><mi>x</mi><mo>\u2192</mo>' +
5468     '<mi>\u221E</mi></mrow></munder><mo>(</mo><mi>x</mi><mo>)</mo></mrow>',
5469     '<appl>' +
5470     '<content>' +
5471     '<punctuation>\u2061</punctuation>' +
5472     '</content>' +
5473     '<children>' +
5474     '<limlower>' +
5475     '<children>' +
5476     '<function>lim</function>' +
5477     '<relseq>\u2192' +
5478     '<content>' +
5479     '<relation>\u2192</relation>' +
5480     '</content>' +
5481     '<children>' +
5482     '<identifier>x</identifier>' +
5483     '<identifier>\u221E</identifier>' +
5484     '</children>' +
5485     '</relseq>' +
5486     '</children>' +
5487     '</limlower>' +
5488     '<fenced>' +
5489     '<content>' +
5490     '<fence>(</fence>' +
5491     '<fence>)</fence>' +
5492     '</content>' +
5493     '<children>' +
5494     '<identifier>x</identifier>' +
5495     '</children>' +
5496     '</fenced>' +
5497     '</children>' +
5498     '</appl>');
5499
5500   this.executeTreeTest(
5501     '<mrow><mi>a</mi><mo>+</mo><munder><mi>lim</mi><mrow><mi>x</mi>' +
5502     '<mo>\u2192</mo><mi>\u221E</mi></mrow></munder><mo>(</mo><mi>x</mi>' +
5503     '<mo>)</mo><mo>+</mo><mi>b</mi></mrow>',
5504     '<infixop>+' +
5505     '<content>' +
5506     '<operator>+</operator>' +
5507     '<operator>+</operator>' +
5508     '</content>' +
5509     '<children>' +
5510     '<identifier>a</identifier>' +
5511     '<appl>' +
5512     '<content>' +
5513     '<punctuation>\u2061</punctuation>' +
5514     '</content>' +
5515     '<children>' +
5516     '<limlower>' +
5517     '<children>' +
5518     '<function>lim</function>' +
5519     '<relseq>\u2192' +
5520     '<content>' +
5521     '<relation>\u2192</relation>' +
5522     '</content>' +
5523     '<children>' +
5524     '<identifier>x</identifier>' +
5525     '<identifier>\u221E</identifier>' +
5526     '</children>' +
5527     '</relseq>' +
5528     '</children>' +
5529     '</limlower>' +
5530     '<fenced>' +
5531     '<content>' +
5532     '<fence>(</fence>' +
5533     '<fence>)</fence>' +
5534     '</content>' +
5535     '<children>' +
5536     '<identifier>x</identifier>' +
5537     '</children>' +
5538     '</fenced>' +
5539     '</children>' +
5540     '</appl>' +
5541     '<identifier>b</identifier>' +
5542     '</children>' +
5543     '</infixop>');
5544
5545   this.executeTreeTest(
5546     '<mrow><msup><munder><mi>lim</mi><mrow><mi>x</mi><mo>\u2192</mo>' +
5547     '<mi>\u221E</mi></mrow></munder><mo>+</mo></msup><mo>(</mo><mi>x</mi>' +
5548     '<mo>)</mo></mrow>',
5549     '<appl>' +
5550     '<content>' +
5551     '<punctuation>\u2061</punctuation>' +
5552     '</content>' +
5553     '<children>' +
5554     '<limupper>' +
5555     '<children>' +
5556     '<limlower>' +
5557     '<children>' +
5558     '<function>lim</function>' +
5559     '<relseq>\u2192' +
5560     '<content>' +
5561     '<relation>\u2192</relation>' +
5562     '</content>' +
5563     '<children>' +
5564     '<identifier>x</identifier>' +
5565     '<identifier>\u221E</identifier>' +
5566     '</children>' +
5567     '</relseq>' +
5568     '</children>' +
5569     '</limlower>' +
5570     '<operator>+</operator>' +
5571     '</children>' +
5572     '</limupper>' +
5573     '<fenced>' +
5574     '<content>' +
5575     '<fence>(</fence>' +
5576     '<fence>)</fence>' +
5577     '</content>' +
5578     '<children>' +
5579     '<identifier>x</identifier>' +
5580     '</children>' +
5581     '</fenced>' +
5582     '</children>' +
5583     '</appl>');
5584
5585   this.executeTreeTest(
5586     '<mrow><munderover><mi>lim</mi><mo>\u2015</mo><mrow><mi>x</mi>' +
5587     '<mo>\u2192</mo><mi>\u221E</mi></mrow></munderover><mo>(</mo>' +
5588     '<mi>x</mi><mo>)</mo></mrow>',
5589     '<appl>' +
5590     '<content>' +
5591     '<punctuation>\u2061</punctuation>' +
5592     '</content>' +
5593     '<children>' +
5594     '<limboth>' +
5595     '<children>' +
5596     '<function>lim</function>' +
5597     '<punctuation>\u2015</punctuation>' +
5598     '<relseq>\u2192' +
5599     '<content>' +
5600     '<relation>\u2192</relation>' +
5601     '</content>' +
5602     '<children>' +
5603     '<identifier>x</identifier>' +
5604     '<identifier>\u221E</identifier>' +
5605     '</children>' +
5606     '</relseq>' +
5607     '</children>' +
5608     '</limboth>' +
5609     '<fenced>' +
5610     '<content>' +
5611     '<fence>(</fence>' +
5612     '<fence>)</fence>' +
5613     '</content>' +
5614     '<children>' +
5615     '<identifier>x</identifier>' +
5616     '</children>' +
5617     '</fenced>' +
5618     '</children>' +
5619     '</appl>');
5620
5621   this.executeTreeTest(
5622     '<mrow><munder><mi>liminf</mi><mrow><mi>x</mi><mo>\u2192</mo>' +
5623     '<mi>\u221E</mi></mrow></munder><mo>(</mo><mi>x</mi><mo>)</mo>' +
5624     '<mo>+</mo><munder><mi>limsup</mi><mrow><mi>y</mi><mo>\u2192</mo>' +
5625     '<mi>\u221E</mi></mrow></munder><mo>(</mo><mi>y</mi><mo>)</mo></mrow>',
5626     '<infixop>+' +
5627     '<content>' +
5628     '<operator>+</operator>' +
5629     '</content>' +
5630     '<children>' +
5631     '<appl>' +
5632     '<content>' +
5633     '<punctuation>\u2061</punctuation>' +
5634     '</content>' +
5635     '<children>' +
5636     '<limlower>' +
5637     '<children>' +
5638     '<function>liminf</function>' +
5639     '<relseq>\u2192' +
5640     '<content>' +
5641     '<relation>\u2192</relation>' +
5642     '</content>' +
5643     '<children>' +
5644     '<identifier>x</identifier>' +
5645     '<identifier>\u221E</identifier>' +
5646     '</children>' +
5647     '</relseq>' +
5648     '</children>' +
5649     '</limlower>' +
5650     '<fenced>' +
5651     '<content>' +
5652     '<fence>(</fence>' +
5653     '<fence>)</fence>' +
5654     '</content>' +
5655     '<children>' +
5656     '<identifier>x</identifier>' +
5657     '</children>' +
5658     '</fenced>' +
5659     '</children>' +
5660     '</appl>' +
5661     '<appl>' +
5662     '<content>' +
5663     '<punctuation>\u2061</punctuation>' +
5664     '</content>' +
5665     '<children>' +
5666     '<limlower>' +
5667     '<children>' +
5668     '<function>limsup</function>' +
5669     '<relseq>\u2192' +
5670     '<content>' +
5671     '<relation>\u2192</relation>' +
5672     '</content>' +
5673     '<children>' +
5674     '<identifier>y</identifier>' +
5675     '<identifier>\u221E</identifier>' +
5676     '</children>' +
5677     '</relseq>' +
5678     '</children>' +
5679     '</limlower>' +
5680     '<fenced>' +
5681     '<content>' +
5682     '<fence>(</fence>' +
5683     '<fence>)</fence>' +
5684     '</content>' +
5685     '<children>' +
5686     '<identifier>y</identifier>' +
5687     '</children>' +
5688     '</fenced>' +
5689     '</children>' +
5690     '</appl>' +
5691     '</children>' +
5692     '</infixop>');
5693
5694   this.executeTreeTest(
5695     '<mrow><mi>a</mi><mo>+</mo><munder><mi>lim</mi><mrow><mi>x</mi>' +
5696     '<mo>\u2192</mo><mi>\u221E</mi></mrow></munder><mi>x</mi><mo>+</mo>' +
5697     '<mi>b</mi></mrow>',
5698     '<infixop>+' +
5699     '<content>' +
5700     '<operator>+</operator>' +
5701     '<operator>+</operator>' +
5702     '</content>' +
5703     '<children>' +
5704     '<identifier>a</identifier>' +
5705     '<appl>' +
5706     '<content>' +
5707     '<punctuation>\u2061</punctuation>' +
5708     '</content>' +
5709     '<children>' +
5710     '<limlower>' +
5711     '<children>' +
5712     '<function>lim</function>' +
5713     '<relseq>\u2192' +
5714     '<content>' +
5715     '<relation>\u2192</relation>' +
5716     '</content>' +
5717     '<children>' +
5718     '<identifier>x</identifier>' +
5719     '<identifier>\u221E</identifier>' +
5720     '</children>' +
5721     '</relseq>' +
5722     '</children>' +
5723     '</limlower>' +
5724     '<identifier>x</identifier>' +
5725     '</children>' +
5726     '</appl>' +
5727     '<identifier>b</identifier>' +
5728     '</children>' +
5729     '</infixop>');
5730
5731   this.executeTreeTest(
5732     '<mrow><munder><mi>lim</mi><mrow><mi>x</mi><mo>\u2192</mo><mi>\u221E</mi>' +
5733     '</mrow></munder><mi>lim</mi><munder><mrow><mi>y</mi><mo>\u2192</mo>' +
5734     '<mi>\u221E</mi></mrow></munder><mi>x</mi><mi>y</mi></mrow>',
5735     '<appl>' +
5736     '<content>' +
5737     '<punctuation>\u2061</punctuation>' +
5738     '</content>' +
5739     '<children>' +
5740     '<limlower>' +
5741     '<children>' +
5742     '<function>lim</function>' +
5743     '<relseq>\u2192' +
5744     '<content>' +
5745     '<relation>\u2192</relation>' +
5746     '</content>' +
5747     '<children>' +
5748     '<identifier>x</identifier>' +
5749     '<identifier>\u221E</identifier>' +
5750     '</children>' +
5751     '</relseq>' +
5752     '</children>' +
5753     '</limlower>' +
5754     '<appl>' +
5755     '<content>' +
5756     '<punctuation>\u2061</punctuation>' +
5757     '</content>' +
5758     '<children>' +
5759     '<function>lim</function>' +
5760     '<infixop>\u2062' +
5761     '<content>' +
5762     '<operator>\u2062</operator>' +
5763     '</content>' +
5764     '<children>' +
5765     '<underscore>' +
5766     '<children>' +
5767     '<relseq>\u2192' +
5768     '<content>' +
5769     '<relation>\u2192</relation>' +
5770     '</content>' +
5771     '<children>' +
5772     '<identifier>y</identifier>' +
5773     '<identifier>\u221E</identifier>' +
5774     '</children>' +
5775     '</relseq>' +
5776     '</children>' +
5777     '</underscore>' +
5778     '<identifier>x</identifier>' +
5779     '<identifier>y</identifier>' +
5780     '</children>' +
5781     '</infixop>' +
5782     '</children>' +
5783     '</appl>' +
5784     '</children>' +
5785     '</appl>');
5786
5787   this.executeTreeTest(
5788     '<mi>liminf</mi>',
5789     '<function>liminf</function>');
5790
5791   this.executeTreeTest(
5792     '<munder><mi>lim</mi><mrow><mi>x</mi><mo>\u2192</mo><mi>\u221E</mi>' +
5793     '</mrow></munder>',
5794     '<limlower>' +
5795     '<children>' +
5796     '<function>lim</function>' +
5797     '<relseq>\u2192' +
5798     '<content>' +
5799     '<relation>\u2192</relation>' +
5800     '</content>' +
5801     '<children>' +
5802     '<identifier>x</identifier>' +
5803     '<identifier>\u221E</identifier>' +
5804     '</children>' +
5805     '</relseq>' +
5806     '</children>' +
5807     '</limlower>');
5808
5809   this.executeTreeTest(
5810     '<mi>liminf</mi><mo>+</mo><mi>limsup</mi><mo>=</mo><mi>lim</mi>',
5811     '<relseq>=' +
5812     '<content>' +
5813     '<relation>=</relation>' +
5814     '</content>' +
5815     '<children>' +
5816     '<infixop>+' +
5817     '<content>' +
5818     '<operator>+</operator>' +
5819     '</content>' +
5820     '<children>' +
5821     '<appl>' +
5822     '<content>' +
5823     '<punctuation>\u2061</punctuation>' +
5824     '</content>' +
5825     '<children>' +
5826     '<function>liminf</function>' +
5827     '<empty/>' +
5828     '</children>' +
5829     '</appl>' +
5830     '<appl>' +
5831     '<content>' +
5832     '<punctuation>\u2061</punctuation>' +
5833     '</content>' +
5834     '<children>' +
5835     '<function>limsup</function>' +
5836     '<empty/>' +
5837     '</children>' +
5838     '</appl>' +
5839     '</children>' +
5840     '</infixop>' +
5841     '<appl>' +
5842     '<content>' +
5843     '<punctuation>\u2061</punctuation>' +
5844     '</content>' +
5845     '<children>' +
5846     '<function>lim</function>' +
5847     '<empty/>' +
5848     '</children>' +
5849     '</appl>' +
5850     '</children>' +
5851     '</relseq>');
5852 });
5853
5854
5855 /**
5856  * Variations of big operators.
5857  */
5858 TEST_F('CvoxSemanticTreeUnitTest', 'StreeBigOps', function() {
5859   this.brief = true;
5860   this.executeTreeTest(
5861     '<mrow><munderover><mi>\u2211</mi><mrow><mi>n</mi><mo>=</mo><mn>0</mn>' +
5862     '</mrow><mi>\u221E</mi></munderover><msup><mi>n</mi><mn>2</mn>' +
5863     '</msup></mrow>',
5864     '<bigop>' +
5865     '<children>' +
5866     '<limboth>' +
5867     '<children>' +
5868     '<largeop>\u2211</largeop>' +
5869     '<relseq>=' +
5870     '<content>' +
5871     '<relation>=</relation>' +
5872     '</content>' +
5873     '<children>' +
5874     '<identifier>n</identifier>' +
5875     '<number>0</number>' +
5876     '</children>' +
5877     '</relseq>' +
5878     '<identifier>\u221E</identifier>' +
5879     '</children>' +
5880     '</limboth>' +
5881     '<superscript>' +
5882     '<children>' +
5883     '<identifier>n</identifier>' +
5884     '<number>2</number>' +
5885     '</children>' +
5886     '</superscript>' +
5887     '</children>' +
5888     '</bigop>');
5889
5890   this.executeTreeTest(
5891     '<mrow><munderover><mi>\u2211</mi><mrow><mi>n</mi><mo>=</mo><mn>0</mn>' +
5892     '</mrow><mi>\u221E</mi></munderover><munderover><mi>\u2211</mi><mrow>' +
5893     '<mi>m</mi><mo>=</mo><mn>0</mn></mrow><mi>\u221E</mi></munderover><msup>' +
5894     '<mi>n</mi><mn>m</mn></msup></mrow>',
5895     '<bigop>' +
5896     '<children>' +
5897     '<limboth>' +
5898     '<children>' +
5899     '<largeop>\u2211</largeop>' +
5900     '<relseq>=' +
5901     '<content>' +
5902     '<relation>=</relation>' +
5903     '</content>' +
5904     '<children>' +
5905     '<identifier>n</identifier>' +
5906     '<number>0</number>' +
5907     '</children>' +
5908     '</relseq>' +
5909     '<identifier>\u221E</identifier>' +
5910     '</children>' +
5911     '</limboth>' +
5912     '<bigop>' +
5913     '<children>' +
5914     '<limboth>' +
5915     '<children>' +
5916     '<largeop>\u2211</largeop>' +
5917     '<relseq>=' +
5918     '<content>' +
5919     '<relation>=</relation>' +
5920     '</content>' +
5921     '<children>' +
5922     '<identifier>m</identifier>' +
5923     '<number>0</number>' +
5924     '</children>' +
5925     '</relseq>' +
5926     '<identifier>\u221E</identifier>' +
5927     '</children>' +
5928     '</limboth>' +
5929     '<superscript>' +
5930     '<children>' +
5931     '<identifier>n</identifier>' +
5932     '<identifier>m</identifier>' +
5933     '</children>' +
5934     '</superscript>' +
5935     '</children>' +
5936     '</bigop>' +
5937     '</children>' +
5938     '</bigop>');
5939
5940   this.executeTreeTest(
5941     '<mrow><munder><mi>\u2211</mi><mrow><mi>n</mi><mo>=</mo><mn>0</mn></mrow>' +
5942     '</munder><msup><mi>n</mi><mn>2</mn></msup></mrow>',
5943     '<bigop>' +
5944     '<children>' +
5945     '<limlower>' +
5946     '<children>' +
5947     '<largeop>\u2211</largeop>' +
5948     '<relseq>=' +
5949     '<content>' +
5950     '<relation>=</relation>' +
5951     '</content>' +
5952     '<children>' +
5953     '<identifier>n</identifier>' +
5954     '<number>0</number>' +
5955     '</children>' +
5956     '</relseq>' +
5957     '</children>' +
5958     '</limlower>' +
5959     '<superscript>' +
5960     '<children>' +
5961     '<identifier>n</identifier>' +
5962     '<number>2</number>' +
5963     '</children>' +
5964     '</superscript>' +
5965     '</children>' +
5966     '</bigop>');
5967 });
5968
5969
5970
5971 /**
5972  * Variations of integrals.
5973  */
5974 TEST_F('CvoxSemanticTreeUnitTest', 'StreeIntegrals', function() {
5975   this.brief = true;
5976   this.executeTreeTest(
5977     '<mi>\u222B</mi>',
5978     '<largeop>\u222B</largeop>');
5979
5980   this.executeTreeTest(
5981     '<mi>\u222B</mi><mi>dx</mi>',
5982     '<integral>' +
5983     '<children>' +
5984     '<largeop>\u222B</largeop>' +
5985     '<empty/>' +
5986     '<identifier>dx</identifier>' +
5987     '</children>' +
5988     '</integral>');
5989
5990   this.executeTreeTest(
5991     '<mrow><mi>\u222B</mi><mi>x</mi><mi>dx</mi></mrow>',
5992     '<integral>' +
5993     '<children>' +
5994     '<largeop>\u222B</largeop>' +
5995     '<identifier>x</identifier>' +
5996     '<identifier>dx</identifier>' +
5997     '</children>' +
5998     '</integral>');
5999
6000   this.executeTreeTest(
6001     '<mrow><mi>\u222B</mi><mi>x</mi><mi>d</mi><mi>x</mi></mrow>',
6002     '<integral>' +
6003     '<children>' +
6004     '<largeop>\u222B</largeop>' +
6005     '<identifier>x</identifier>' +
6006     '<punctuated>' +
6007     '<content>' +
6008     '<punctuation>\u2063</punctuation>' +
6009     '</content>' +
6010     '<children>' +
6011     '<identifier>d</identifier>' +
6012     '<punctuation>\u2063</punctuation>' +
6013     '<identifier>x</identifier>' +
6014     '</children>' +
6015     '</punctuated>' +
6016     '</children>' +
6017     '</integral>');
6018
6019   this.executeTreeTest(
6020     '<mrow><mi>\u222B</mi><mi>x</mi><mo>+' +
6021         '</mo><mi>y</mi><mi>d</mi><mi>x</mi></mrow>',
6022     '<integral>' +
6023     '<children>' +
6024     '<largeop>\u222B</largeop>' +
6025     '<infixop>+' +
6026     '<content>' +
6027     '<operator>+</operator>' +
6028     '</content>' +
6029     '<children>' +
6030     '<identifier>x</identifier>' +
6031     '<identifier>y</identifier>' +
6032     '</children>' +
6033     '</infixop>' +
6034     '<punctuated>' +
6035     '<content>' +
6036     '<punctuation>\u2063</punctuation>' +
6037     '</content>' +
6038     '<children>' +
6039     '<identifier>d</identifier>' +
6040     '<punctuation>\u2063</punctuation>' +
6041     '<identifier>x</identifier>' +
6042     '</children>' +
6043     '</punctuated>' +
6044     '</children>' +
6045     '</integral>');
6046
6047   this.executeTreeTest(
6048     '<munderover><mi>\u222B</mi><mn>0</mn><mn>10</mn></munderover>',
6049     '<limboth>' +
6050     '<children>' +
6051     '<largeop>\u222B</largeop>' +
6052     '<number>0</number>' +
6053     '<number>10</number>' +
6054     '</children>' +
6055     '</limboth>');
6056
6057   this.executeTreeTest(
6058     '<munder><mi>\u222B</mi><mn>X</mn></munder>',
6059     '<limlower>' +
6060     '<children>' +
6061     '<largeop>\u222B</largeop>' +
6062     '<identifier>X</identifier>' +
6063     '</children>' +
6064     '</limlower>');
6065
6066   this.executeTreeTest(
6067     '<munderover><mi>\u222B</mi><mn>0</mn><mn>10</mn></munderover><mi>x</mi>' +
6068     '<mi>d</mi><mi>x</mi>',
6069     '<integral>' +
6070     '<children>' +
6071     '<limboth>' +
6072     '<children>' +
6073     '<largeop>\u222B</largeop>' +
6074     '<number>0</number>' +
6075     '<number>10</number>' +
6076     '</children>' +
6077     '</limboth>' +
6078     '<identifier>x</identifier>' +
6079     '<punctuated>' +
6080     '<content>' +
6081     '<punctuation>\u2063</punctuation>' +
6082     '</content>' +
6083     '<children>' +
6084     '<identifier>d</identifier>' +
6085     '<punctuation>\u2063</punctuation>' +
6086     '<identifier>x</identifier>' +
6087     '</children>' +
6088     '</punctuated>' +
6089     '</children>' +
6090     '</integral>');
6091
6092   this.executeTreeTest(
6093     '<munder><mi>\u222B</mi><mn>X</mn></munder><mi>x</mi><mi>dx</mi>',
6094     '<integral>' +
6095     '<children>' +
6096     '<limlower>' +
6097     '<children>' +
6098     '<largeop>\u222B</largeop>' +
6099     '<identifier>X</identifier>' +
6100     '</children>' +
6101     '</limlower>' +
6102     '<identifier>x</identifier>' +
6103     '<identifier>dx</identifier>' +
6104     '</children>' +
6105     '</integral>');
6106
6107   this.executeTreeTest(
6108     '<munderover><mi>\u222B</mi><mn>0</mn><mn>10</mn></munderover><mi>x</mi>' +
6109     '<mi>dx</mi><mo>+</mo><munderover><mi>\u222B</mi><mn>10</mn><mn>20</mn>' +
6110     '</munderover><mi>x</mi><mi>dx</mi><mo>=</mo><munderover><mi>\u222B</mi>' +
6111     '<mn>0</mn><mn>20</mn></munderover><mi>x</mi><mi>dx</mi>',
6112     '<relseq>=' +
6113     '<content>' +
6114     '<relation>=</relation>' +
6115     '</content>' +
6116     '<children>' +
6117     '<infixop>+' +
6118     '<content>' +
6119     '<operator>+</operator>' +
6120     '</content>' +
6121     '<children>' +
6122     '<integral>' +
6123     '<children>' +
6124     '<limboth>' +
6125     '<children>' +
6126     '<largeop>\u222B</largeop>' +
6127     '<number>0</number>' +
6128     '<number>10</number>' +
6129     '</children>' +
6130     '</limboth>' +
6131     '<identifier>x</identifier>' +
6132     '<identifier>dx</identifier>' +
6133     '</children>' +
6134     '</integral>' +
6135     '<integral>' +
6136     '<children>' +
6137     '<limboth>' +
6138     '<children>' +
6139     '<largeop>\u222B</largeop>' +
6140     '<number>10</number>' +
6141     '<number>20</number>' +
6142     '</children>' +
6143     '</limboth>' +
6144     '<identifier>x</identifier>' +
6145     '<identifier>dx</identifier>' +
6146     '</children>' +
6147     '</integral>' +
6148     '</children>' +
6149     '</infixop>' +
6150     '<integral>' +
6151     '<children>' +
6152     '<limboth>' +
6153     '<children>' +
6154     '<largeop>\u222B</largeop>' +
6155     '<number>0</number>' +
6156     '<number>20</number>' +
6157     '</children>' +
6158     '</limboth>' +
6159     '<identifier>x</identifier>' +
6160     '<identifier>dx</identifier>' +
6161     '</children>' +
6162     '</integral>' +
6163     '</children>' +
6164     '</relseq>');
6165
6166   this.executeTreeTest(
6167     '<mi>\u222B</mi><mi>\u222B</mi><mi>\u222B</mi>' +
6168         '<mi>dx</mi><mi>dy</mi><mi>dz</mi>',
6169     '<integral>' +
6170     '<children>' +
6171     '<largeop>\u222B</largeop>' +
6172     '<integral>' +
6173     '<children>' +
6174     '<largeop>\u222B</largeop>' +
6175     '<integral>' +
6176     '<children>' +
6177     '<largeop>\u222B</largeop>' +
6178     '<empty/>' +
6179     '<identifier>dx</identifier>' +
6180     '</children>' +
6181     '</integral>' +
6182     '<identifier>dy</identifier>' +
6183     '</children>' +
6184     '</integral>' +
6185     '<identifier>dz</identifier>' +
6186     '</children>' +
6187     '</integral>');
6188 });