<?xml version="1.0" encoding="utf-8" ?>
<xsd:schema
	version="0.1"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<xsd:annotation>
		<xsd:documentation xml:lang="en">
			Schema description for the JUnit XML report written by Catch2's JUnit reporter (Catch2 v3).

			Derived from the reporter's source code (src/catch2/reporters/catch_reporter_junit.cpp, Catch2 v3.16.0,
			https://github.com/catchorg/Catch2/blob/v3.16.0/src/catch2/reporters/catch_reporter_junit.cpp) and from
			reports written by it.
		</xsd:documentation>
	</xsd:annotation>

	<xsd:simpleType name="preservingstring">
		<xsd:restriction base="xsd:string">
			<xsd:whiteSpace value="preserve"/>
		</xsd:restriction>
	</xsd:simpleType>

	<xsd:simpleType name="duration">
		<xsd:annotation>
			<xsd:documentation xml:lang="en">Duration in seconds with 3 decimal places.</xsd:documentation>
		</xsd:annotation>
		<xsd:restriction base="xsd:decimal">
			<xsd:pattern value="\d+\.\d{3}"/>
		</xsd:restriction>
	</xsd:simpleType>

	<xsd:simpleType name="timestamp">
		<xsd:annotation>
			<xsd:documentation xml:lang="en">Start time in UTC with seconds resolution.</xsd:documentation>
		</xsd:annotation>
		<xsd:restriction base="xsd:dateTime">
			<xsd:pattern value="\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z"/>
		</xsd:restriction>
	</xsd:simpleType>

	<xsd:simpleType name="propertyName">
		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="random-seed"/>
			<xsd:enumeration value="filters"/>
		</xsd:restriction>
	</xsd:simpleType>

	<xsd:simpleType name="testcaseStatus">
		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="run"/>
		</xsd:restriction>
	</xsd:simpleType>

	<xsd:complexType name="literalblock">
		<xsd:simpleContent>
			<xsd:extension base="preservingstring">
				<xsd:attribute name="message" type="xsd:string" use="optional" />
				<xsd:attribute name="type" type="xsd:string" use="optional" />
			</xsd:extension>
		</xsd:simpleContent>
	</xsd:complexType>

	<xsd:complexType name="property">
		<xsd:attribute name="name" type="propertyName" use="required" />
		<xsd:attribute name="value" type="xsd:string" use="required" />
	</xsd:complexType>

	<xsd:complexType name="properties">
		<xsd:sequence>
			<xsd:element name="property" type="property" minOccurs="0" maxOccurs="2" />
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="testcase">
		<xsd:sequence>
			<xsd:choice minOccurs="0">
				<xsd:sequence>
					<xsd:element name="skipped" type="literalblock">
						<xsd:annotation>
							<xsd:documentation xml:lang="en">SKIP(), or an expected failure ([!mayfail]).</xsd:documentation>
						</xsd:annotation>
					</xsd:element>
					<xsd:choice minOccurs="0">
						<xsd:element name="skipped" type="literalblock" />
						<xsd:element name="failure" type="literalblock" />
						<xsd:element name="error" type="literalblock" />
					</xsd:choice>
				</xsd:sequence>
				<xsd:element name="failure" type="literalblock">
					<xsd:annotation>
						<xsd:documentation xml:lang="en">First failed assertion.</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
				<xsd:element name="error" type="literalblock">
					<xsd:annotation>
						<xsd:documentation xml:lang="en">Unexpected exception or fatal error condition.</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
			</xsd:choice>
			<xsd:element name="system-out" type="literalblock" minOccurs="0" />
			<xsd:element name="system-err" type="literalblock" minOccurs="0" />
		</xsd:sequence>
		<xsd:attribute name="classname" type="xsd:string" use="required" />
		<xsd:attribute name="name" type="xsd:string" use="required" />
		<xsd:attribute name="time" type="duration" use="required" />
		<xsd:attribute name="status" type="testcaseStatus" use="required" />
	</xsd:complexType>

	<xsd:complexType name="testsuite">
		<xsd:sequence>
			<xsd:element name="properties" type="properties" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation xml:lang="en">Written by Catch2, not by pyEDAA.Reports.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			<xsd:element name="testcase" type="testcase" minOccurs="0" maxOccurs="unbounded">
				<xsd:annotation>
					<xsd:documentation xml:lang="en">A test case or a path of sections.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			<xsd:element name="system-out" type="literalblock" />
			<xsd:element name="system-err" type="literalblock" />
		</xsd:sequence>
		<xsd:attribute name="name" type="xsd:string" use="required" />
		<xsd:attribute name="errors" type="xsd:nonNegativeInteger" use="required" />
		<xsd:attribute name="failures" type="xsd:nonNegativeInteger" use="required" />
		<xsd:attribute name="skipped" type="xsd:nonNegativeInteger" use="required" />
		<xsd:attribute name="tests" type="xsd:nonNegativeInteger" use="required" />
		<xsd:attribute name="hostname" type="xsd:string" use="required" />
		<xsd:attribute name="time" type="duration" use="optional" />
		<xsd:attribute name="timestamp" type="timestamp" use="required" />
	</xsd:complexType>

	<xsd:complexType name="testsuites">
		<xsd:sequence>
			<xsd:element name="testsuite" type="testsuite">
				<xsd:annotation>
					<xsd:documentation xml:lang="en">Describes the test run of one test executable.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="testsuites" type="testsuites">
		<xsd:annotation>
			<xsd:documentation xml:lang="en">Describes the overall result of all testcases.</xsd:documentation>
		</xsd:annotation>
	</xsd:element>
</xsd:schema>
