blob: 0f8263c004c274dd56beb3dbdfe31e2c9bc8067e [file] [log] [blame]
package org.eclipse.wst.xml.xpath2.processor.testsuite.dates;
import java.net.URL;
import org.apache.xerces.xs.XSModel;
import org.eclipse.wst.xml.xpath2.processor.DynamicError;
import org.eclipse.wst.xml.xpath2.processor.ResultSequence;
import org.eclipse.wst.xml.xpath2.processor.StaticError;
import org.eclipse.wst.xml.xpath2.processor.XPathParserException;
import org.eclipse.wst.xml.xpath2.processor.test.AbstractPsychoPathTest;
public class DateSubtractYMDTest extends AbstractPsychoPathTest {
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator with the arguments set as follows: $arg1 = xs:date(lower bound) $arg2 = xs:yearMonthDuration(lower bound).
public void test_op_subtract_yearMonthDuration_from_date2args_1() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date2args-1.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date2args-1.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator with the arguments set as follows: $arg1 = xs:date(mid range) $arg2 = xs:yearMonthDuration(lower bound).
public void test_op_subtract_yearMonthDuration_from_date2args_2() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date2args-2.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date2args-2.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator with the arguments set as follows: $arg1 = xs:date(upper bound) $arg2 = xs:yearMonthDuration(lower bound).
public void test_op_subtract_yearMonthDuration_from_date2args_3() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date2args-3.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date2args-3.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator with the arguments set as follows: $arg1 = xs:date(lower bound) $arg2 = xs:yearMonthDuration(mid range).
public void test_op_subtract_yearMonthDuration_from_date2args_4() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date2args-4.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date2args-4.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator with the arguments set as follows: $arg1 = xs:date(lower bound) $arg2 = xs:yearMonthDuration(upper bound).
public void test_op_subtract_yearMonthDuration_from_date2args_5() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date2args-5.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date2args-5.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator as per example 1 (for this function) of the Functions and Operators spec.
public void test_op_subtract_yearMonthDuration_from_date_1() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-1.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-1.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator as per example 2 (for this function) of the Functions and Operators spec.
public void test_op_subtract_yearMonthDuration_from_date_2() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-2.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-2.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator as per example 3 (for this function) of the Functions and Operators spec.
public void test_op_subtract_yearMonthDuration_from_date_3() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-3.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-3.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator used in conjunction with the "fn:not" function.
public void test_op_subtract_yearMonthDuration_from_date_4() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-4.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-4.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator as an argument to the "fn:boolean" function.
public void test_op_subtract_yearMonthDuration_from_date_5() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-5.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-5.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator as an argument to the "fn:number" function.
public void test_op_subtract_yearMonthDuration_from_date_6() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-6.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-6.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator as an argument to the "fn:string" function.
public void test_op_subtract_yearMonthDuration_from_date_7() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-7.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-7.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator that returns a negative value.
public void test_op_subtract_yearMonthDuration_from_date_8() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-8.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-8.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator, which is part of an "and" expression.
public void test_op_subtract_yearMonthDuration_from_date_9() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-9.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-9.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator as part of an "or" expression.
public void test_op_subtract_yearMonthDuration_from_date_10() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-10.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-10.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator used in conjunction with a boolean expression and the "fn:true" function.
public void test_op_subtract_yearMonthDuration_from_date_12() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-12.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-12.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator, which is part of a numeric-equal expression (eq operator).
public void test_op_subtract_yearMonthDuration_from_date_13() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-13.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-13.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator, which is part of a numeric-equal expression (ne operator).
public void test_op_subtract_yearMonthDuration_from_date_14() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-14.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-14.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator, which is part of a numeric-equal expression (le operator).
public void test_op_subtract_yearMonthDuration_from_date_15() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-15.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-15.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator, which is part of a numeric-equal expression (ge operator).
public void test_op_subtract_yearMonthDuration_from_date_16() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-16.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-16.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator as part of a boolean expression (and operator) and the "fn:false" function.
public void test_op_subtract_yearMonthDuration_from_date_17() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-17.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-17.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
//Evaluates the "op:subtract-yearMonthDuration-from-date" operator as part of a boolean expression (or operator) and the "fn:false" function.
public void test_op_subtract_yearMonthDuration_from_date_18() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-18.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/ArithExpr/DurationArith/DateSubtractYMD/op-subtract-yearMonthDuration-from-date-18.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
}