How to use children method in Cypress

Best JavaScript code snippet using cypress

Run Cypress automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

math_semantic_tree_test.js

Source: math_semantic_tree_test.js Github

copy
1// Copyright 2013 Google Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15/**
16 * @fileoverview Testcases for the semantic tree.
17 * @author sorge@google.com (Volker Sorge)
18 */
19
20goog.provide('cvox.SemanticTreeTest');
21
22goog.require('cvox.AbstractTestCase');
23goog.require('cvox.ChromeVoxTester');
24goog.require('cvox.SemanticAttr');
25goog.require('cvox.SemanticTree');
26goog.require('cvox.SemanticUtil');
27goog.require('cvox.XpathUtil');
28
29
30/**
31 * @constructor
32 * @extends {cvox.AbstractTestCase}
33 */
34cvox.SemanticTreeTest = function() {
35  goog.base(this);
36};
37goog.inherits(cvox.SemanticTreeTest, cvox.AbstractTestCase);
38
39
40/**
41 * @override
42 */
43cvox.SemanticTreeTest.prototype.setUpTest = function() {
44  this.nodeCounter = 0;
45  this.xpathBlacklist = [];
46  this.brief = true;
47  cvox.SemanticTreeTest.setupAttributes();
48};
49
50
51/**
52 * Adds some unicode characters via hex code to the right category.
53 *
54 * This method is necessary as the test framework can not handle code containing
55 * utf-8 encoded characters.
56 */
57cvox.SemanticTreeTest.setupAttributes = function() {
58  var attr = cvox.SemanticAttr.getInstance();
59  attr.neutralFences.unshift(cvox.SemanticUtil.numberToUnicode(0x00A6));
60  attr.dashes.unshift(cvox.SemanticUtil.numberToUnicode(0x2015));
61  attr.neutralFences.unshift(cvox.SemanticUtil.numberToUnicode(0x2016));
62  attr.arrows.unshift(cvox.SemanticUtil.numberToUnicode(0x2192));
63  attr.sumOps.unshift(cvox.SemanticUtil.numberToUnicode(0x2211));
64  attr.additions.unshift(cvox.SemanticUtil.numberToUnicode(0x2213));
65  attr.multiplications.unshift(cvox.SemanticUtil.numberToUnicode(0x2218));
66  attr.intOps.unshift(cvox.SemanticUtil.numberToUnicode(0x222B));
67  attr.inequalities.unshift(cvox.SemanticUtil.numberToUnicode(0x2264));
68  attr.additions.unshift(cvox.SemanticUtil.numberToUnicode(0x2295));
69  var open = cvox.SemanticUtil.numberToUnicode(0x3008);
70  var close = cvox.SemanticUtil.numberToUnicode(0x3009);
71  attr.openClosePairs[open] = close;
72  attr.leftFences.unshift(open);
73  attr.rightFences.unshift(close);
74};
75
76
77/**
78 * Removes XML nodes according to the XPath elements in the blacklist.
79 * @param {Node} xml Xml representation of the semantic node.
80 */
81cvox.SemanticTreeTest.prototype.customizeXml = function(xml) {
82  this.xpathBlacklist.forEach(
83      function(xpath) {
84        var removes = cvox.XpathUtil.evalXPath(xpath, xml);
85        removes.forEach(
86            function(node) {
87              node.parentNode.removeChild(node);
88            });
89      });
90};
91
92
93/**
94 * Tests if for a given mathml snippet results in a particular semantic tree.
95 * @param {string} mml MathML expression.
96 * @param {string} sml XML snippet for the semantic tree.
97 */
98cvox.SemanticTreeTest.prototype.executeTreeTest = function(mml, sml) {
99  var mathMl = '<math id=' + this.nodeCounter + '>' + mml + '';
100  this.appendHtml(mathMl);
101  var node = document.getElementById((this.nodeCounter++).toString());
102  var stree = new cvox.SemanticTree(/** @type {!Element} */(node));
103  var sxml = stree.xml(this.brief);
104  this.customizeXml(sxml);
105  var dp = new DOMParser();
106  var xml = dp.parseFromString('<stree>' + sml + '</stree>', 'text/xml');
107  var xmls = new XMLSerializer();
108  this.assertEquals(xmls.serializeToString(xml), xmls.serializeToString(sxml));
109};
110
111
112// Relations.
113/**
114 * Test relation trees.
115 */
116cvox.SemanticTreeTest.prototype.testStreeRelations = function() {
117  this.brief = true;
118  this.executeTreeTest(
119      '<mo>=</mo>',
120      '<relation>=</relation>');
121  this.executeTreeTest(
122      '<mi>a</mi><mo>=</mo><mi>b</mi>',
123      '<relseq>=' +
124          '<content><relation>=</relation></content>' +
125          '<children>' +
126          '<identifier>a</identifier>' +
127          '<identifier>b</identifier>' +
128          '</children>' +
129          '</relseq>');
130  this.executeTreeTest(
131      '<mi>a</mi><mo>=</mo><mi>b</mi><mo>=</mo><mi>c</mi>',
132      '<relseq>=' +
133          '<content><relation>=</relation><relation>=</relation></content>' +
134          '<children>' +
135          '<identifier>a</identifier>' +
136          '<identifier>b</identifier>' +
137          '<identifier>c</identifier>' +
138          '</children>' +
139          '</relseq>');
140  this.executeTreeTest(
141      '<mi>a</mi><mo>=</mo><mi>b</mi><mo>=</mo><mi>c</mi>' +
142          '<mo>\u2264</mo><mi>d</mi>',
143      '<multirel>' +
144          '<content><relation>=</relation><relation>=</relation>' +
145          '<relation>\u2264</relation></content>' +
146          '<children>' +
147          '<identifier>a</identifier>' +
148          '<identifier>b</identifier>' +
149          '<identifier>c</identifier>' +
150          '<identifier>d</identifier>' +
151          '</children>' +
152          '</multirel>');
153};
154
155
156// Operators.
157/**
158 * Test operator trees with pre- and postfixes.
159 */
160cvox.SemanticTreeTest.prototype.testStreePrePostfixOperators = function() {
161  this.brief = true;
162  // Pathological operator only case.
163  this.executeTreeTest(
164      '<mo>+</mo><mo>-</mo><mo>+</mo>',
165      '<prefixop>+' +
166          '<content><operator>+</operator></content>' +
167          '<children>' +
168          '<prefixop>-' +
169          '<content><operator>-</operator></content>' +
170          '<children>' +
171          '<operator>+</operator>' +
172          '</children>' +
173          '</prefixop>' +
174          '</children>' +
175          '</prefixop>');
176  // Single identifier with prefixes.
177  this.executeTreeTest(
178      '<mo>+</mo><mo>+</mo><mi>a</mi>',
179      '<prefixop>+ +' +
180          '<content><operator>+</operator><operator>+</operator></content>' +
181          '<children>' +
182          '<identifier>a</identifier>' +
183          '</children>' +
184          '</prefixop>');
185  // Single identifier with prefix and negative.
186  this.executeTreeTest(
187      '<mo>+</mo><mo>-</mo><mi>a</mi>',
188      '<prefixop>+' +
189          '<content><operator>+</operator></content>' +
190          '<children>' +
191          '<prefixop>-' +
192          '<content><operator>-</operator></content>' +
193          '<children>' +
194          '<identifier>a</identifier>' +
195          '</children>' +
196          '</prefixop>' +
197          '</children>' +
198          '</prefixop>');
199  // Single identifier with postfixes.
200  this.executeTreeTest(
201      '<mi>a</mi><mo>+</mo><mo>-</mo>',
202      '<postfixop>+ -' +
203          '<content><operator>+</operator><operator>-</operator></content>' +
204          '<children>' +
205          '<identifier>a</identifier>' +
206          '</children>' +
207          '</postfixop>');
208  // Single identifier with pre- and postfixes.
209  this.executeTreeTest(
210      '<mo>+</mo><mo>+</mo><mi>a</mi><mo>+</mo><mo>+</mo>',
211      '<postfixop>+ +' +
212          '<content><operator>+</operator><operator>+</operator></content>' +
213          '<children>' +
214          '<prefixop>+ +' +
215          '<content><operator>+</operator><operator>+</operator></content>' +
216          '<children>' +
217          '<identifier>a</identifier>' +
218          '</children>' +
219          '</prefixop>' +
220          '</children>' +
221          '</postfixop>');
222  // Single identifier with mixed pre- and postfixes.
223  this.executeTreeTest(
224      '<mo>\u2213</mo><mo>+</mo><mi>a</mi><mo>\u2213</mo><mo>+</mo>',
225      '<postfixop>\u2213 +' +
226          '<content>' +
227          '<operator>\u2213</operator><operator>+</operator>' +
228          '</content>' +
229          '<children>' +
230          '<prefixop>\u2213 +' +
231          '<content>' +
232          '<operator>\u2213</operator><operator>+</operator>' +
233          '</content>' +
234          '<children>' +
235          '<identifier>a</identifier>' +
236          '</children>' +
237          '</prefixop>' +
238          '</children>' +
239          '</postfixop>');
240  // Two identifiers with pre- and postfixes.
241  this.executeTreeTest(
242      '<mo>+</mo><mo>+</mo><mi>a</mi><mo>\u2213</mo><mo>+</mo>' +
243          '<mi>b</mi><mo>+</mo>',
244      '<infixop>\u2213' +
245          '<content><operator>\u2213</operator></content>' +
246          '<children>' +
247          '<prefixop>+ +' +
248          '<content><operator>+</operator><operator>+</operator></content>' +
249          '<children>' +
250          '<identifier>a</identifier>' +
251          '</children>' +
252          '</prefixop>' +
253          '<postfixop>+' +
254          '<content><operator>+</operator></content>' +
255          '<children>' +
256          '<prefixop>+' +
257          '<content><operator>+</operator></content>' +
258          '<children>' +
259          '<identifier>b</identifier>' +
260          '</children>' +
261          '</prefixop>' +
262          '</children>' +
263          '</postfixop>' +
264          '</children>' +
265          '</infixop>');
266  // Three identifiers with pre- and postfixes.
267  this.executeTreeTest(
268      '<mo>+</mo><mo>+</mo><mi>a</mi><mo>\u2213</mo><mo>+</mo>' +
269          '<mi>b</mi><mo>+</mo><mo>\u2213</mo><mi>c</mi><mo>+</mo>',
270      '<infixop>+' +
271          '<content><operator>+</operator></content>' +
272          '<children>' +
273          '<infixop>\u2213' +
274          '<content><operator>\u2213</operator></content>' +
275          '<children>' +
276          '<prefixop>+ +' +
277          '<content><operator>+</operator><operator>+</operator></content>' +
278          '<children>' +
279          '<identifier>a</identifier>' +
280          '</children>' +
281          '</prefixop>' +
282          '<prefixop>+' +
283          '<content><operator>+</operator></content>' +
284          '<children>' +
285          '<identifier>b</identifier>' +
286          '</children>' +
287          '</prefixop>' +
288          '</children>' +
289          '</infixop>' +
290          '<postfixop>+' +
291          '<content><operator>+</operator></content>' +
292          '<children>' +
293          '<prefixop>\u2213' +
294          '<content><operator>\u2213</operator></content>' +
295          '<children>' +
296          '<identifier>c</identifier>' +
297          '</children>' +
298          '</prefixop>' +
299          '</children>' +
300          '</postfixop>' +
301          '</children>' +
302          '</infixop>');
303};
304
305
306/**
307 * Test operator trees with single operator.
308 */
309cvox.SemanticTreeTest.prototype.testStreeSingleOperators = function() {
310  this.brief = true;
311  // Single identifier.
312  this.executeTreeTest(
313      '<mi>a</mi>',
314      '<identifier>a</identifier>');
315  // Single implicit node.
316  this.executeTreeTest(
317      '<mi>a</mi><mi>b</mi>',
318      '<infixop>\u2062' +
319          '<content><operator>\u2062</operator></content>' +
320          '<children>' +
321          '<identifier>a</identifier>' +
322          '<identifier>b</identifier>' +
323          '</children>' +
324          '</infixop>');
325  // Implicit multi node.
326  this.executeTreeTest(
327      '<mi>a</mi><mi>b</mi><mi>c</mi>',
328      '<infixop>\u2062' +
329          '<content><operator>\u2062</operator></content>' +
330          '<children>' +
331          '<identifier>a</identifier>' +
332          '<identifier>b</identifier>' +
333          '<identifier>c</identifier>' +
334          '</children>' +
335          '</infixop>');
336  // Single addition.
337  this.executeTreeTest(
338      '<mi>a</mi><mo>+</mo><mi>b</mi>',
339      '<infixop>+' +
340          '<content><operator>+</operator></content>' +
341          '<children>' +
342          '<identifier>a</identifier>' +
343          '<identifier>b</identifier>' +
344          '</children>' +
345          '</infixop>');
346  // Multi addition.
347  this.executeTreeTest(
348      '<mi>a</mi><mo>+</mo><mi>b</mi><mo>+</mo><mi>c</mi>',
349      '<infixop>+' +
350          '<content><operator>+</operator><operator>+</operator></content>' +
351          '<children>' +
352          '<identifier>a</identifier>' +
353          '<identifier>b</identifier>' +
354          '<identifier>c</identifier>' +
355          '</children>' +
356          '</infixop>');
357  // Multi addition with implicit node.
358  this.executeTreeTest(
359      '<mi>a</mi><mo>+</mo><mi>b</mi><mi>c</mi><mo>+</mo><mi>d</mi>',
360      '<infixop>+' +
361          '<content><operator>+</operator><operator>+</operator></content>' +
362          '<children>' +
363          '<identifier>a</identifier>' +
364          '<infixop>\u2062' +
365          '<content><operator>\u2062</operator></content>' +
366          '<children>' +
367          '<identifier>b</identifier>' +
368          '<identifier>c</identifier>' +
369          '</children>' +
370          '</infixop>' +
371          '<identifier>d</identifier>' +
372          '</children>' +
373          '</infixop>');
374};
375
376
377/**
378 * Test operator trees with multiple operators.
379 */
380cvox.SemanticTreeTest.prototype.testStreeMultipleOperators = function() {
381  this.brief = true;
382  // Addition and subtraction.
383  this.executeTreeTest(
384      '<mi>a</mi><mo>+</mo><mi>b</mi><mo>-</mo><mi>c</mi><mo>+</mo><mi>d</mi>',
385      '<infixop>+' +
386          '<content><operator>+</operator></content>' +
387          '<children>' +
388          '<infixop>-' +
389          '<content><operator>-</operator></content>' +
390          '<children>' +
391          '<infixop>+' +
392          '<content><operator>+</operator></content>' +
393          '<children>' +
394          '<identifier>a</identifier>' +
395          '<identifier>b</identifier>' +
396          '</children>' +
397          '</infixop>' +
398          '<identifier>c</identifier>' +
399          '</children>' +
400          '</infixop>' +
401          '<identifier>d</identifier>' +
402          '</children>' +
403          '</infixop>');
404  // Addition and subtraction.
405  this.executeTreeTest(
406      '<mi>a</mi><mo>+</mo><mi>b</mi><mo>+</mo><mi>c</mi><mo>-</mo>' +
407          '<mi>d</mi><mo>-</mo><mi>e</mi>',
408      '<infixop>-' +
409          '<content><operator>-</operator><operator>-</operator></content>' +
410          '<children>' +
411          '<infixop>+' +
412          '<content><operator>+</operator><operator>+</operator></content>' +
413          '<children>' +
414          '<identifier>a</identifier>' +
415          '<identifier>b</identifier>' +
416          '<identifier>c</identifier>' +
417          '</children>' +
418          '</infixop>' +
419          '<identifier>d</identifier>' +
420          '<identifier>e</identifier>' +
421          '</children>' +
422          '</infixop>');
423  // Addition and explicit multiplication.
424  this.executeTreeTest(
425      '<mi>a</mi><mo>+</mo><mi>b</mi><mo>\u2218</mo><mi>c</mi><mo>+</mo><mi>d</mi>',
426      '<infixop>+' +
427          '<content><operator>+</operator><operator>+</operator></content>' +
428          '<children>' +
429          '<identifier>a</identifier>' +
430          '<infixop>\u2218' +
431          '<content><operator>\u2218</operator></content>' +
432          '<children>' +
433          '<identifier>b</identifier>' +
434          '<identifier>c</identifier>' +
435          '</children>' +
436          '</infixop>' +
437          '<identifier>d</identifier>' +
438          '</children>' +
439          '</infixop>');
440  // Addition with explicit and implicit multiplication.
441  this.executeTreeTest(
442      '<mi>a</mi><mo>+</mo><mi>b</mi><mo>\u2218</mo><mi>c</mi><mi>d</mi>' +
443      '<mo>+</mo><mi>e</mi><mo>\u2218</mo><mi>f</mi>',
444      '<infixop>+' +
445          '<content><operator>+</operator><operator>+</operator></content>' +
446          '<children>' +
447          '<identifier>a</identifier>' +
448          '<infixop>\u2218' +
449          '<content><operator>\u2218</operator></content>' +
450          '<children>' +
451          '<identifier>b</identifier>' +
452          '<infixop>\u2062' +
453          '<content><operator>\u2062</operator></content>' +
454          '<children>' +
455          '<identifier>c</identifier>' +
456          '<identifier>d</identifier>' +
457          '</children>' +
458          '</infixop>' +
459          '</children>' +
460          '</infixop>' +
461          '<infixop>\u2218' +
462          '<content><operator>\u2218</operator></content>' +
463          '<children>' +
464          '<identifier>e</identifier>' +
465          '<identifier>f</identifier>' +
466          '</children>' +
467          '</infixop>' +
468          '</children>' +
469          '</infixop>');
470  // Two Additions, subtraction plus explicit and implicit multiplication,
471  // one prefix and one postfix.
472  this.executeTreeTest(
473      '<mi>a</mi><mo>+</mo><mi>b</mi><mo>+</mo><mi>c</mi><mi>d</mi>' +
474          '<mo>+</mo><mi>e</mi><mo>\u2218</mo><mi>f</mi><mo>-</mo><mi>g</mi>' +
475          '<mo>+</mo><mo>+</mo><mi>h</mi><mo>\u2295</mo><mi>i</mi>' +
476          '<mo>\u2295</mo><mi>j</mi><mo>+</mo><mo>+</mo>',
477      '<infixop>\u2295' +
478          '<content><operator>\u2295</operator>' +
479          '<operator>\u2295</operator></content>' +
480          '<children>' +
481          '<infixop>+' +
482          '<content><operator>+</operator></content>' +
483          '<children>' +
484          '<infixop>-' +
485          '<content><operator>-</operator></content>' +
486          '<children>' +
487          '<infixop>+' +
488          '<content><operator>+</operator>' +
489          '<operator>+</operator><operator>+</operator></content>' +
490          '<children>' +
491          '<identifier>a</identifier>' +
492          '<identifier>b</identifier>' +
493          '<infixop>\u2062' +
494          '<content><operator>\u2062</operator></content>' +
495          '<children>' +
496          '<identifier>c</identifier>' +
497          '<identifier>d</identifier>' +
498          '</children>' +
499          '</infixop>' +
500          '<infixop>\u2218' +
501          '<content><operator>\u2218</operator></content>' +
502          '<children>' +
503          '<identifier>e</identifier>' +
504          '<identifier>f</identifier>' +
505          '</children>' +
506          '</infixop>' +
507          '</children>' +
508          '</infixop>' +
509          '<identifier>g</identifier>' +
510          '</children>' +
511          '</infixop>' +
512          '<prefixop>+' +
513          '<content><operator>+</operator></content>' +
514          '<children>' +
515          '<identifier>h</identifier>' +
516          '</children>' +
517          '</prefixop>' +
518          '</children>' +
519          '</infixop>' +
520          '<identifier>i</identifier>' +
521          '<postfixop>+ +' +
522          '<content><operator>+</operator><operator>+</operator></content>' +
523          '<children>' +
524          '<identifier>j</identifier>' +
525          '</children>' +
526          '</postfixop>' +
527          '</children>' +
528          '</infixop>');
529};
530
531
532// Fences.
533/**
534 * Test regular directed fences.
535 */
536cvox.SemanticTreeTest.prototype.testStreeRegularFences = function() {
537  this.brief = true;
538  // No fence.
539  this.executeTreeTest(
540      '<mrow><mi>a</mi><mo>+</mo><mi>b</mi></mrow>',
541      '<infixop>+' +
542      '<content>' +
543      '<operator>+</operator>' +
544      '</content>' +
545      '<children>' +
546      '<identifier>a</identifier>' +
547      '<identifier>b</identifier>' +
548      '</children>' +
549      '</infixop>');
550  // Empty parentheses.
551  this.executeTreeTest(
552      '<mrow><mo>(</mo><mo>)</mo></mrow>',
553      '<fenced>' +
554      '<content>' +
555      '<fence>(</fence>' +
556      '<fence>)</fence>' +
557      '</content>' +
558      '<children>' +
559      '<empty/>' +
560      '</children>' +
561      '</fenced>');
562  // Single Fenced Expression.
563  this.executeTreeTest(
564      '<mrow><mo>(</mo><mi>a</mi><mo>+</mo><mi>b</mi><mo>)</mo></mrow>',
565      '<fenced>' +
566      '<content>' +
567      '<fence>(</fence>' +
568      '<fence>)</fence>' +
569      '</content>' +
570      '<children>' +
571      '<infixop>+' +
572      '<content>' +
573      '<operator>+</operator>' +
574      '</content>' +
575      '<children>' +
576      '<identifier>a</identifier>' +
577      '<identifier>b</identifier>' +
578      '</children>' +
579      '</infixop>' +
580      '</children>' +
581      '</fenced>');
582  // Single Fenced Expression and operators.
583  this.executeTreeTest(
584      '<mrow><mi>a</mi><mo>+</mo><mo>(</mo><mi>b</mi><mo>+</mo><mi>c</mi>' +
585      '<mo>)</mo><mo>+</mo><mi>d</mi></mrow>',
586      '<infixop>+' +
587      '<content>' +
588      '<operator>+</operator>' +
589      '<operator>+</operator>' +
590      '</content>' +
591      '<children>' +
592      '<identifier>a</identifier>' +
593      '<fenced>' +
594      '<content>' +
595      '<fence>(</fence>' +
596      '<fence>)</fence>' +
597      '</content>' +
598      '<children>' +
599      '<infixop>+' +
600      '<content>' +
601      '<operator>+</operator>' +
602      '</content>' +
603      '<children>' +
604      '<identifier>b</identifier>' +
605      '<identifier>c</identifier>' +
606      '</children>' +
607      '</infixop>' +
608      '</children>' +
609      '</fenced>' +
610      '<identifier>d</identifier>' +
611      '</children>' +
612      '</infixop>');
613  // Parallel Parenthesis.
614  this.executeTreeTest(
615      '<mrow><mo>(</mo><mi>a</mi><mo>+</mo><mi>b</mi><mo>)</mo><mo>(</mo>' +
616      '<mi>c</mi><mo>+</mo><mi>d</mi><mo>)</mo></mrow>',
617      '<infixop>\u2062' +
618      '<content>' +
619      '<operator>\u2062</operator>' +
620      '</content>' +
621      '<children>' +
622      '<fenced>' +
623      '<content>' +
624      '<fence>(</fence>' +
625      '<fence>)</fence>' +
626      '</content>' +
627      '<children>' +
628      '<infixop>+' +
629      '<content>' +
630      '<operator>+</operator>' +
631      '</content>' +
632      '<children>' +
633      '<identifier>a</identifier>' +
634      '<identifier>b</identifier>' +
635      '</children>' +
636      '</infixop>' +
637      '</children>' +
638      '</fenced>' +
639      '<fenced>' +
640      '<content>' +
641      '<fence>(</fence>' +
642      '<fence>)</fence>' +
643      '</content>' +
644      '<children>' +
645      '<infixop>+' +
646      '<content>' +
647      '<operator>+</operator>' +
648      '</content>' +
649      '<children>' +
650      '<identifier>c</identifier>' +
651      '<identifier>d</identifier>' +
652      '</children>' +
653      '</infixop>' +
654      '</children>' +
655      '</fenced>' +
656      '</children>' +
657      '</infixop>');
658  // Nested Parenthesis.
659  this.executeTreeTest(
660      '<mrow><mo>(</mo><mo>(</mo><mi>a</mi><mo>+</mo><mi>b</mi><mo>)</mo>' +
661      '<mo>(</mo><mi>c</mi><mo>+</mo><mi>d</mi><mo>)</mo><mo>)</mo></mrow>',
662      '<fenced>' +
663      '<content>' +
664      '<fence>(</fence>' +
665      '<fence>)</fence>' +
666      '</content>' +
667      '<children>' +
668      '<infixop>\u2062' +
669      '<content>' +
670      '<operator>\u2062</operator>' +
671      '</content>' +
672      '<children>' +
673      '<fenced>' +
674      '<content>' +
675      '<fence>(</fence>' +
676      '<fence>)</fence>' +
677      '</content>' +
678      '<children>' +
679      '<infixop>+' +
680      '<content>' +
681      '<operator>+</operator>' +
682      '</content>' +
683      '<children>' +
684      '<identifier>a</identifier>' +
685      '<identifier>b</identifier>' +
686      '</children>' +
687      '</infixop>' +
688      '</children>' +
689      '</fenced>' +
690      '<fenced>' +
691      '<content>' +
692      '<fence>(</fence>' +
693      '<fence>)</fence>' +
694      '</content>' +
695      '<children>' +
696      '<infixop>+' +
697      '<content>' +
698      '<operator>+</operator>' +
699      '</content>' +
700      '<children>' +
701      '<identifier>c</identifier>' +
702      '<identifier>d</identifier>' +
703      '</children>' +
704      '</infixop>' +
705      '</children>' +
706      '</fenced>' +
707      '</children>' +
708      '</infixop>' +
709      '</children>' +
710      '</fenced>');
711  // Nested parenthesis and brackets.
712  this.executeTreeTest(
713      '<mrow><mo>(</mo><mo>[</mo><mi>a</mi><mo>+</mo><mi>b</mi><mo>+</mo>' +
714      '<mi>c</mi><mo>]</mo><mo>+</mo><mi>d</mi><mo>)</mo></mrow>',
715      '<fenced>' +
716      '<content>' +
717      '<fence>(</fence>' +
718      '<fence>)</fence>' +
719      '</content>' +
720      '<children>' +
721      '<infixop>+' +
722      '<content>' +
723      '<operator>+</operator>' +
724      '</content>' +
725      '<children>' +
726      '<fenced>' +
727      '<content>' +
728      '<fence>[</fence>' +
729      '<fence>]</fence>' +
730      '</content>' +
731      '<children>' +
732      '<infixop>+' +
733      '<content>' +
734      '<operator>+</operator>' +
735      '<operator>+</operator>' +
736      '</content>' +
737      '<children>' +
738      '<identifier>a</identifier>' +
739      '<identifier>b</identifier>' +
740      '<identifier>c</identifier>' +
741      '</children>' +
742      '</infixop>' +
743      '</children>' +
744      '</fenced>' +
745      '<identifier>d</identifier>' +
746      '</children>' +
747      '</infixop>' +
748      '</children>' +
749      '</fenced>');
750  // Nested parenthesis, brackets, braces and superscript operator.
751  this.executeTreeTest(
752      '<mrow><mo>(</mo><msup><mi>a</mi><mrow><mn>2</mn><mo>[</mo><mi>i</mi>' +
753      '<mo>+</mo><mi>n</mi><mo>]</mo></mrow></msup><mo>+</mo><mi>b</mi>' +
754      '<mo>)</mo><mo>+</mo><mo>{</mo><mi>c</mi><mi>d</mi><mo>-</mo><mo>[</mo>' +
755      '<mi>e</mi><mo>+</mo><mi>f</mi><mo>]</mo><mo>}</mo></mrow>',
756      '<infixop>+' +
757      '<content>' +
758      '<operator>+</operator>' +
759      '</content>' +
760      '<children>' +
761      '<fenced>' +
762      '<content>' +
763      '<fence>(</fence>' +
764      '<fence>)</fence>' +
765      '</content>' +
766      '<children>' +
767      '<infixop>+' +
768      '<content>' +
769      '<operator>+</operator>' +
770      '</content>' +
771      '<children>' +
772      '<superscript>' +
773      '<children>' +
774      '<identifier>a</identifier>' +
775      '<infixop>\u2062' +
776      '<content>' +
777      '<operator>\u2062</operator>' +
778      '</content>' +
779      '<children>' +
780      '<number>2</number>' +
781      '<fenced>' +
782      '<content>' +
783      '<fence>[</fence>' +
784      '<fence>]</fence>' +
785      '</content>' +
786      '<children>' +
787      '<infixop>+' +
788      '<content>' +
789      '<operator>+</operator>' +
790      '</content>' +
791      '<children>' +
792      '<identifier>i</identifier>' +
793      '<identifier>n</identifier>' +
794      '</children>' +
795      '</infixop>' +
796      '</children>' +
797      '</fenced>' +
798      '</children>' +
799      '</infixop>' +
800      '</children>' +
801      '</superscript>' +
802      '<identifier>b</identifier>' +
803      '</children>' +
804      '</infixop>' +
805      '</children>' +
806      '</fenced>' +
807      '<fenced>' +
808      '<content>' +
809      '<fence>{</fence>' +
810      '<fence>}</fence>' +
811      '</content>' +
812      '<children>' +
813      '<infixop>-' +
814      '<content>' +
815      '<operator>-</operator>' +
816      '</content>' +
817      '<children>' +
818      '<infixop>\u2062' +
819      '<content>' +
820      '<operator>\u2062</operator>' +
821      '</content>' +
822      '<children>' +
823      '<identifier>c</identifier>' +
824      '<identifier>d</identifier>' +
825      '</children>' +
826      '</infixop>' +
827      '<fenced>' +
828      '<content>' +
829      '<fence>[</fence>' +
830      '<fence>]</fence>' +
831      '</content>' +
832      '<children>' +
833      '<infixop>+' +
834      '<content>' +
835      '<operator>+</operator>' +
836      '</content>' +
837      '<children>' +
838      '<identifier>e</identifier>' +
839      '<identifier>f</identifier>' +
840      '</children>' +
841      '</infixop>' +
842      '</children>' +
843      '</fenced>' +
844      '</children>' +
845      '</infixop>' +
846      '</children>' +
847      '</fenced>' +
848      '</children>' +
849      '</infixop>');
850};
851
852
853/**
854 * Test neutral fences.
855 */
856cvox.SemanticTreeTest.prototype.testStreeNeutralFences = function() {
857  this.brief = true;
858  // Empty bars.
859  this.executeTreeTest(
860      '<mrow><mo>|</mo><mo>|</mo></mrow>',
861      '<fenced>' +
862      '<content>' +
863      '<fence>|</fence>' +
864      '<fence>|</fence>' +
865      '</content>' +
866      '<children>' +
867      '<empty/>' +
868      '</children>' +
869      '</fenced>');
870  // Simple bar fence.
871  this.executeTreeTest(
872      '<mrow><mo>|</mo><mi>a</mi><mo>|</mo></mrow>',
873      '<fenced>' +
874      '<content>' +
875      '<fence>|</fence>' +
876      '<fence>|</fence>' +
877      '</content>' +
878      '<children>' +
879      '<identifier>a</identifier>' +
880      '</children>' +
881      '</fenced>');
882  // Parallel bar fences.
883  this.executeTreeTest(
884      '<mrow><mo>|</mo><mi>a</mi><mo>|</mo><mi>b</mi><mo>+</mo>' +
885      '<mo>\u00A6</mo><mi>c</mi><mo>\u00A6</mo></mrow>',
886      '<infixop>+' +
887      '<content>' +
888      '<operator>+</operator>' +
889      '</content>' +
890      '<children>' +
891      '<infixop>\u2062' +
892      '<content>' +
893      '<operator>\u2062</operator>' +
894      '</content>' +
895      '<children>' +
896      '<fenced>' +
897      '<content>' +
898      '<fence>|</fence>' +
899      '<fence>|</fence>' +
900      '</content>' +
901      '<children>' +
902      '<identifier>a</identifier>' +
903      '</children>' +
904      '</fenced>' +
905      '<identifier>b</identifier>' +
906      '</children>' +
907      '</infixop>' +
908      '<fenced>' +
909      '<content>' +
910      '<fence>\u00A6</fence>' +
911      '<fence>\u00A6</fence>' +
912      '</content>' +
913      '<children>' +
914      '<identifier>c</identifier>' +
915      '</children>' +
916      '</fenced>' +
917      '</children>' +
918      '</infixop>');
919  // Nested bar fences.
920  this.executeTreeTest(
921      '<mrow><mo>\u00A6</mo><mo>|</mo><mi>a</mi><mo>|</mo><mi>b</mi>' +
922      '<mo>+</mo><mi>c</mi><mo>\u00A6</mo></mrow>',
923      '<fenced>' +
924      '<content>' +
925      '<fence>\u00A6</fence>' +
926      '<fence>\u00A6</fence>' +
927      '</content>' +
928      '<children>' +
929      '<infixop>+' +
930      '<content>' +
931      '<operator>+</operator>' +
932      '</content>' +
933      '<children>' +
934      '<infixop>\u2062' +
935      '<content>' +
936      '<operator>\u2062</operator>' +
937      '</content>' +
938      '<children>' +
939      '<fenced>' +
940      '<content>' +
941      '<fence>|</fence>' +
942      '<fence>|</fence>' +
943      '</content>' +
944      '<children>' +
945      '<identifier>a</identifier>' +
946      '</children>' +
947      '</fenced>' +
948      '<identifier>b</identifier>' +
949      '</children>' +
950      '</infixop>' +
951      '<identifier>c</identifier>' +
952      '</children>' +
953      '</infixop>' +
954      '</children>' +
955      '</fenced>');
956};
957
958
959/**
960 * Mixed neutral and regular fences.
961 */
962cvox.SemanticTreeTest.prototype.testStreeMixedFences = function() {
963  this.brief = true;
964  // Empty parenthsis inside bars.
965  this.executeTreeTest(
966      '<mrow><mo>|</mo><mo>(</mo><mo>)</mo><mo>|</mo></mrow>',
967      '<fenced>' +
968      '<content>' +
969      '<fence>|</fence>' +
970      '<fence>|</fence>' +
971      '</content>' +
972      '<children>' +
973      '<fenced>' +
974      '<content>' +
975      '<fence>(</fence>' +
976      '<fence>)</fence>' +
977      '</content>' +
978      '<children>' +
979      '<empty/>' +
980      '</children>' +
981      '</fenced>' +
982      '</children>' +
983      '</fenced>');
984  // Bars inside parentheses.
985  this.executeTreeTest(
986      '<mrow><mo>(</mo><mo>|</mo><mi>a</mi><mo>|</mo><mi>b</mi>' +
987        '<mo>&#x00A6;</mo><mi>c</mi><mo>&#x00A6;</mo><mi>d</mi>' +
988        '<mo>)</mo></mrow>',
989        '<fenced>' +
990        '<content>' +
991        '<fence>(</fence>' +
992        '<fence>)</fence>' +
993        '</content>' +
994        '<children>' +
995        '<infixop>\u2062' +
996        '<content>' +
997        '<operator>\u2062</operator>' +
998        '</content>' +
999        '<children>' +
1000        '<fenced>' +
1001        '<content>' +
1002        '<fence>|</fence>' +
1003        '<fence>|</fence>' +
1004        '</content>' +
1005        '<children>' +
1006        '<identifier>a</identifier>' +
1007        '</children>' +
1008        '</fenced>' +
1009        '<identifier>b</identifier>' +
1010        '<fenced>' +
1011        '<content>' +
1012        '<fence>\u00A6</fence>' +
1013        '<fence>\u00A6</fence>' +
1014        '</content>' +
1015        '<children>' +
1016        '<identifier>c</identifier>' +
1017        '</children>' +
1018        '</fenced>' +
1019        '<identifier>d</identifier>' +
1020        '</children>' +
1021        '</infixop>' +
1022        '</children>' +
1023        '</fenced>');
1024  // Parentheses inside bards.
1025  this.executeTreeTest(
1026      '<mrow><mo>|</mo><mo>(</mo><mi>a</mi><mo>+</mo><mi>b</mi><mo>)</mo>' +
1027      '<mo>&#x00A6;</mo><mi>c</mi><mo>&#x00A6;</mo><mi>d</mi><mo>|</mo></mrow>',
1028      '<fenced>' +
1029      '<content>' +
1030      '<fence>|</fence>' +
1031      '<fence>|</fence>' +
1032      '</content>' +
1033      '<children>' +
1034      '<infixop>\u2062' +
1035      '<content>' +
1036      '<operator>\u2062</operator>' +
1037      '</content>' +
1038      '<children>' +
1039      '<fenced>' +
1040      '<content>' +
1041      '<fence>(</fence>' +
1042      '<fence>)</fence>' +
1043      '</content>' +
1044      '<children>' +
1045      '<infixop>+' +
1046      '<content>' +
1047      '<operator>+</operator>' +
1048      '</content>' +
1049      '<children>' +
1050      '<identifier>a</identifier>' +
1051      '<identifier>b</identifier>' +
1052      '</children>' +
1053      '</infixop>' +
1054      '</children>' +
1055      '</fenced>' +
1056      '<fenced>' +
1057      '<content>' +
1058      '<fence>\u00A6</fence>' +
1059      '<fence>\u00A6</fence>' +
1060      '</content>' +
1061      '<children>' +
1062      '<identifier>c</identifier>' +
1063      '</children>' +
1064      '</fenced>' +
1065      '<identifier>d</identifier>' +
1066      '</children>' +
1067      '</infixop>' +
1068      '</children>' +
1069      '</fenced>');
1070  // Parentheses inside bards.
1071  this.executeTreeTest(
1072      '<mrow><mo>[</mo><mo>|</mo><mi>a</mi><mo>+</mo><mi>b</mi><mo>|</mo>' +
1073      '<mo>+</mo><mi>c</mi><mo>]</mo><mo>+</mo><mo>\u00A6</mo><mi>d</mi>' +
1074      '<mo>+</mo><mo>(</mo><mi>e</mi><mo>+</mo><mi>f</mi><mo>)</mo>' +
1075      '<mo>\u00A6</mo></mrow>',
1076      '<infixop>+' +
1077      '<content>' +
1078      '<operator>+</operator>' +
1079      '</content>' +
1080      '<children>' +
1081      '<fenced>' +
1082      '<content>' +
1083      '<fence>[</fence>' +
1084      '<fence>]</fence>' +
1085      '</content>' +
1086      '<children>' +
1087      '<infixop>+' +
1088      '<content>' +
1089      '<operator>+</operator>' +
1090      '</content>' +
1091      '<children>' +
1092      '<fenced>' +
1093      '<content>' +
1094      '<fence>|</fence>' +
1095      '<fence>|</fence>' +
1096      '</content>' +
1097      '<children>' +
1098      '<infixop>+' +
1099      '<content>' +
1100      '<operator>+</operator>' +
1101      '</content>' +
1102      '<children>' +
1103      '<identifier>a</identifier>' +
1104      '<identifier>b</identifier>' +
1105      '</children>' +
1106      '</infixop>' +
1107      '</children>' +
1108      '</fenced>' +
1109      '<identifier>c</identifier>' +
1110      '</children>' +
1111      '</infixop>' +
1112      '</children>' +
1113      '</fenced>' +
1114      '<fenced>' +
1115      '<content>' +
1116      '<fence>\u00A6</fence>' +
1117      '<fence>\u00A6</fence>' +
1118      '</content>' +
1119      '<children>' +
1120      '<infixop>+' +
1121      '<content>' +
1122      '<operator>+</operator>' +
1123      '</content>' +
1124      '<children>' +
1125      '<identifier>d</identifier>' +
1126      '<fenced>' +
1127      '<content>' +
1128      '<fence>(</fence>' +
1129      '<fence>)</fence>' +
1130      '</content>' +
1131      '<children>' +
1132      '<infixop>+' +
1133      '<content>' +
1134      '<operator>+</operator>' +
1135      '</content>' +
1136      '<children>' +
1137      '<identifier>e</identifier>' +
1138      '<identifier>f</identifier>' +
1139      '</children>' +
1140      '</infixop>' +
1141      '</children>' +
1142      '</fenced>' +
1143      '</children>' +
1144      '</infixop>' +
1145      '</children>' +
1146      '</fenced>' +
1147      '</children>' +
1148      '</infixop>');
1149};
1150
1151
1152/**
1153 * Mixed with isolated bars.
1154 */
1155cvox.SemanticTreeTest.prototype.testStreeMixedFencesWithBars = function() {
1156  this.brief = true;
1157  this.xpathBlacklist = ['descendant::punctuated/content'];
1158  // Set notation.
1159  this.executeTreeTest(
1160      '<mrow><mo>{</mo><mo>(</mo><mi>x</mi><mo>,</mo><mi>y</mi><mo>,</mo>' +
1161      '<mi>z</mi><mo>)</mo><mo>|</mo><mi>x</mi><mi>y</mi><mo>=</mo>' +
1162      '<mo>z</mo><mo>}</mo></mrow>',
1163      '<fenced>' +
1164      '<content>' +
1165      '<fence>{</fence>' +
1166      '<fence>}</fence>' +
1167      '</content>' +
1168      '<children>' +
1169      '<punctuated>' +
1170      '<children>' +
1171      '<fenced>' +
1172      '<content>' +
1173      '<fence>(</fence>' +
1174      '<fence>)</fence>' +
1175      '</content>' +
1176      '<children>' +
1177      '<punctuated>' +
1178      '<children>' +
1179      '<identifier>x</identifier>' +
1180      '<punctuation>,</punctuation>' +
1181      '<identifier>y</identifier>' +
1182      '<punctuation>,</punctuation>' +
1183      '<identifier>z</identifier>' +
1184      '</children>' +
1185      '</punctuated>' +
1186      '</children>' +
1187      '</fenced>' +
1188      '<punctuation>|</punctuation>' +
1189      '<relseq>=' +
1190      '<content>' +
1191      '<relation>=</relation>' +
1192      '</content>' +
1193      '<children>' +
1194      '<infixop>\u2062' +
1195      '<content>' +
1196      '<operator>\u2062</operator>' +
1197      '</content>' +
1198      '<children>' +
1199      '<identifier>x</identifier>' +
1200      '<identifier>y</identifier>' +
1201      '</children>' +
1202      '</infixop>' +
1203      '<identifier>z</identifier>' +
1204      '</children>' +
1205      '</relseq>' +
1206      '</children>' +
1207      '</punctuated>' +
1208      '</children>' +
1209      '</fenced>');
1210  // Disjunction of bracketed parallel statements.
1211  this.executeTreeTest(
1212      '<mrow><mo>[</mo><mi>a</mi><mo>&#x2016;</mo><mi>b</mi><mo>]</mo>' +
1213      '<mo>|</mo><mo>[</mo><mi>x</mi><mo>&#x2016;</mo><mi>y</mi><mo>]</mo>' +
1214      '</mrow>',
1215      '<punctuated>' +
1216      '<children>' +
1217      '<fenced>' +
1218      '<content>' +
1219      '<fence>[</fence>' +
1220      '<fence>]</fence>' +
1221      '</content>' +
1222      '<children>' +
1223      '<punctuated>' +
1224      '<children>' +
1225      '<identifier>a</identifier>' +
1226      '<punctuation>\u2016</punctuation>' +
1227      '<identifier>b</identifier>' +
1228      '</children>' +
1229      '</punctuated>' +
1230      '</children>' +
1231      '</fenced>' +
1232      '<punctuation>|</punctuation>' +
1233      '<fenced>' +
1234      '<content>' +
1235      '<fence>[</fence>' +
1236      '<fence>]</fence>' +
1237      '</content>' +
1238      '<children>' +
1239      '<punctuated>' +
1240      '<children>' +
1241      '<identifier>x</identifier>' +
1242      '<punctuation>\u2016</punctuation>' +
1243      '<identifier>y</identifier>' +
1244      '</children>' +
1245      '</punctuated>' +
1246      '</children>' +
1247      '</fenced>' +
1248      '</children>' +
1249      '</punctuated>'
1250  );
1251  // Metric over the above.
1252  this.executeTreeTest(
1253      '<mrow><mo>&#x2016;</mo><mo>[</mo><mi>a</mi><mo>&#x2016;</mo>' +
1254      '<mi>b</mi><mo>]</mo><mo>|</mo><mo>[</mo><mi>x</mi><mo>&#x2016;</mo>' +
1255      '<mi>y</mi><mo>]</mo><mo>&#x2016;</mo></mrow>',
1256      '<fenced>' +
1257      '<content>' +
1258      '<fence>\u2016</fence>' +
1259      '<fence>\u2016</fence>' +
1260      '</content>' +
1261      '<children>' +
1262      '<punctuated>' +
1263      '<children>' +
1264      '<fenced>' +
1265      '<content>' +
1266      '<fence>[</fence>' +
1267      '<fence>]</fence>' +
1268      '</content>' +
1269      '<children>' +
1270      '<punctuated>' +
1271      '<children>' +
1272      '<identifier>a</identifier>' +
1273      '<punctuation>\u2016</punctuation>' +
1274      '<identifier>b</identifier>' +
1275      '</children>' +
1276      '</punctuated>' +
1277      '</children>' +
1278      '</fenced>' +
1279      '<punctuation>|</punctuation>' +
1280      '<fenced>' +
1281      '<content>' +
1282      '<fence>[</fence>' +
1283      '<fence>]</fence>' +
1284      '</content>' +
1285      '<children>' +
1286      '<punctuated>' +
1287      '<children>' +
1288      '<identifier>x</identifier>' +
1289      '<punctuation>\u2016</punctuation>' +
1290      '<identifier>y</identifier>' +
1291      '</children>' +
1292      '</punctuated>' +
1293      '</children>' +
1294      '</fenced>' +
1295      '</children>' +
1296      '</punctuated>' +
1297      '</children>' +
1298      '</fenced>');
1299  // Mix of metrics and bracketed expression and single bars.
1300  this.executeTreeTest(
1301      '<mrow><mo>&#x2016;</mo><mo>[</mo><mi>a</mi><mo>&#x2016;</mo><mi>b</mi>' +
1302      '<mo>]</mo><mo>|</mo><mo>[</mo><mi>c</mi><mo>&#x2016;</mo>' +
1303      '<mo>&#x00A6;</mo><mi>d</mi><mo>]</mo><mo>&#x2016;</mo><mo>[</mo>' +
1304      '<mi>u</mi><mo>&#x2016;</mo><mi>v</mi><mo>]</mo><mo>|</mo><mi>x</mi>' +
1305      '<mo>&#x2016;</mo><mi>y</mi><mo>&#x00A6;</mo><mi>z</mi></mrow>',
1306      '<punctuated>' +
1307      '<children>' +
1308      '<infixop>\u2062' +
1309      '<content>' +
1310      '<operator>\u2062</operator>' +
1311      '</content>' +
1312      '<children>' +
1313      '<fenced>' +
1314      '<content>' +
1315      '<fence>\u2016</fence>' +
1316      '<fence>\u2016</fence>' +
1317      '</content>' +
1318      '<children>' +
1319      '<punctuated>' +
1320      '<children>' +
1321      '<fenced>' +
1322      '<content>' +
1323      '<fence>[</fence>' +
1324      '<fence>]</fence>' +
1325      '</content>' +
1326      '<children>' +
1327      '<punctuated>' +
1328      '<children>' +
1329      '<identifier>a</identifier>' +
1330      '<punctuation>\u2016</punctuation>' +
1331      '<identifier>b</identifier>' +
1332      '</children>' +
1333      '</punctuated>' +
1334      '</children>' +
1335      '</fenced>' +
1336      '<punctuation>|</punctuation>' +
1337      '<fenced>' +
1338      '<content>' +
1339      '<fence>[</fence>' +
1340      '<fence>]</fence>' +
1341      '</content>' +
1342      '<children>' +
1343      '<punctuated>' +
1344      '<children>' +
1345      '<identifier>c</identifier>' +
1346      '<punctuation>\u2016</punctuation>' +
1347      '<punctuation>\u00A6</punctuation>' +
1348      '<identifier>d</identifier>' +
1349      '</children>' +
1350      '</punctuated>' +
1351      '</children>' +
1352      '</fenced>' +
1353      '</children>' +
1354      '</punctuated>' +
1355      '</children>' +
1356      '</fenced>' +
1357      '<fenced>' +
1358      '<content>' +
1359      '<fence>[</fence>' +
1360      '<fence>]</fence>' +
1361      '</content>' +
1362      '<children>' +
1363      '<punctuated>' +
1364      '<children>' +
1365      '<identifier>u</identifier>' +
1366      '<punctuation>\u2016</punctuation>' +
1367      '<identifier>v</identifier>' +
1368      '</children>' +
1369      '</punctuated>' +
1370      '</children>' +
1371      '</fenced>' +
1372      '</children>' +
1373      '</infixop>' +
1374      '<punctuation>|</punctuation>' +
1375      '<identifier>x</identifier>' +
1376      '<punctuation>\u2016</punctuation>' +
1377      '<identifier>y</identifier>' +
1378      '<punctuation>\u00A6</punctuation>' +
1379      '<identifier>z</identifier>' +
1380      '</children>' +
1381      '</punctuated>');
1382  this.xpathBlacklist = [];
1383};
1384
1385
1386/**
1387 * Pathological cases with only opening fences.
1388 */
1389cvox.SemanticTreeTest.prototype.testStreeOpeningFencesOnly = function() {
1390  this.brief = true;
1391  this.xpathBlacklist = ['descendant::punctuated/content'];
1392  // Single.
1393  this.executeTreeTest(
1394      '<mrow><mo>[</mo></mrow>',
1395      '<fence>[</fence>');
1396  // Single right.
1397  this.executeTreeTest(
1398      '<mrow><mi>a</mi><mo>[</mo></mrow>',
1399      '<punctuated>' +
1400      '<children>' +
1401      '<identifier>a</identifier>' +
1402      '<punctuation>[</punctuation>' +
1403      '</children>' +
1404      '</punctuated>');
1405  // Single middle.
1406  this.executeTreeTest(
1407      '<mrow><mi>a</mi><mo>[</mo><mi>b</mi></mrow>',
1408      '<punctuated>' +
1409      '<children>' +
1410      '<identifier>a</identifier>' +
1411      '<punctuation>[</punctuation>' +
1412      '<identifier>b</identifier>' +
1413      '</children>' +
1414      '</punctuated>');
1415  // Single left.
1416  this.executeTreeTest(
1417   '<mrow><mo>[</mo><mi>b</mi></mrow>',
1418   '<punctuated>' +
1419   '<children>' +
1420   '<punctuation>[</punctuation>' +
1421   '<identifier>b</identifier>' +
1422   '</children>' +
1423   '</punctuated>');
1424  // Multiple.
1425  this.executeTreeTest(
1426      '<mrow><mi>a</mi><mo>[</mo><mi>b</mi><mi>c</mi><mo>(</mo><mi>d</mi>' +
1427      '<mo>{</mo><mi>e</mi><mo>&#x3008;</mo><mi>f</mi></mrow>',
1428      '<punctuated>' +
1429      '<children>' +
1430      '<identifier>a</identifier>' +
1431      '<punctuation>[</punctuation>' +
1432      '<infixop>\u2062' +
1433      '<content>' +
1434      '<operator>\u2062</operator>' +
1435      '</content>' +
1436      '<children>' +
1437      '<identifier>b</identifier>' +
1438      '<identifier>c</identifier>' +
1439      '</children>' +
1440      '</infixop>' +
1441      '<punctuation>(</punctuation>' +
1442      '<identifier>d</identifier>' +
1443      '<punctuation>{</punctuation>' +
1444      '<identifier>e</identifier>' +
1445      '<punctuation>\u3008</punctuation>' +
1446      '<identifier>f</identifier>' +
1447      '</children>' +
1448      '</punctuated>');
1449  // Multiple plus inner fenced.
1450  this.executeTreeTest(
1451      '<mrow><mi>a</mi><mo>[</mo><mi>b</mi><mo>[</mo><mo>(</mo><mo>(</mo>' +
1452      '<mi>c</mi><mo>)</mo><mi>d</mi><mo>{</mo><mi>e</mi><mo>&#x3008;</mo>' +
1453      '<mi>f</mi></mrow>',
1454      '<punctuated>' +
1455      '<children>' +
1456      '<identifier>a</identifier>' +
1457      '<punctuation>[</punctuation>' +
1458      '<identifier>b</identifier>' +
1459      '<punctuation>[</punctuation>' +
1460      '<punctuation>(</punctuation>' +
1461      '<infixop>\u2062' +
1462      '<content>' +
1463      '<operator>\u2062</operator>' +
1464      '</content>' +
1465      '<children>' +
1466      '<fenced>' +
1467      '<content>' +
1468      '<fence>(</fence>' +
1469      '<fence>)</fence>' +
1470      '</content>' +
1471      '<children>' +
1472      '<identifier>c</identifier>' +
1473      '</children>' +
1474      '</fenced>' +
1475      '<identifier>d</identifier>' +
1476      '</children>' +
1477      '</infixop>' +
1478      '<punctuation>{</punctuation>' +
1479      '<identifier>e</identifier>' +
1480      '<punctuation>\u3008</punctuation>' +
1481      '<identifier>f</identifier>' +
1482      '</children>' +
1483      '</punctuated>');
1484  this.xpathBlacklist = [];
1485};
1486
1487
1488/**
1489 * Pathological cases with only closing fences.
1490 */
1491cvox.SemanticTreeTest.prototype.testStreeClosingFencesOnly = function() {
1492  this.brief = true;
1493  this.xpathBlacklist = ['descendant::punctuated/content'];
1494  // Single.
1495  this.executeTreeTest(
1496      '<mrow><mo>]</mo></mrow>',
1497      '<fence>]</fence>');
1498  // Single right.
1499  this.executeTreeTest(
1500      '<mrow><mi>a</mi><mo>]</mo></mrow>',
1501      '<punctuated>' +
1502      '<children>' +
1503      '<identifier>a</identifier>' +
1504      '<punctuation>]</punctuation>' +
1505      '</children>' +
1506      '</punctuated>');
1507  // Single middle.
1508  this.executeTreeTest(
1509      '<mrow><mi>a</mi><mo>]</mo><mi>b</mi></mrow>',
1510      '<punctuated>' +
1511      '<children>' +
1512      '<identifier>a</identifier>' +
1513      '<punctuation>]</punctuation>' +
1514      '<identifier>b</identifier>' +
1515      '</children>' +
1516      '</punctuated>');
1517  // Single left.
1518  this.executeTreeTest(
1519      '<mrow><mo>]</mo><mi>b</mi></mrow>',
1520      '<punctuated>' +
1521      '<children>' +
1522      '<punctuation>]</punctuation>' +
1523      '<identifier>b</identifier>' +
1524      '</children>' +
1525      '</punctuated>');
1526  // Multiple.
1527  this.executeTreeTest(
1528      '<mrow><mi>a</mi><mo>]</mo><mi>b</mi><mi>c</mi><mo>)</mo><mi>d</mi>' +
1529      '<mo>}</mo><mi>e</mi><mo>&#x3009;</mo><mi>f</mi></mrow>',
1530      '<punctuated>' +
1531      '<children>' +
1532      '<identifier>a</identifier>' +
1533      '<punctuation>]</punctuation>' +
1534      '<infixop>\u2062' +
1535      '<content>' +
1536      '<operator>\u2062</operator>' +
1537      '</content>' +
1538      '<children>' +
1539      '<identifier>b</identifier>' +
1540      '<identifier>c</identifier>' +
1541      '</children>' +
1542      '</infixop>' +
1543      '<punctuation>)</punctuation>' +
1544      '<identifier>d</identifier>' +
1545      '<punctuation>}</punctuation>' +
1546      '<identifier>e</identifier>' +
1547      '<punctuation>\u3009</punctuation>' +
1548      '<identifier>f</identifier>' +
1549      '</children>' +
1550      '</punctuated>');
1551  // Multiple plus inner fenced.
1552  this.executeTreeTest(
1553      '<mrow><mi>a</mi><mo>]</mo><mi>b</mi><mo>]</mo><mo>(</mo><mi>c</mi>' +
1554      '<mo>)</mo><mo>)</mo><mi>d</mi><mo>}</mo><mi>e</mi><mo>&#x3009;</mo>' +
1555      '<mi>f</mi></mrow>',
1556      '<punctuated>' +
1557      '<children>' +
1558      '<identifier>a</identifier>' +
1559      '<punctuation>]</punctuation>' +
1560      '<identifier>b</identifier>' +
1561      '<punctuation>]</punctuation>' +
1562      '<fenced>' +
1563      '<content>' +
1564      '<fence>(</fence>' +
1565      '<fence>)</fence>' +
1566      '</content>' +
1567      '<children>' +
1568      '<identifier>c</identifier>' +
1569      '</children>' +
1570      '</fenced>' +
1571      '<punctuation>)</punctuation>' +
1572      '<identifier>d</identifier>' +
1573      '<punctuation>}</punctuation>' +
1574      '<identifier>e</identifier>' +
1575      '<punctuation>\u3009</punctuation>' +
1576      '<identifier>f</identifier>' +
1577      '</children>' +
1578      '</punctuated>');
1579  this.xpathBlacklist = [];
1580};
1581
1582
1583/**
1584 * Pathological cases with only neutral fences.
1585 */
1586cvox.SemanticTreeTest.prototype.testStreeNeutralFencesOnly = function() {
1587  this.brief = true;
1588  this.xpathBlacklist = ['descendant::punctuated/content'];
1589  // Single.
1590  this.executeTreeTest(
1591      '<mrow><mo>|</mo></mrow>',
1592      '<fence>|</fence>');
1593  // Single right.
1594  this.executeTreeTest(
1595      '<mrow><mi>a</mi><mo>|</mo></mrow>',
1596      '<punctuated>' +
1597      '<children>' +
1598      '<identifier>a</identifier>' +
1599      '<punctuation>|</punctuation>' +
1600      '</children>' +
1601      '</punctuated>');
1602  // Single middle.
1603  this.executeTreeTest(
1604      '<mrow><mi>a</mi><mo>|</mo><mi>b</mi></mrow>',
1605      '<punctuated>' +
1606      '<children>' +
1607      '<identifier>a</identifier>' +
1608      '<punctuation>|</punctuation>' +
1609      '<identifier>b</identifier>' +
1610      '</children>' +
1611      '</punctuated>');
1612  // Single left.
1613  this.executeTreeTest(
1614      '<mrow><mo>|</mo><mi>b</mi></mrow>',
1615      '<punctuated>' +
1616      '<children>' +
1617      '<punctuation>|</punctuation>' +
1618      '<identifier>b</identifier>' +
1619      '</children>' +
1620      '</punctuated>');
1621  // Two different bars.
1622  this.executeTreeTest(
1623      '<mrow><mi>a</mi><mo>|</mo><mi>b</mi><mo>&#x00A6;</mo><mi>c</mi></mrow>',
1624      '<punctuated>' +
1625      '<children>' +
1626      '<identifier>a</identifier>' +
1627      '<punctuation>|</punctuation>' +
1628      '<identifier>b</identifier>' +
1629      '<punctuation>\u00A6</punctuation>' +
1630      '<identifier>c</identifier>' +
1631      '</children>' +
1632      '</punctuated>');
1633  // Three different bars.
1634  this.executeTreeTest(
1635      '<mrow><mi>a</mi><mo>&#x2016;</mo><mi>b</mi><mo>|</mo><mi>c</mi>' +
1636      '<mo>&#x00A6;</mo><mi>d</mi></mrow>',
1637      '<punctuated>' +
1638      '<children>' +
1639      '<identifier>a</identifier>' +
1640      '<punctuation>\u2016</punctuation>' +
1641      '<identifier>b</identifier>' +
1642      '<punctuation>|</punctuation>' +
1643      '<identifier>c</identifier>' +
1644      '<punctuation>\u00A6</punctuation>' +
1645      '<identifier>d</identifier>' +
1646      '</children>' +
1647      '</punctuated>');
1648  // Multiple plus inner fenced.
1649  this.executeTreeTest(
1650      '<mrow><mo>&#x2016;</mo><mo>[</mo><mi>a</mi><mo>&#x2016;</mo><mi>b</mi>' +
1651      '<mo>]</mo><mo>&#x2016;</mo><mo>|</mo><mi>x</mi><mo>&#x2016;</mo>' +
1652      '<mi>y</mi><mo>&#x00A6;</mo><mi>z</mi></mrow>',
1653      '<punctuated>' +
1654      '<children>' +
1655      '<fenced>' +
1656      '<content>' +
1657      '<fence>\u2016</fence>' +
1658      '<fence>\u2016</fence>' +
1659      '</content>' +
1660      '<children>' +
1661      '<fenced>' +
1662      '<content>' +
1663      '<fence>[</fence>' +
1664      '<fence>]</fence>' +
1665      '</content>' +
1666      '<children>' +
1667      '<punctuated>' +
1668      '<children>' +
1669      '<identifier>a</identifier>' +
1670      '<punctuation>\u2016</punctuation>' +
1671      '<identifier>b</identifier>' +
1672      '</children>' +
1673      '</punctuated>' +
1674      '</children>' +
1675      '</fenced>' +
1676      '</children>' +
1677      '</fenced>' +
1678      '<punctuation>|</punctuation>' +
1679      '<identifier>x</identifier>' +
1680      '<punctuation>\u2016</punctuation>' +
1681      '<identifier>y</identifier>' +
1682      '<punctuation>\u00A6</punctuation>' +
1683      '<identifier>z</identifier>' +
1684      '</children>' +
1685      '</punctuated>');
1686  this.xpathBlacklist = [];
1687};
1688
1689
1690/**
1691 * Pathological cases with mixed fences.
1692 */
1693cvox.SemanticTreeTest.prototype.testStreeMixedUnmatchedFences = function() {
1694  this.brief = true;
1695  this.xpathBlacklist = ['descendant::punctuated/content'];
1696  // Close, neutral, open.
1697  this.executeTreeTest(
1698      '<mrow><mo>]</mo><mo>&#x2016;</mo><mi>b</mi><mo>|</mo><mi>c</mi>' +
1699      '<mo>(</mo></mrow>',
1700      '<punctuated>' +
1701      '<children>' +
1702      '<punctuation>]</punctuation>' +
1703      '<punctuation>\u2016</punctuation>' +
1704      '<identifier>b</identifier>' +
1705      '<punctuation>|</punctuation>' +
1706      '<identifier>c</identifier>' +
1707      '<punctuation>(</punctuation>' +
1708      '</children>' +
1709      '</punctuated>');
1710  // Neutrals and close.
1711  this.executeTreeTest(
1712      '<mrow><mi>a</mi><mo>&#x2016;</mo><mi>b</mi><mo>|</mo><mi>c</mi>' +
1713      '<mo>&#x00A6;</mo><mi>d</mi><mo>]</mo><mi>e</mi></mrow>',
1714      '<punctuated>' +
1715      '<children>' +
1716      '<identifier>a</identifier>' +
1717      '<punctuation>\u2016</punctuation>' +
1718      '<identifier>b</identifier>' +
1719      '<punctuation>|</punctuation>' +
1720      '<identifier>c</identifier>' +
1721      '<punctuation>\u00A6</punctuation>' +
1722      '<identifier>d</identifier>' +
1723      '<punctuation>]</punctuation>' +
1724      '<identifier>e</identifier>' +
1725      '</children>' +
1726      '</punctuated>');
1727  // Neutrals and open.
1728  this.executeTreeTest(
1729      '<mrow><mo>[</mo><mi>a</mi><mo>&#x2016;</mo><mi>b</mi><mo>|</mo>' +
1730      '<mi>c</mi><mo>&#x00A6;</mo><mi>d</mi></mrow>',
1731      '<punctuated>' +
1732      '<children>' +
1733      '<punctuation>[</punctuation>' +
1734      '<identifier>a</identifier>' +
1735      '<punctuation>\u2016</punctuation>' +
1736      '<identifier>b</identifier>' +
1737      '<punctuation>|</punctuation>' +
1738      '<identifier>c</identifier>' +
1739      '<punctuation>\u00A6</punctuation>' +
1740      '<identifier>d</identifier>' +
1741      '</children>' +
1742      '</punctuated>');
1743  // Multiple fences, fenced and operations
1744  this.executeTreeTest(
1745      '<mrow><mo>&#x2016;</mo><mo>[</mo><mi>a</mi><mo>&#x2016;</mo><mi>b</mi>' +
1746      '<mo>]</mo><mo>|</mo><mo>[</mo><mi>c</mi><mo>&#x2016;</mo>' +
1747      '<mo>&#x00A6;</mo><mi>d</mi><mo>]</mo><mo>&#x2016;</mo><mo>|</mo>' +
1748      '<mi>x</mi><mo>&#x2016;</mo><mi>y</mi><mo>&#x00A6;</mo><mi>z</mi>' +
1749      '<mo>]</mo></mrow>',
1750      '<punctuated>' +
1751      '<children>' +
1752      '<fenced>' +
1753      '<content>' +
1754      '<fence>\u2016</fence>' +
1755      '<fence>\u2016</fence>' +
1756      '</content>' +
1757      '<children>' +
1758      '<punctuated>' +
1759      '<children>' +
1760      '<fenced>' +
1761      '<content>' +
1762      '<fence>[</fence>' +
1763      '<fence>]</fence>' +
1764      '</content>' +
1765      '<children>' +
1766      '<punctuated>' +
1767      '<children>' +
1768      '<identifier>a</identifier>' +
1769      '<punctuation>\u2016</punctuation>' +
1770      '<identifier>b</identifier>' +
1771      '</children>' +
1772      '</punctuated>' +
1773      '</children>' +
1774      '</fenced>' +
1775      '<punctuation>|</punctuation>' +
1776      '<fenced>' +
1777      '<content>' +
1778      '<fence>[</fence>' +
1779      '<fence>]</fence>' +
1780      '</content>' +
1781      '<children>' +
1782      '<punctuated>' +
1783      '<children>' +
1784      '<identifier>c</identifier>' +
1785      '<punctuation>\u2016</punctuation>' +
1786      '<punctuation>\u00A6</punctuation>' +
1787      '<identifier>d</identifier>' +
1788      '</children>' +
1789      '</punctuated>' +
1790      '</children>' +
1791      '</fenced>' +
1792      '</children>' +
1793      '</punctuated>' +
1794      '</children>' +
1795      '</fenced>' +
1796      '<punctuation>|</punctuation>' +
1797      '<identifier>x</identifier>' +
1798      '<punctuation>\u2016</punctuation>' +
1799      '<identifier>y</identifier>' +
1800      '<punctuation>\u00A6</punctuation>' +
1801      '<identifier>z</identifier>' +
1802      '<punctuation>]</punctuation>' +
1803      '</children>' +
1804      '</punctuated>');
1805  // Multiple fences, fenced and operations
1806  this.executeTreeTest(
1807      '<mrow><mo>&#x2016;</mo><mo>]</mo><mo>&#x00A6;</mo><mo>&#x2016;</mo>' +
1808      '<mo>[</mo><mo>|</mo><mo>[</mo><mi>a</mi><mo>&#x2016;</mo><mi>b</mi>' +
1809      '<mo>]</mo><mo>&#x2016;</mo><mo>|</mo><mi>[</mi><mo>&#x2016;</mo>' +
1810      '<mi>y</mi><mo>&#x00A6;</mo><mi>z</mi></mrow>',
1811      '<punctuated>' +
1812      '<children>' +
1813      '<fenced>' +
1814      '<content>' +
1815      '<fence>\u2016</fence>' +
1816      '<fence>\u2016</fence>' +
1817      '</content>' +
1818      '<children>' +
1819      '<punctuated>' +
1820      '<children>' +
1821      '<punctuation>]</punctuation>' +
1822      '<punctuation>\u00A6</punctuation>' +
1823      '</children>' +
1824      '</punctuated>' +
1825      '</children>' +
1826      '</fenced>' +
1827      '<punctuation>[</punctuation>' +
1828      '<fenced>' +
1829      '<content>' +
1830      '<fence>|</fence>' +
1831      '<fence>|</fence>' +
1832      '</content>' +
1833      '<children>' +
1834      '<punctuated>' +
1835      '<children>' +
1836      '<fenced>' +
1837      '<content>' +
1838      '<fence>[</fence>' +
1839      '<fence>]</fence>' +
1840      '</content>' +
1841      '<children>' +
1842      '<punctuated>' +
1843      '<children>' +
1844      '<identifier>a</identifier>' +
1845      '<punctuation>\u2016</punctuation>' +
1846      '<identifier>b</identifier>' +
1847      '</children>' +
1848      '</punctuated>' +
1849      '</children>' +
1850      '</fenced>' +
1851      '<punctuation>\u2016</punctuation>' +
1852      '</children>' +
1853      '</punctuated>' +
1854      '</children>' +
1855      '</fenced>' +
1856      '<punctuation>[</punctuation>' +
1857      '<punctuation>\u2016</punctuation>' +
1858      '<identifier>y</identifier>' +
1859      '<punctuation>\u00A6</punctuation>' +
1860      '<identifier>z</identifier>' +
1861      '</children>' +
1862      '</punctuated>');
1863  // Multiple fences, fenced and operations
1864  this.executeTreeTest(
1865      '<mrow><mo>&#x2016;</mo><mo>[</mo><mi>a</mi><mo>&#x00A6;</mo>' +
1866      '<mo>&#x2016;</mo><mo>[</mo><mo>+</mo><mo>[</mo><mi>b</mi>' +
1867      '<mo>&#x2016;</mo><mi>c</mi><mo>]</mo><mo>+</mo><mo>&#x2016;</mo>' +
1868      '<mo>|</mo><mi>d</mi><mo>+</mo><mi>e</mi><mi>[</mi><mo>&#x2016;</mo>' +
1869      '<mi>y</mi><mo>&#x00A6;</mo><mo>+</mo><mi>z</mi></mrow>',
1870      '<punctuated>' +
1871      '<children>' +
1872      '<punctuation>\u2016</punctuation>' +
1873      '<punctuation>[</punctuation>' +
1874      '<identifier>a</identifier>' +
1875      '<punctuation>\u00A6</punctuation>' +
1876      '<punctuation>\u2016</punctuation>' +
1877      '<punctuation>[</punctuation>' +
1878      '<postfixop>+' +
1879      '<content>' +
1880      '<operator>+</operator>' +
1881      '</content>' +
1882      '<children>' +
1883      '<prefixop>+' +
1884      '<content>' +
1885      '<operator>+</operator>' +
1886      '</content>' +
1887      '<children>' +
1888      '<fenced>' +
1889      '<content>' +
1890      '<fence>[</fence>' +
1891      '<fence>]</fence>' +
1892      '</content>' +
1893      '<children>' +
1894      '<punctuated>' +
1895      '<children>' +
1896      '<identifier>b</identifier>' +
1897      '<punctuation>\u2016</punctuation>' +
1898      '<identifier>c</identifier>' +
1899      '</children>' +
1900      '</punctuated>' +
1901      '</children>' +
1902      '</fenced>' +
1903      '</children>' +
1904      '</prefixop>' +
1905      '</children>' +
1906      '</postfixop>' +
1907      '<punctuation>\u2016</punctuation>' +
1908      '<punctuation>|</punctuation>' +
1909      '<infixop>+' +
1910      '<content>' +
1911      '<operator>+</operator>' +
1912      '</content>' +
1913      '<children>' +
1914      '<identifier>d</identifier>' +
1915      '<identifier>e</identifier>' +
1916      '</children>' +
1917      '</infixop>' +
1918      '<punctuation>[</punctuation>' +
1919      '<punctuation>\u2016</punctuation>' +
1920      '<identifier>y</identifier>' +
1921      '<punctuation>\u00A6</punctuation>' +
1922      '<prefixop>+' +
1923      '<content>' +
1924      '<operator>+</operator>' +
1925      '</content>' +
1926      '<children>' +
1927      '<identifier>z</identifier>' +
1928      '</children>' +
1929      '</prefixop>' +
1930      '</children>' +
1931      '</punctuated>');
1932  this.xpathBlacklist = [];
1933};
1934
1935
1936/**
1937 * Simple function applications
1938 */
1939cvox.SemanticTreeTest.prototype.testStreeSimpleFuncsSingle = function() {
1940  this.brief = true;
1941  this.executeTreeTest(
1942      '<mrow><mi>f</mi></mrow>',
1943      '<identifier>f</identifier>');
1944
1945  this.executeTreeTest(
1946      '<mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo></mrow>',
1947      '<appl>' +
1948      '<content>' +
1949      '<punctuation>\u2061</punctuation>' +
1950      '</content>' +
1951      '<children>' +
1952      '<identifier>f</identifier>' +
1953      '<fenced>' +
1954      '<content>' +
1955      '<fence>(</fence>' +
1956      '<fence>)</fence>' +
1957      '</content>' +
1958      '<children>' +
1959      '<identifier>x</identifier>' +
1960      '</children>' +
1961      '</fenced>' +
1962      '</children>' +
1963      '</appl>');
1964
1965  this.executeTreeTest(
1966      '<mrow><mi>f</mi><mo>(</mo><mi>x</mi><mi>y</mi><mo>)</mo></mrow>',
1967      '<appl>' +
1968      '<content>' +
1969      '<punctuation>\u2061</punctuation>' +
1970      '</content>' +
1971      '<children>' +
1972      '<identifier>f</identifier>' +
1973      '<fenced>' +
1974      '<content>' +
1975      '<fence>(</fence>' +
1976      '<fence>)</fence>' +
1977      '</content>' +
1978      '<children>' +
1979      '<infixop>\u2062' +
1980      '<content>' +
1981      '<operator>\u2062</operator>' +
1982      '</content>' +
1983      '<children>' +
1984      '<identifier>x</identifier>' +
1985      '<identifier>y</identifier>' +
1986      '</children>' +
1987      '</infixop>' +
1988      '</children>' +
1989      '</fenced>' +
1990      '</children>' +
1991      '</appl>');
1992
1993  this.executeTreeTest(
1994      '<mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>,</mo><mi>y</mi>' +
1995      '<mo>,</mo><mi>z</mi><mo>)</mo></mrow>',
1996      '<appl>' +
1997      '<content>' +
1998      '<punctuation>\u2061</punctuation>' +
1999      '</content>' +
2000      '<children>' +
2001      '<identifier>f</identifier>' +
2002      '<fenced>' +
2003      '<content>' +
2004      '<fence>(</fence>' +
2005      '<fence>)</fence>' +
2006      '</content>' +
2007      '<children>' +
2008      '<punctuated>' +
2009      '<content>' +
2010      '<punctuation>,</punctuation>' +
2011      '<punctuation>,</punctuation>' +
2012      '</content>' +
2013      '<children>' +
2014      '<identifier>x</identifier>' +
2015      '<punctuation>,</punctuation>' +
2016      '<identifier>y</identifier>' +
2017      '<punctuation>,</punctuation>' +
2018      '<identifier>z</identifier>' +
2019      '</children>' +
2020      '</punctuated>' +
2021      '</children>' +
2022      '</fenced>' +
2023      '</children>' +
2024      '</appl>');
2025
2026  this.executeTreeTest(
2027      '<mrow><mi>f</mi><mo>(</mo><msup><mi>x</mi><mn>2</mn></msup>' +
2028      '<mo>)</mo></mrow>',
2029      '<appl>' +
2030      '<content>' +
2031      '<punctuation>\u2061</punctuation>' +
2032      '</content>' +
2033      '<children>' +
2034      '<identifier>f</identifier>' +
2035      '<fenced>' +
2036      '<content>' +
2037      '<fence>(</fence>' +
2038      '<fence>)</fence>' +
2039      '</content>' +
2040      '<children>' +
2041      '<superscript>' +
2042      '<children>' +
2043      '<identifier>x</identifier>' +
2044      '<number>2</number>' +
2045      '</children>' +
2046      '</superscript>' +
2047      '</children>' +
2048      '</fenced>' +
2049      '</children>' +
2050      '</appl>');
2051
2052  this.executeTreeTest(
2053      '<mrow><mi>f</mi><mo>(</mo><msub><mi>x</mi><mn>2</mn></msub>' +
2054      '<mo>)</mo></mrow>',
2055      '<appl>' +
2056      '<content>' +
2057      '<punctuation>\u2061</punctuation>' +
2058      '</content>' +
2059      '<children>' +
2060      '<identifier>f</identifier>' +
2061      '<fenced>' +
2062      '<content>' +
2063      '<fence>(</fence>' +
2064      '<fence>)</fence>' +
2065      '</content>' +
2066      '<children>' +
2067      '<subscript>' +
2068      '<children>' +
2069      '<identifier>x</identifier>' +
2070      '<number>2</number>' +
2071      '</children>' +
2072      '</subscript>' +
2073      '</children>' +
2074      '</fenced>' +
2075      '</children>' +
2076      '</appl>');
2077
2078  this.executeTreeTest(
2079      '<mrow><mi>f</mi><mo>(</mo><msubsup><mi>x</mi><mn>2</mn>' +
2080      '<mn>1</mn></msubsup><mo>)</mo></mrow>',
2081      '<appl>' +
2082      '<content>' +
2083      '<punctuation>\u2061</punctuation>' +
2084      '</content>' +
2085      '<children>' +
2086      '<identifier>f</identifier>' +
2087      '<fenced>' +
2088      '<content>' +
2089      '<fence>(</fence>' +
2090      '<fence>)</fence>' +
2091      '</content>' +
2092      '<children>' +
2093      '<superscript>' +
2094      '<children>' +
2095      '<subscript>' +
2096      '<children>' +
2097      '<identifier>x</identifier>' +
2098      '<number>2</number>' +
2099      '</children>' +
2100      '</subscript>' +
2101      '<number>1</number>' +
2102      '</children>' +
2103      '</superscript>' +
2104      '</children>' +
2105      '</fenced>' +
2106      '</children>' +
2107      '</appl>');
2108
2109  this.executeTreeTest(
2110      '<mrow><mi>f</mi><mo>(</mo><mover><mi>x</mi><mn>2</mn></mover>' +
2111      '<mo>)</mo></mrow>',
2112      '<appl>' +
2113      '<content>' +
2114      '<punctuation>\u2061</punctuation>' +
2115      '</content>' +
2116      '<children>' +
2117      '<identifier>f</identifier>' +
2118      '<fenced>' +
2119      '<content>' +
2120      '<fence>(</fence>' +
2121      '<fence>)</fence>' +
2122      '</content>' +
2123      '<children>' +
2124      '<overscore>' +
2125      '<children>' +
2126      '<identifier>x</identifier>' +
2127      '<number>2</number>' +
2128      '</children>' +
2129      '</overscore>' +
2130      '</children>' +
2131      '</fenced>' +
2132      '</children>' +
2133      '</appl>');
2134
2135  this.executeTreeTest(
2136      '<mrow><mi>f</mi><mo>(</mo><munder><mi>x</mi><mn>2</mn></munder>' +
2137      '<mo>)</mo></mrow>',
2138      '<appl>' +
2139      '<content>' +
2140      '<punctuation>\u2061</punctuation>' +
2141      '</content>' +
2142      '<children>' +
2143      '<identifier>f</identifier>' +
2144      '<fenced>' +
2145      '<content>' +
2146      '<fence>(</fence>' +
2147      '<fence>)</fence>' +
2148      '</content>' +
2149      '<children>' +
2150      '<underscore>' +
2151      '<children>' +
2152      '<identifier>x</identifier>' +
2153      '<number>2</number>' +
2154      '</children>' +
2155      '</underscore>' +
2156      '</children>' +
2157      '</fenced>' +
2158      '</children>' +
2159      '</appl>');
2160
2161  this.executeTreeTest(
2162      '<mrow><mi>f</mi><mo>(</mo><munderover><mi>x</mi><mn>2</mn>' +
2163      '<mn>1</mn></munderover><mo>)</mo></mrow>',
2164      '<appl>' +
2165      '<content>' +
2166      '<punctuation>\u2061</punctuation>' +
2167      '</content>' +
2168      '<children>' +
2169      '<identifier>f</identifier>' +
2170      '<fenced>' +
2171      '<content>' +
2172      '<fence>(</fence>' +
2173      '<fence>)</fence>' +
2174      '</content>' +
2175      '<children>' +
2176      '<overscore>' +
2177      '<children>' +
2178      '<underscore>' +
2179      '<children>' +
2180      '<identifier>x</identifier>' +
2181      '<number>2</number>' +
2182      '</children>' +
2183      '</underscore>' +
2184      '<number>1</number>' +
2185      '</children>' +
2186      '</overscore>' +
2187      '</children>' +
2188      '</fenced>' +
2189      '</children>' +
2190      '</appl>');
2191
2192  this.executeTreeTest(
2193      '<mrow><mi>f</mi><mo>(</mo><mfrac><mn>1</mn><mn>2</mn></mfrac>' +
2194      '<mo>)</mo></mrow>',
2195      '<appl>' +
2196      '<content>' +
2197      '<punctuation>\u2061</punctuation>' +
2198      '</content>' +
2199      '<children>' +
2200      '<identifier>f</identifier>' +
2201      '<fenced>' +
2202      '<content>' +
2203      '<fence>(</fence>' +
2204      '<fence>)</fence>' +
2205      '</content>' +
2206      '<children>' +
2207      '<fraction>' +
2208      '<children>' +
2209      '<number>1</number>' +
2210      '<number>2</number>' +
2211      '</children>' +
2212      '</fraction>' +
2213      '</children>' +
2214      '</fenced>' +
2215      '</children>' +
2216      '</appl>');
2217
2218  this.executeTreeTest(
2219      '<mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>+</mo><mi>y</mi>' +
2220      '<mo>)</mo></mrow>',
2221      '<infixop>\u2062' +
2222      '<content>' +
2223      '<operator>\u2062</operator>' +
2224      '</content>' +
2225      '<children>' +
2226      '<identifier>f</identifier>' +
2227      '<fenced>' +
2228      '<content>' +
2229      '<fence>(</fence>' +
2230      '<fence>)</fence>' +
2231      '</content>' +
2232      '<children>' +
2233      '<infixop>+' +
2234      '<content>' +
2235      '<operator>+</operator>' +
2236      '</content>' +
2237      '<children>' +
2238      '<identifier>x</identifier>' +
2239      '<identifier>y</identifier>' +
2240      '</children>' +
2241      '</infixop>' +
2242      '</children>' +
2243      '</fenced>' +
2244      '</children>' +
2245      '</infixop>');
2246};
2247
2248
2249/**
2250 * Simple functions with surrounding operators.
2251 */
2252cvox.SemanticTreeTest.prototype.testStreeSimpleFuncsWithOps = function() {
2253  this.brief = true;
2254  this.executeTreeTest(
2255      '<mrow><mn>1</mn><mo>+</mo><mi>f</mi><mo>(</mo><mi>x</mi>' +
2256      '<mo>)</mo></mrow>',
2257      '<infixop>+' +
2258      '<content>' +
2259      '<operator>+</operator>' +
2260      '</content>' +
2261      '<children>' +
2262      '<number>1</number>' +
2263      '<appl>' +
2264      '<content>' +
2265      '<punctuation>\u2061</punctuation>' +
2266      '</content>' +
2267      '<children>' +
2268      '<identifier>f</identifier>' +
2269      '<fenced>' +
2270      '<content>' +
2271      '<fence>(</fence>' +
2272      '<fence>)</fence>' +
2273      '</content>' +
2274      '<children>' +
2275      '<identifier>x</identifier>' +
2276      '</children>' +
2277      '</fenced>' +
2278      '</children>' +
2279      '</appl>' +
2280      '</children>' +
2281      '</infixop>');
2282
2283  this.executeTreeTest(
2284      '<mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>+</mo>' +
2285      '<mn>2</mn></mrow>',
2286      '<infixop>+' +
2287      '<content>' +
2288      '<operator>+</operator>' +
2289      '</content>' +
2290      '<children>' +
2291      '<appl>' +
2292      '<content>' +
2293      '<punctuation>\u2061</punctuation>' +
2294      '</content>' +
2295      '<children>' +
2296      '<identifier>f</identifier>' +
2297      '<fenced>' +
2298      '<content>' +
2299      '<fence>(</fence>' +
2300      '<fence>)</fence>' +
2301      '</content>' +
2302      '<children>' +
2303      '<identifier>x</identifier>' +
2304      '</children>' +
2305      '</fenced>' +
2306      '</children>' +
2307      '</appl>' +
2308      '<number>2</number>' +
2309      '</children>' +
2310      '</infixop>');
2311
2312  this.executeTreeTest(
2313      '<mrow><mn>1</mn><mo>+</mo><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo>' +
2314      '<mo>+</mo><mn>2</mn></mrow>',
2315      '<infixop>+' +
2316      '<content>' +
2317      '<operator>+</operator>' +
2318      '<operator>+</operator>' +
2319      '</content>' +
2320      '<children>' +
2321      '<number>1</number>' +
2322      '<appl>' +
2323      '<content>' +
2324      '<punctuation>\u2061</punctuation>' +
2325      '</content>' +
2326      '<children>' +
2327      '<identifier>f</identifier>' +
2328      '<fenced>' +
2329      '<content>' +
2330      '<fence>(</fence>' +
2331      '<fence>)</fence>' +
2332      '</content>' +
2333      '<children>' +
2334      '<identifier>x</identifier>' +
2335      '</children>' +
2336      '</fenced>' +
2337      '</children>' +
2338      '</appl>' +
2339      '<number>2</number>' +
2340      '</children>' +
2341      '</infixop>');
2342
2343  this.executeTreeTest(
2344      '<mrow><mo>a</mo><mo>+</mo><mi>f</mi><mo>(</mo><mi>x</mi>' +
2345      '<mo>)</mo></mrow>',
2346      '<infixop>+' +
2347      '<content>' +
2348      '<operator>+</operator>' +
2349      '</content>' +
2350      '<children>' +
2351      '<identifier>a</identifier>' +
2352      '<appl>' +
2353      '<content>' +
2354      '<punctuation>\u2061</punctuation>' +
2355      '</content>' +
2356      '<children>' +
2357      '<identifier>f</identifier>' +
2358      '<fenced>' +
2359      '<content>' +
2360      '<fence>(</fence>' +
2361      '<fence>)</fence>' +
2362      '</content>' +
2363      '<children>' +
2364      '<identifier>x</identifier>' +
2365      '</children>' +
2366      '</fenced>' +
2367      '</children>' +
2368      '</appl>' +
2369      '</children>' +
2370      '</infixop>');
2371
2372  this.executeTreeTest(
2373      '<mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>+</mo>' +
2374      '<mo>b</mo></mrow>',
2375      '<infixop>+' +
2376      '<content>' +
2377      '<operator>+</operator>' +
2378      '</content>' +
2379      '<children>' +
2380      '<appl>' +
2381      '<content>' +
2382      '<punctuation>\u2061</punctuation>' +
2383      '</content>' +
2384      '<children>' +
2385      '<identifier>f</identifier>' +
2386      '<fenced>' +
2387      '<content>' +
2388      '<fence>(</fence>' +
2389      '<fence>)</fence>' +
2390      '</content>' +
2391      '<children>' +
2392      '<identifier>x</identifier>' +
2393      '</children>' +
2394      '</fenced>' +
2395      '</children>' +
2396      '</appl>' +
2397      '<identifier>b</identifier>' +
2398      '</children>' +
2399      '</infixop>');
2400
2401  this.executeTreeTest(
2402      '<mrow><mo>a</mo><mo>+</mo><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo>' +
2403      '<mo>+</mo><mo>b</mo></mrow>',
2404      '<infixop>+' +
2405      '<content>' +
2406      '<operator>+</operator>' +
2407      '<operator>+</operator>' +
2408      '</content>' +
2409      '<children>' +
2410      '<identifier>a</identifier>' +
2411      '<appl>' +
2412      '<content>' +
2413      '<punctuation>\u2061</punctuation>' +
2414      '</content>' +
2415      '<children>' +
2416      '<identifier>f</identifier>' +
2417      '<fenced>' +
2418      '<content>' +
2419      '<fence>(</fence>' +
2420      '<fence>)</fence>' +
2421      '</content>' +
2422      '<children>' +
2423      '<identifier>x</identifier>' +
2424      '</children>' +
2425      '</fenced>' +
2426      '</children>' +
2427      '</appl>' +
2428      '<identifier>b</identifier>' +
2429      '</children>' +
2430      '</infixop>');
2431
2432  this.executeTreeTest(
2433      '<mrow><mo>a</mo><mo>=</mo><mi>f</mi><mo>(</mo><mi>x</mi>' +
2434      '<mo>)</mo></mrow>',
2435      '<relseq>=' +
2436      '<content>' +
2437      '<relation>=</relation>' +
2438      '</content>' +
2439      '<children>' +
2440      '<identifier>a</identifier>' +
2441      '<appl>' +
2442      '<content>' +
2443      '<punctuation>\u2061</punctuation>' +
2444      '</content>' +
2445      '<children>' +
2446      '<identifier>f</identifier>' +
2447      '<fenced>' +
2448      '<content>' +
2449      '<fence>(</fence>' +
2450      '<fence>)</fence>' +
2451      '</content>' +
2452      '<children>' +
2453      '<identifier>x</identifier>' +
2454      '</children>' +
2455      '</fenced>' +
2456      '</children>' +
2457      '</appl>' +
2458      '</children>' +
2459      '</relseq>');
2460
2461  this.executeTreeTest(
2462      '<mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>=</mo>' +
2463      '<mo>b</mo></mrow>',
2464      '<relseq>=' +
2465      '<content>' +
2466      '<relation>=</relation>' +
2467      '</content>' +
2468      '<children>' +
2469      '<appl>' +
2470      '<content>' +
2471      '<punctuation>\u2061</punctuation>' +
2472      '</content>' +
2473      '<children>' +
2474      '<identifier>f</identifier>' +
2475      '<fenced>' +
2476      '<content>' +
2477      '<fence>(</fence>' +
2478      '<fence>)</fence>' +
2479      '</content>' +
2480      '<children>' +
2481      '<identifier>x</identifier>' +
2482      '</children>' +
2483      '</fenced>' +
2484      '</children>' +
2485      '</appl>' +
2486      '<identifier>b</identifier>' +
2487      '</children>' +
2488      '</relseq>');
2489
2490  this.executeTreeTest(
2491      '<mrow><mo>a</mo><mo>=</mo><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo>' +
2492      '<mo>=</mo><mo>b</mo></mrow>',
2493      '<relseq>=' +
2494      '<content>' +
2495      '<relation>=</relation>' +
2496      '<relation>=</relation>' +
2497      '</content>' +
2498      '<children>' +
2499      '<identifier>a</identifier>' +
2500      '<appl>' +
2501      '<content>' +
2502      '<punctuation>\u2061</punctuation>' +
2503      '</content>' +
2504      '<children>' +
2505      '<identifier>f</identifier>' +
2506      '<fenced>' +
2507      '<content>' +
2508      '<fence>(</fence>' +
2509      '<fence>)</fence>' +
2510      '</content>' +
2511      '<children>' +
2512      '<identifier>x</identifier>' +
2513      '</children>' +
2514      '</fenced>' +
2515      '</children>' +
2516      '</appl>' +
2517      '<identifier>b</identifier>' +
2518      '</children>' +
2519      '</relseq>');
2520};
2521
2522
2523/**
2524 * Multiple simple functions.
2525 */
2526cvox.SemanticTreeTest.prototype.testStreeSimpleFuncsMulti = function() {
2527  this.brief = true;
2528  this.executeTreeTest(
2529      '<mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>+</mo><mi>g</mi>' +
2530      '<mo>(</mo><mi>x</mi><mo>)</mo></mrow>',
2531      '<infixop>+' +
2532      '<content>' +
2533      '<operator>+</operator>' +
2534      '</content>' +
2535      '<children>' +
2536      '<appl>' +
2537      '<content>' +
2538      '<punctuation>\u2061</punctuation>' +
2539      '</content>' +
2540      '<children>' +
2541      '<identifier>f</identifier>' +
2542      '<fenced>' +
2543      '<content>' +
2544      '<fence>(</fence>' +
2545      '<fence>)</fence>' +
2546      '</content>' +
2547      '<children>' +
2548      '<identifier>x</identifier>' +
2549      '</children>' +
2550      '</fenced>' +
2551      '</children>' +
2552      '</appl>' +
2553      '<appl>' +
2554      '<content>' +
2555      '<punctuation>\u2061</punctuation>' +
2556      '</content>' +
2557      '<children>' +
2558      '<identifier>g</identifier>' +
2559      '<fenced>' +
2560      '<content>' +
2561      '<fence>(</fence>' +
2562      '<fence>)</fence>' +
2563      '</content>' +
2564      '<children>' +
2565      '<identifier>x</identifier>' +
2566      '</children>' +
2567      '</fenced>' +
2568      '</children>' +
2569      '</appl>' +
2570      '</children>' +
2571      '</infixop>');
2572
2573  this.executeTreeTest(
2574      '<mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>+</mo><mi>g</mi>' +
2575      '<mo>(</mo><mi>x</mi><mo>)</mo><mo>=</mo><mi>h</mi><mo>(</mo>' +
2576      '<mi>x</mi><mo>)</mo></mrow>',
2577      '<relseq>=' +
2578      '<content>' +
2579      '<relation>=</relation>' +
2580      '</content>' +
2581      '<children>' +
2582      '<infixop>+' +
2583      '<content>' +
2584      '<operator>+</operator>' +
2585      '</content>' +
2586      '<children>' +
2587      '<appl>' +
2588      '<content>' +
2589      '<punctuation>\u2061</punctuation>' +
2590      '</content>' +
2591      '<children>' +
2592      '<identifier>f</identifier>' +
2593      '<fenced>' +
2594      '<content>' +
2595      '<fence>(</fence>' +
2596      '<fence>)</fence>' +
2597      '</content>' +
2598      '<children>' +
2599      '<identifier>x</identifier>' +
2600      '</children>' +
2601      '</fenced>' +
2602      '</children>' +
2603      '</appl>' +
2604      '<appl>' +
2605      '<content>' +
2606      '<punctuation>\u2061</punctuation>' +
2607      '</content>' +
2608      '<children>' +
2609      '<identifier>g</identifier>' +
2610      '<fenced>' +
2611      '<content>' +
2612      '<fence>(</fence>' +
2613      '<fence>)</fence>' +
2614      '</content>' +
2615      '<children>' +
2616      '<identifier>x</identifier>' +
2617      '</children>' +
2618      '</fenced>' +
2619      '</children>' +
2620      '</appl>' +
2621      '</children>' +
2622      '</infixop>' +
2623      '<appl>' +
2624      '<content>' +
2625      '<punctuation>\u2061</punctuation>' +
2626      '</content>' +
2627      '<children>' +
2628      '<identifier>h</identifier>' +
2629      '<fenced>' +
2630      '<content>' +
2631      '<fence>(</fence>' +
2632      '<fence>)</fence>' +
2633      '</content>' +
2634      '<children>' +
2635      '<identifier>x</identifier>' +
2636      '</children>' +
2637      '</fenced>' +
2638      '</children>' +
2639      '</appl>' +
2640      '</children>' +
2641      '</relseq>');
2642
2643  this.executeTreeTest(
2644      '<mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>+</mo><mi>g</mi>' +
2645      '<mo>(</mo><mi>y</mi><mo>)</mo><mo>=</mo><mi>h</mi><mo>(</mo>' +
2646      '<mi>x</mi><mi>y</mi><mo>)</mo></mrow>',
2647      '<relseq>=' +
2648      '<content>' +
2649      '<relation>=</relation>' +
2650      '</content>' +
2651      '<children>' +
2652      '<infixop>+' +
2653      '<content>' +
2654      '<operator>+</operator>' +
2655      '</content>' +
2656      '<children>' +
2657      '<appl>' +
2658      '<content>' +
2659      '<punctuation>\u2061</punctuation>' +
2660      '</content>' +
2661      '<children>' +
2662      '<identifier>f</identifier>' +
2663      '<fenced>' +
2664      '<content>' +
2665      '<fence>(</fence>' +
2666      '<fence>)</fence>' +
2667      '</content>' +
2668      '<children>' +
2669      '<identifier>x</identifier>' +
2670      '</children>' +
2671      '</fenced>' +
2672      '</children>' +
2673      '</appl>' +
2674      '<appl>' +
2675      '<content>' +
2676      '<punctuation>\u2061</punctuation>' +
2677      '</content>' +
2678      '<children>' +
2679      '<identifier>g</identifier>' +
2680      '<fenced>' +
2681      '<content>' +
2682      '<fence>(</fence>' +
2683      '<fence>)</fence>' +
2684      '</content>' +
2685      '<children>' +
2686      '<identifier>y</identifier>' +
2687      '</children>' +
2688      '</fenced>' +
2689      '</children>' +
2690      '</appl>' +
2691      '</children>' +
2692      '</infixop>' +
2693      '<appl>' +
2694      '<content>' +
2695      '<punctuation>\u2061</punctuation>' +
2696      '</content>' +
2697      '<children>' +
2698      '<identifier>h</identifier>' +
2699      '<fenced>' +
2700      '<content>' +
2701      '<fence>(</fence>' +
2702      '<fence>)</fence>' +
2703      '</content>' +
2704      '<children>' +
2705      '<infixop>\u2062' +
2706      '<content>' +
2707      '<operator>\u2062</operator>' +
2708      '</content>' +
2709      '<children>' +
2710      '<identifier>x</identifier>' +
2711      '<identifier>y</identifier>' +
2712      '</children>' +
2713      '</infixop>' +
2714      '</children>' +
2715      '</fenced>' +
2716      '</children>' +
2717      '</appl>' +
2718      '</children>' +
2719      '</relseq>');
2720};
2721
2722
2723/**
2724 * Nested simple functions.
2725 */
2726cvox.SemanticTreeTest.prototype.testStreeSimpleFuncsNested = function() {
2727  this.brief = true;
2728  this.executeTreeTest(
2729      '<mrow><mi>g</mi><mo>(</mo><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo>' +
2730      '<mo>)</mo></mrow>',
2731      '<appl>' +
2732      '<content>' +
2733      '<punctuation>\u2061</punctuation>' +
2734      '</content>' +
2735      '<children>' +
2736      '<identifier>g</identifier>' +
2737      '<fenced>' +
2738      '<content>' +
2739      '<fence>(</fence>' +
2740      '<fence>)</fence>' +
2741      '</content>' +
2742      '<children>' +
2743      '<appl>' +
2744      '<content>' +
2745      '<punctuation>\u2061</punctuation>' +
2746      '</content>' +
2747      '<children>' +
2748      '<identifier>f</identifier>' +
2749      '<fenced>' +
2750      '<content>' +
2751      '<fence>(</fence>' +
2752      '<fence>)</fence>' +
2753      '</content>' +
2754      '<children>' +
2755      '<identifier>x</identifier>' +
2756      '</children>' +
2757      '</fenced>' +
2758      '</children>' +
2759      '</appl>' +
2760      '</children>' +
2761      '</fenced>' +
2762      '</children>' +
2763      '</appl>');
2764
2765  this.executeTreeTest(
2766      '<mrow><mi>h</mi><mo>(</mo><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo>' +
2767      '<mi>g</mi><mo>(</mo><mi>y</mi><mo>)</mo><mo>)</mo></mrow>',
2768      '<appl>' +
2769      '<content>' +
2770      '<punctuation>\u2061</punctuation>' +
2771      '</content>' +
2772      '<children>' +
2773      '<identifier>h</identifier>' +
2774      '<fenced>' +
2775      '<content>' +
2776      '<fence>(</fence>' +
2777      '<fence>)</fence>' +
2778      '</content>' +
2779      '<children>' +
2780      '<infixop>\u2062' +
2781      '<content>' +
2782      '<operator>\u2062</operator>' +
2783      '</content>' +
2784      '<children>' +
2785      '<appl>' +
2786      '<content>' +
2787      '<punctuation>\u2061</punctuation>' +
2788      '</content>' +
2789      '<children>' +
2790      '<identifier>f</identifier>' +
2791      '<fenced>' +
2792      '<content>' +
2793      '<fence>(</fence>' +
2794      '<fence>)</fence>' +
2795      '</content>' +
2796      '<children>' +
2797      '<identifier>x</identifier>' +
2798      '</children>' +
2799      '</fenced>' +
2800      '</children>' +
2801      '</appl>' +
2802      '<appl>' +
2803      '<content>' +
2804      '<punctuation>\u2061</punctuation>' +
2805      '</content>' +
2806      '<children>' +
2807      '<identifier>g</identifier>' +
2808      '<fenced>' +
2809      '<content>' +
2810      '<fence>(</fence>' +
2811      '<fence>)</fence>' +
2812      '</content>' +
2813      '<children>' +
2814      '<identifier>y</identifier>' +
2815      '</children>' +
2816      '</fenced>' +
2817      '</children>' +
2818      '</appl>' +
2819      '</children>' +
2820      '</infixop>' +
2821      '</children>' +
2822      '</fenced>' +
2823      '</children>' +
2824      '</appl>');
2825
2826  this.executeTreeTest(
2827      '<mrow><mi>h</mi><mo>(</mo><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo>' +
2828      '<mo>+</mo><mi>g</mi><mo>(</mo><mi>y</mi><mo>)</mo><mo>)</mo></mrow>',
2829      '<infixop>\u2062' +
2830      '<content>' +
2831      '<operator>\u2062</operator>' +
2832      '</content>' +
2833      '<children>' +
2834      '<identifier>h</identifier>' +
2835      '<fenced>' +
2836      '<content>' +
2837      '<fence>(</fence>' +
2838      '<fence>)</fence>' +
2839      '</content>' +
2840      '<children>' +
2841      '<infixop>+' +
2842      '<content>' +
2843      '<operator>+</operator>' +
2844      '</content>' +
2845      '<children>' +
2846      '<appl>' +
2847      '<content>' +
2848      '<punctuation>\u2061</punctuation>' +
2849      '</content>' +
2850      '<children>' +
2851      '<identifier>f</identifier>' +
2852      '<fenced>' +
2853      '<content>' +
2854      '<fence>(</fence>' +
2855      '<fence>)</fence>' +
2856      '</content>' +
2857      '<children>' +
2858      '<identifier>x</identifier>' +
2859      '</children>' +
2860      '</fenced>' +
2861      '</children>' +
2862      '</appl>' +
2863      '<appl>' +
2864      '<content>' +
2865      '<punctuation>\u2061</punctuation>' +
2866      '</content>' +
2867      '<children>' +
2868      '<identifier>g</identifier>' +
2869      '<fenced>' +
2870      '<content>' +
2871      '<fence>(</fence>' +
2872      '<fence>)</fence>' +
2873      '</content>' +
2874      '<children>' +
2875      '<identifier>y</identifier>' +
2876      '</children>' +
2877      '</fenced>' +
2878      '</children>' +
2879      '</appl>' +
2880      '</children>' +
2881      '</infixop>' +
2882      '</children>' +
2883      '</fenced>' +
2884      '</children>' +
2885      '</infixop>');
2886
2887  this.executeTreeTest(
2888      '<mi>P</mi><mo>[</mo><mi>x</mi><mo>=</mo><mn>2</mn><mo>]</mo>',
2889      '<appl>' +
2890      '<content>' +
2891      '<punctuation>\u2061</punctuation>' +
2892      '</content>' +
2893      '<children>' +
2894      '<identifier>P</identifier>' +
2895      '<fenced>' +
2896      '<content>' +
2897      '<fence>[</fence>' +
2898      '<fence>]</fence>' +
2899      '</content>' +
2900      '<children>' +
2901      '<relseq>=' +
2902      '<content>' +
2903      '<relation>=</relation>' +
2904      '</content>' +
2905      '<children>' +
2906      '<identifier>x</identifier>' +
2907      '<number>2</number>' +
2908      '</children>' +
2909      '</relseq>' +
2910      '</children>' +
2911      '</fenced>' +
2912      '</children>' +
2913      '</appl>');
2914};
2915
2916
2917/**
2918 * Simple functions with explicit function application.
2919 */
2920cvox.SemanticTreeTest.prototype.testStreeSimpleFuncsExplicitApp = function() {
2921  this.brief = true;
2922  this.executeTreeTest(
2923      '<mi>f</mi><mo>\u2061</mo><mo>(</mo><mi>x</mi><mo>+</mo><mi>y</mi>' +
2924      '<mo>)</mo>',
2925      '<appl>' +
2926      '<content>' +
2927      '<punctuation>\u2061</punctuation>' +
2928      '</content>' +
2929      '<children>' +
2930      '<identifier>f</identifier>' +
2931      '<fenced>' +
2932      '<content>' +
2933      '<fence>(</fence>' +
2934      '<fence>)</fence>' +
2935      '</content>' +
2936      '<children>' +
2937      '<infixop>+' +
2938      '<content>' +
2939      '<operator>+</operator>' +
2940      '</content>' +
2941      '<children>' +
2942      '<identifier>x</identifier>' +
2943      '<identifier>y</identifier>' +
2944      '</children>' +
2945      '</infixop>' +
2946      '</children>' +
2947      '</fenced>' +
2948      '</children>' +
2949      '</appl>');
2950
2951  this.executeTreeTest(
2952      '<mi>f</mi><mo>\u2061</mo><mo>(</mo><mi>x</mi><mo>+</mo><mi>y</mi>' +
2953      '<mo>)</mo><mo>+</mo><mi>f</mi><mo>(</mo><mi>x</mi><mo>+</mo>' +
2954      '<mi>y</mi><mo>)</mo>',
2955      '<infixop>+' +
2956      '<content>' +
2957      '<operator>+</operator>' +
2958      '</content>' +
2959      '<children>' +
2960      '<appl>' +
2961      '<content>' +
2962      '<punctuation>\u2061</punctuation>' +
2963      '</content>' +
2964      '<children>' +
2965      '<identifier>f</identifier>' +
2966      '<fenced>' +
2967      '<content>' +
2968      '<fence>(</fence>' +
2969      '<fence>)</fence>' +
2970      '</content>' +
2971      '<children>' +
2972      '<infixop>+' +
2973      '<content>' +
2974      '<operator>+</operator>' +
2975      '</content>' +
2976      '<children>' +
2977      '<identifier>x</identifier>' +
2978      '<identifier>y</identifier>' +
2979      '</children>' +
2980      '</infixop>' +
2981      '</children>' +
2982      '</fenced>' +
2983      '</children>' +
2984      '</appl>' +
2985      '<infixop>\u2062' +
2986      '<content>' +
2987      '<operator>\u2062</operator>' +
2988      '</content>' +
2989      '<children>' +
2990      '<identifier>f</identifier>' +
2991      '<fenced>' +
2992      '<content>' +
2993      '<fence>(</fence>' +
2994      '<fence>)</fence>' +
2995      '</content>' +
2996      '<children>' +
2997      '<infixop>+' +
2998      '<content>' +
2999      '<operator>+</operator>' +
3000      '</content>' +
3001      '<children>' +
3002      '<identifier>x</identifier>' +
3003      '<identifier>y</identifier>' +
3004      '</children>' +
3005      '</infixop>' +
3006      '</children>' +
3007      '</fenced>' +
3008      '</children>' +
3009      '</infixop>' +
3010      '</children>' +
3011      '</infixop>');
3012
3013  this.executeTreeTest(
3014      '<msub><mi>f</mi><mn>1</mn></msub><mo>\u2061</mo><mo>(</mo><mi>x</mi>' +
3015      '<mo>+</mo><mi>y</mi><mo>)</mo>',
3016      '<appl>' +
3017      '<content>' +
3018      '<punctuation>\u2061</punctuation>' +
3019      '</content>' +
3020      '<children>' +
3021      '<subscript>' +
3022      '<children>' +
3023      '<identifier>f</identifier>' +
3024      '<number>1</number>' +
3025      '</children>' +
3026      '</subscript>' +
3027      '<fenced>' +
3028      '<content>' +
3029      '<fence>(</fence>' +
3030      '<fence>)</fence>' +
3031      '</content>' +
3032      '<children>' +
3033      '<infixop>+' +
3034      '<content>' +
3035      '<operator>+</operator>' +
3036      '</content>' +
3037      '<children>' +
3038      '<identifier>x</identifier>' +
3039      '<identifier>y</identifier>' +
3040      '</children>' +
3041      '</infixop>' +
3042      '</children>' +
3043      '</fenced>' +
3044      '</children>' +
3045      '</appl>');
3046
3047  this.executeTreeTest(
3048      '<msup><msub><mi>f</mi><mn>n</mn></msub><mn>2</mn></msup>' +
3049      '<mo>\u2061</mo><mo>(</mo><mi>x</mi><mo>+</mo><mi>y</mi><mo>)</mo>' +
3050      '<mo>+</mo><msup><msub><mi>f</mi><mn>m</mn></msub><mn>2</mn></msup>' +
3051      '<mo>(</mo><mi>x</mi><mo>+</mo><mi>y</mi><mo>)</mo>',
3052      '<infixop>+' +
3053      '<content>' +
3054      '<operator>+</operator>' +
3055      '</content>' +
3056      '<children>' +
3057      '<appl>' +
3058      '<content>' +
3059      '<punctuation>\u2061</punctuation>' +
3060      '</content>' +
3061      '<children>' +
3062      '<superscript>' +
3063      '<children>' +
3064      '<subscript>' +
3065      '<children>' +
3066      '<identifier>f</identifier>' +
3067      '<identifier>n</identifier>' +
3068      '</children>' +
3069      '</subscript>' +
3070      '<number>2</number>' +
3071      '</children>' +
3072      '</superscript>' +
3073      '<fenced>' +
3074      '<content>' +
3075      '<fence>(</fence>' +
3076      '<fence>)</fence>' +
3077      '</content>' +
3078      '<children>' +
3079      '<infixop>+' +
3080      '<content>' +
3081      '<operator>+</operator>' +
3082      '</content>' +
3083      '<children>' +
3084      '<identifier>x</identifier>' +
3085      '<identifier>y</identifier>' +
3086      '</children>' +
3087      '</infixop>' +
3088      '</children>' +
3089      '</fenced>' +
3090      '</children>' +
3091      '</appl>' +
3092      '<infixop>\u2062' +
3093      '<content>' +
3094      '<operator>\u2062</operator>' +
3095      '</content>' +
3096      '<children>' +
3097      '<superscript>' +
3098      '<children>' +
3099      '<subscript>' +
3100      '<children>' +
3101      '<identifier>f</identifier>' +
3102      '<identifier>m</identifier>' +
3103      '</children>' +
3104      '</subscript>' +
3105      '<number>2</number>' +
3106      '</children>' +
3107      '</superscript>' +
3108      '<fenced>' +
3109      '<content>' +
3110      '<fence>(</fence>' +
3111      '<fence>)</fence>' +
3112      '</content>' +
3113      '<children>' +
3114      '<infixop>+' +
3115      '<content>' +
3116      '<operator>+</operator>' +
3117      '</content>' +
3118      '<children>' +
3119      '<identifier>x</identifier>' +
3120      '<identifier>y</identifier>' +
3121      '</children>' +
3122      '</infixop>' +
3123      '</children>' +
3124      '</fenced>' +
3125      '</children>' +
3126      '</infixop>' +
3127      '</children>' +
3128      '</infixop>');
3129};
3130
3131
3132/**
3133 * Prefix function applications
3134 */
3135cvox.SemanticTreeTest.prototype.testStreePrefixFuncsSingle = function() {
3136  this.brief = true;
3137  this.executeTreeTest(
3138      '<mrow><mi>sin</mi><mo>(</mo><mi>x</mi><mo>)</mo></mrow>',
3139      '<appl>' +
3140      '<content>' +
3141      '<punctuation>\u2061</punctuation>' +
3142      '</content>' +
3143      '<children>' +
3144      '<function>sin</function>' +
3145      '<fenced>' +
3146      '<content>' +
3147      '<fence>(</fence>' +
3148      '<fence>)</fence>' +
3149      '</content>' +
3150      '<children>' +
3151      '<identifier>x</identifier>' +
3152      '</children>' +
3153      '</fenced>' +
3154      '</children>' +
3155      '</appl>');
3156
3157  this.executeTreeTest(
3158      '<mrow><mi>sin</mi><mo>(</mo><mi>x</mi><mi>y</mi><mo>)</mo></mrow>',
3159      '<appl>' +
3160      '<content>' +
3161      '<punctuation>\u2061</punctuation>' +
3162      '</content>' +
3163      '<children>' +
3164      '<function>sin</function>' +
3165      '<fenced>' +
3166      '<content>' +
3167      '<fence>(</fence>' +
3168      '<fence>)</fence>' +
3169      '</content>' +
3170      '<children>' +
3171      '<infixop>\u2062' +
3172      '<content>' +
3173      '<operator>\u2062</operator>' +
3174      '</content>' +
3175      '<children>' +
3176      '<identifier>x</identifier>' +
3177      '<identifier>y</identifier>' +
3178      '</children>' +
3179      '</infixop>' +
3180      '</children>' +
3181      '</fenced>' +
3182      '</children>' +
3183      '</appl>');
3184
3185  this.executeTreeTest(
3186      '<mrow><mi>sin</mi><mo>(</mo><msup><mi>x</mi><mn>2</mn></msup>' +
3187      '<mo>)</mo></mrow>',
3188      '<appl>' +
3189      '<content>' +
3190      '<punctuation>\u2061</punctuation>' +
3191      '</content>' +
3192      '<children>' +
3193      '<function>sin</function>' +
3194      '<fenced>' +
3195      '<content>' +
3196      '<fence>(</fence>' +
3197      '<fence>)</fence>' +
3198      '</content>' +
3199      '<children>' +
3200      '<superscript>' +
3201      '<children>' +
3202      '<identifier>x</identifier>' +
3203      '<number>2</number>' +
3204      '</children>' +
3205      '</superscript>' +
3206      '</children>' +
3207      '</fenced>' +
3208      '</children>' +
3209      '</appl>');
3210
3211  this.executeTreeTest(
3212      '<mrow><mi>sin</mi><mo>(</mo><msub><mi>x</mi><mn>2</mn></msub>' +
3213      '<mo>)</mo></mrow>',
3214      '<appl>' +
3215      '<content>' +
3216      '<punctuation>\u2061</punctuation>' +
3217      '</content>' +
3218      '<children>' +
3219      '<function>sin</function>' +
3220      '<fenced>' +
3221      '<content>' +
3222      '<fence>(</fence>' +
3223      '<fence>)</fence>' +
3224      '</content>' +
3225      '<children>' +
3226      '<subscript>' +
3227      '<children>' +
3228      '<identifier>x</identifier>' +
3229      '<number>2</number>' +
3230      '</children>' +
3231      '</subscript>' +
3232      '</children>' +
3233      '</fenced>' +
3234      '</children>' +
3235      '</appl>');
3236
3237  this.executeTreeTest(
3238      '<mrow><mi>sin</mi><mo>(</mo><msubsup><mi>x</mi><mn>2</mn>' +
3239      '<mn>1</mn></msubsup><mo>)</mo></mrow>',
3240      '<appl>' +
3241      '<content>' +
3242      '<punctuation>\u2061</punctuation>' +
3243      '</content>' +
3244      '<children>' +
3245      '<function>sin</function>' +
3246      '<fenced>' +
3247      '<content>' +
3248      '<fence>(</fence>' +
3249      '<fence>)</fence>' +
3250      '</content>' +
3251      '<children>' +
3252      '<superscript>' +
3253      '<children>' +
3254      '<subscript>' +
3255      '<children>' +
3256      '<identifier>x</identifier>' +
3257      '<number>2</number>' +
3258      '</children>' +
3259      '</subscript>' +
3260      '<number>1</number>' +
3261      '</children>' +
3262      '</superscript>' +
3263      '</children>' +
3264      '</fenced>' +
3265      '</children>' +
3266      '</appl>');
3267
3268  this.executeTreeTest(
3269      '<mrow><mi>sin</mi><mo>(</mo><mover><mi>x</mi><mn>2</mn></mover>' +
3270      '<mo>)</mo></mrow>',
3271      '<appl>' +
3272      '<content>' +
3273      '<punctuation>\u2061</punctuation>' +
3274      '</content>' +
3275      '<children>' +
3276      '<function>sin</function>' +
3277      '<fenced>' +
3278      '<content>' +
3279      '<fence>(</fence>' +
3280      '<fence>)</fence>' +
3281      '</content>' +
3282      '<children>' +
3283      '<overscore>' +
3284      '<children>' +
3285      '<identifier>x</identifier>' +
3286      '<number>2</number>' +
3287      '</children>' +
3288      '</overscore>' +
3289      '</children>' +
3290      '</fenced>' +
3291      '</children>' +
3292      '</appl>');
3293
3294  this.executeTreeTest(
3295      '<mrow><mi>sin</mi><mo>(</mo><munder><mi>x</mi><mn>2</mn></munder>' +
3296      '<mo>)</mo></mrow>',
3297      '<appl>' +
3298      '<content>' +
3299      '<punctuation>\u2061</punctuation>' +
3300      '</content>' +
3301      '<children>' +
3302      '<function>sin</function>' +
3303      '<fenced>' +
3304      '<content>' +
3305      '<fence>(</fence>' +
3306      '<fence>)</fence>' +
3307      '</content>' +
3308      '<children>' +
3309      '<underscore>' +
3310      '<children>' +
3311      '<identifier>x</identifier>' +
3312      '<number>2</number>' +
3313      '</children>' +
3314      '</underscore>' +
3315      '</children>' +
3316      '</fenced>' +
3317      '</children>' +
3318      '</appl>');
3319
3320  this.executeTreeTest(
3321      '<mrow><mi>sin</mi><mo>(</mo><munderover><mi>x</mi><mn>2</mn>' +
3322      '<mn>1</mn></munderover><mo>)</mo></mrow>',
3323      '<appl>' +
3324      '<content>' +
3325      '<punctuation>\u2061</punctuation>' +
3326      '</content>' +
3327      '<children>' +
3328      '<function>sin</function>' +
3329      '<fenced>' +
3330      '<content>' +
3331      '<fence>(</fence>' +
3332      '<fence>)</fence>' +
3333      '</content>' +
3334      '<children>' +
3335      '<overscore>' +
3336      '<children>' +
3337      '<underscore>' +
3338      '<children>' +
3339      '<identifier>x</identifier>' +
3340      '<number>2</number>' +
3341      '</children>' +
3342      '</underscore>' +
3343      '<number>1</number>' +
3344      '</children>' +
3345      '</overscore>' +
3346      '</children>' +
3347      '</fenced>' +
3348      '</children>' +
3349      '</appl>');
3350
3351  this.executeTreeTest(
3352      '<mrow><mi>sin</mi><mo>(</mo><mfrac><mn>1</mn><mn>2</mn></mfrac>' +
3353      '<mo>)</mo></mrow>',
3354      '<appl>' +
3355      '<content>' +
3356      '<punctuation>\u2061</punctuation>' +
3357      '</content>' +
3358      '<children>' +
3359      '<function>sin</function>' +
3360      '<fenced>' +
3361      '<content>' +
3362      '<fence>(</fence>' +
3363      '<fence>)</fence>' +
3364      '</content>' +
3365      '<children>' +
3366      '<fraction>' +
3367      '<children>' +
3368      '<number>1</number>' +
3369      '<number>2</number>' +
3370      '</children>' +
3371      '</fraction>' +
3372      '</children>' +
3373      '</fenced>' +
3374      '</children>' +
3375      '</appl>');
3376
3377  this.executeTreeTest(
3378      '<mrow><mi>sin</mi><mo>(</mo><mi>x</mi><mo>+</mo><mi>y</mi>' +
3379      '<mo>)</mo></mrow>',
3380      '<appl>' +
3381      '<content>' +
3382      '<punctuation>\u2061</punctuation>' +
3383      '</content>' +
3384      '<children>' +
3385      '<function>sin</function>' +
3386      '<fenced>' +
3387      '<content>' +
3388      '<fence>(</fence>' +
3389      '<fence>)</fence>' +
3390      '</content>' +
3391      '<children>' +
3392      '<infixop>+' +
3393      '<content>' +
3394      '<operator>+</operator>' +
3395      '</content>' +
3396      '<children>' +
3397      '<identifier>x</identifier>' +
3398      '<identifier>y</identifier>' +
3399      '</children>' +
3400      '</infixop>' +
3401      '</children>' +
3402      '</fenced>' +
3403      '</children>' +
3404      '</appl>');
3405};
3406
3407
3408/**
3409 * Prefix functions applications with surrounding operators.
3410 */
3411cvox.SemanticTreeTest.prototype.testStreePrefixFuncsWithOps = function() {
3412  this.brief = true;
3413  this.executeTreeTest(
3414      '<mrow><mn>1</mn><mo>+</mo><mi>sin</mi><mo>(</mo><mi>x</mi>' +
3415      '<mo>)</mo></mrow>',
3416      '<infixop>+' +
3417      '<content>' +
3418      '<operator>+</operator>' +
3419      '</content>' +
3420      '<children>' +
3421      '<number>1</number>' +
3422      '<appl>' +
3423      '<content>' +
3424      '<punctuation>\u2061</punctuation>' +
3425      '</content>' +
3426      '<children>' +
3427      '<function>sin</function>' +
3428      '<fenced>' +
3429      '<content>' +
3430      '<fence>(</fence>' +
3431      '<fence>)</fence>' +
3432      '</content>' +
3433      '<children>' +
3434