Commit 1a718cbc authored by Pakulin's avatar Pakulin
Browse files

Fixed bug with 'double' type.

Added a few new tests.
Renamed MANFEST to MANIFEST
parent 3d08912c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2,8 +2,8 @@
<classpath>
	<classpathentry kind="src" path="src"/>
	<classpathentry kind="src" path="tests"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
	<classpathentry kind="lib" path="lib/xmlunit-1.5.jar" sourcepath="lib/xmlunit-1.5-src.zip"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
	<classpathentry kind="output" path="bin"/>
</classpath>
+2 −2
Original line number Diff line number Diff line
@@ -2,8 +2,8 @@ Manifest-Version: 1.0
Created-By: Nikolay Pakulin npak@ispras.ru (ETSI STF 475)
Name: org/etsi/mts/ttcn/part9/xmldiff/
Specification-Title: Utility to compare XML files
Specification-Version: 0.1
Specification-Version: 0.2
Specification-Vendor: STF 475
Implementation-Title: org.etsi.mts.ttcn.part9.xmldiff 
Implementation-Version: build01
Implementation-Version: build02
Implementation-Vendor: STF 475
+18 −7
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@ import org.w3c.dom.Node;
import org.w3c.dom.TypeInfo;

public class DifferenceHandler implements DifferenceListener {
	private static final String DOUBLE_TYPE_NAME = "double";
	private static final String FLOAT_TYPE_NAME = "float";
	private Document originalReference;
	@SuppressWarnings("unused")
	private Document originalTest;
@@ -61,7 +63,7 @@ public class DifferenceHandler implements DifferenceListener {
			return RETURN_ACCEPT_DIFFERENCE;
		}
		
		if (isFloat(originalNode)) {
		if (isFloat(originalNode) || isDouble(originalNode)) {
			return handleFloat(controlNodeDetail, testNodeDetail);
		}
		return RETURN_ACCEPT_DIFFERENCE;
@@ -122,7 +124,16 @@ public class DifferenceHandler implements DifferenceListener {


	private boolean isFloat(Node node) {
		boolean isFloat = false;
		return isDerivedFrom(node, FLOAT_TYPE_NAME);
	}

	private boolean isDouble(Node node) {
		return isDerivedFrom(node, DOUBLE_TYPE_NAME);
	}


	private boolean isDerivedFrom(Node node, String typeName) {
		boolean result = false;
		if (node.getNodeType() == Node.TEXT_NODE) {
			node  = node.getParentNode();
		}
@@ -132,17 +143,17 @@ public class DifferenceHandler implements DifferenceListener {
			return false;
		}
		
		isFloat = typeinfo.isDerivedFrom(
		result = typeinfo.isDerivedFrom(
							"http://www.w3.org/2001/XMLSchema", 
							"float", 
							typeName, 
							TypeInfo.DERIVATION_RESTRICTION)
			|| typeinfo.isDerivedFrom(
					"http://www.w3.org/2001/XMLSchema", 
					"float", 
					typeName, 
					TypeInfo.DERIVATION_EXTENSION);
		XmlDiff.logger.debug2("isFloat == ", isFloat, ": type ", typeinfo.getTypeName(), 
		XmlDiff.logger.debug2("isDerivedFrom(", typeName, ") == ", result, ": type ", typeinfo.getTypeName(), 
				", node ", node.getNodeName());
		return isFloat;
		return result;
	}


+14 −1
Original line number Diff line number Diff line
@@ -111,6 +111,19 @@ public class XmlDiff {
			throw new IllegalArgumentException("Can't read: " + this.referenceXmlFile.getAbsolutePath());
		}

//		XMLUnit.setControlParser(
//	            "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
//        // this next line is strictly not required - if no test parser is
//        // explicitly specified then the same factory class will be used for
//        // both test and control
//        XMLUnit.setTestParser(
//            "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
//
//        XMLUnit.setSAXParserFactory(
//            "org.apache.xerces.jaxp.SAXParserFactoryImpl");
        // XMLUnit.setTransformerFactory(
        //     "org.apache.xalan.processor.TransformerFactoryImpl");

        xmlParserFactory = DocumentBuilderFactory.newInstance();
		xmlParserFactory.setIgnoringComments(true);
		xmlParserFactory.setCoalescing(true);
+6 −1
Original line number Diff line number Diff line
@@ -9,7 +9,12 @@ import org.junit.runners.Suite.SuiteClasses;
		TestDiff_004_boolean.class, TestDiff_005_fixed_fraction.class,
		TestDiff_005_fixed_no_fraction.class, TestDiff_005_float.class,
		TestDiff_005_float_attribute.class,
		TestDiff_005_float_complex_content.class })
		TestDiff_005_float_complex_content.class,
		TestDiff_006.class,
		TestDiff_007_MultipleXSD.class,
		TestDiff_008_double.class,
		TestDiff_009_float_union.class
		})
public class AllTests {

}
Loading