Hi all,

I'd been experimenting with a suite of test cases for PRECIS. Now that
RFC 8264 is out I have updated them for the new RFC.

The test case sections themselves are defined in separate XML files
because I'm generating them from the tests from my Go implementation and
it was easier during development to regenerate those files separately
without having to parse the RFC XML.

Some of them could use comments detailing why the test case is included
or what specifically it tests, and the formatting could stand to be
improved somewhat (I had no idea how to represent the input and output
bytes). Suggestions welcome.

—Sam
<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
  <!ENTITY enforcetests SYSTEM "enforcetests.xml">
  <!ENTITY comparetests SYSTEM "comparetests.xml">
]>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc sortrefs="yes"?>
<?rfc strict="yes"?>
<?rfc symrefs="yes"?>
<?rfc toc="yes"?>
<?rfc tocdepth="4"?>

<rfc ipr="trust200902" category="std" docName="draft-whited-precis-test-vectors-00">

  <front>

    <title abbrev="PRECIS: Tests">Preparation, Enforcement, and Comparison of Internationalized Strings (PRECIS) Test Vectors</title>

    <author initials="S." surname="Whited" fullname="Sam Whited">
      <organization>Individual</organization>
      <address>
        <email>[email protected]</email>
        <uri>https://blog.samwhited.com/</uri>
      </address>
    </author>

    <date/>

    <area>Applications</area>
    <workgroup>PRECIS</workgroup>

    <keyword>tests</keyword>
    <keyword>unicode</keyword>

    <abstract>
      <t>
        This document contains machine readable test vectors for several
        Preparation, Enforcement, and Comparison of Internationalized Strings
        (PRECIS) <xref target='RFC8264'/> profiles.
      </t>
    </abstract>

  </front>


  <middle>

  <section title="Introduction" anchor="intro">

    <section title="Overview" anchor="overview">
      <t>
        This document contains machine readable test vectors for several
        Preparation, Enforcement, and Comparison of Internationalized Strings
        (PRECIS) <xref target='RFC8264'/> profiles.
      </t>

      <t>
        Two sets of vectors exist for profiles of the base classes.
        The first set tests the preparation and enforcement steps.
        It takes the form of a table that contains an input string, an output
        string after the PRECIS preparation step, and an output string after the
        PRECIS enforcement step, and an optional comment.
        If either step is expected to error, the output string will be "ERROR".
        The second set tests the PRECIS comparison step.
        It takes the form of a table that contains two strings, a boolean that
        is TRUE if the two strings should be considered equal and FALSE
        otherwise, and an optional comment.
      </t>

      <t>
        Vectors for inclusion of code points in the IdentifierClass and
        FreeformClass are not included.
        A complete list of valid inputs and Outputs for the derived property
        algorithm specified in <xref target='RFC8264'/> can be found in the IANA
        "PRECIS Derived Property Value" registry.
      </t>
    </section>

    <section title="Terminology" anchor="terms">
      <t>
        Many important terms used in this document are defined in
        <xref target='RFC8264'/>, <xref target='RFC6365'/>, and
        <xref target='Unicode'/>.
      </t>
      <t>
        The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
        NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED",
        "MAY", and "OPTIONAL" in this document are to be interpreted as
        described in BCP 14 <xref target='RFC2119'/> <xref target='RFC8174'/>
        when, and only when, they appear in all capitals, as shown here.
      </t>
    </section>

  </section>

  <section title="Test Vectors" anchor="vectors">
    <section title="Methodology" anchor="method">
      <t>
        The test vectors in this document have been verified by three
        independent implementations.
        An implementation that concurs with the results provided in this
        document should be interoperable with other implementations.
      </t>
      <t>
        Input and output strings are expressed as UTF-8 and hexidecimal encoded
        byte strings.
      </t>
    </section>
    &enforcetests;
    &comparetests;
  </section>

  <section title="IANA Considerations" anchor="iana">
    <t>
      This document requires no interaction with the Internet Assigned Numbers
      Authority (IANA).
    </t>
  </section>

  <section title="Security Considerations" anchor="security">
    <t>
      This document is intended to provide test vectors for the PRECIS framework
      and its profiles.
      No assertion of the security of the PRECIS framework or its profiles for
      any particular use is intended.
      The reader is referred to <xref target='RFC8264'/> for a discussion of the
      general security of the PRECIS framework.
    </t>
  </section>

  </middle>

  <back>

    <references title="References">

      <?rfc include="reference.RFC.2119.xml"?>
      <?rfc include="reference.RFC.6365.xml"?>
      <?rfc include="reference.RFC.8174.xml"?>
      <?rfc include="reference.RFC.8264.xml"?>

      <reference anchor="Unicode" target="http://www.unicode.org/versions/latest/";>
        <front>
          <title>The Unicode Standard</title>
          <author>
            <organization>The Unicode Consortium</organization>
          </author>
          <date />
        </front>
      </reference>

    </references>

  <section title="Acknowledgements" anchor="acks">
    <t>
      The author would like to thank Marcel van Lohuizen of Google for his help
      and code reviews on the Go programming language implementation of PRECIS
      for which these tests were designed and for contributing many of the tests
      himself.
      Also, Peter Saint-Andre for his encouragement on this document.
    </t>
  </section>

  </back>

</rfc>
<section title="Enforcement Tests">
  <section title="Basic">
    <texttable>
      <ttcol>Input</ttcol>
      <ttcol>Output</ttcol>
      <ttcol>Err</ttcol>
      <c>65cc81cc9f</c>
      <c>c3a9cc9f</c>
      <c></c>
    </texttable>
  </section>
  <section title="Context Rule 1">
    <texttable>
      <ttcol>Input</ttcol>
      <ttcol>Output</ttcol>
      <ttcol>Err</ttcol>
      <c>e2808c</c>
      <c></c>
      <c>context rule violated</c>
      <c>e2808c61</c>
      <c></c>
      <c>context rule violated</c>
      <c>61e2808c</c>
      <c></c>
      <c>context rule violated</c>
      <c>e2808cd8a7</c>
      <c></c>
      <c>context rule violated</c>
      <c>d8ace2808c</c>
      <c></c>
      <c>context rule violated</c>
      <c>d890e2808cd890d8a7</c>
      <c></c>
      <c>context rule violated</c>
      <c>d8acd890e2808cd890</c>
      <c></c>
      <c>context rule violated</c>
      <c>d8ace2808cd8a7</c>
      <c>d8ace2808cd8a7</c>
      <c></c>
      <c>d8acd890e2808cd890d8a7</c>
      <c>d8acd890e2808cd890d8a7</c>
      <c></c>
      <c>d8acd890d890e2808cd890d890d8a7</c>
      <c>d8acd890d890e2808cd890d890d8a7</c>
      <c></c>
      <c>d8acd890e2808cd8a7</c>
      <c>d8acd890e2808cd8a7</c>
      <c></c>
      <c>d8ace2808cd890d8a7</c>
      <c>d8ace2808cd890d8a7</c>
      <c></c>
      <c>eaa1b2e2808cd8ac</c>
      <c>eaa1b2e2808cd8ac</c>
      <c></c>
      <c>eaa1b2d890e2808cd890d8ac</c>
      <c>eaa1b2d890e2808cd890d8ac</c>
      <c></c>
      <c>eaa1b2d890d890e2808cd890d890d8ac</c>
      <c>eaa1b2d890d890e2808cd890d890d8ac</c>
      <c></c>
      <c>eaa1b2d890e2808cd8ac</c>
      <c>eaa1b2d890e2808cd8ac</c>
      <c></c>
      <c>eaa1b2e2808cd890d8ac</c>
      <c>eaa1b2e2808cd890d8ac</c>
      <c></c>
      <c>e0a98de2808c</c>
      <c>e0a98de2808c</c>
      <c></c>
      <c>eaa1b2e0a98de2808c</c>
      <c>eaa1b2e0a98de2808c</c>
      <c></c>
      <c>eaa1b2e0a98dd890e2808c</c>
      <c></c>
      <c>context rule violated</c>
      <c>eaa1b2e0a98dd890e2808c</c>
      <c></c>
      <c>context rule violated</c>
      <c>e0ab8de2808c</c>
      <c>e0ab8de2808c</c>
      <c></c>
      <c>eaa1b2e0ab8de2808c</c>
      <c>eaa1b2e0ab8de2808c</c>
      <c></c>
      <c>eaa1b2e0ab8dd890e2808c</c>
      <c></c>
      <c>context rule violated</c>
      <c>eaa1b2e0ab8dd890e2808c</c>
      <c></c>
      <c>context rule violated</c>
      <c>eaa1b2e0ab8de2808cd8ac</c>
      <c>eaa1b2e0ab8de2808cd8ac</c>
      <c></c>
      <c>eaa1b2e2808ce0ab8dd8ac</c>
      <c>eaa1b2e2808ce0ab8dd8ac</c>
      <c></c>
    </texttable>
  </section>
  <section title="Context Rule 2">
    <texttable>
      <ttcol>Input</ttcol>
      <ttcol>Output</ttcol>
      <ttcol>Err</ttcol>
      <c>e2808d</c>
      <c></c>
      <c>context rule violated</c>
      <c>e2808d61</c>
      <c></c>
      <c>context rule violated</c>
      <c>61e2808d</c>
      <c></c>
      <c>context rule violated</c>
      <c>e0a98de2808d</c>
      <c>e0a98de2808d</c>
      <c></c>
      <c>eaa1b2e0a98de2808d</c>
      <c>eaa1b2e0a98de2808d</c>
      <c></c>
      <c>e0a98d61e2808d</c>
      <c></c>
      <c>context rule violated</c>
    </texttable>
  </section>
  <section title="Context Rule 3">
    <texttable>
      <ttcol>Input</ttcol>
      <ttcol>Output</ttcol>
      <ttcol>Err</ttcol>
      <c>c2b7</c>
      <c></c>
      <c>context rule violated</c>
      <c>6cc2b7</c>
      <c></c>
      <c>context rule violated</c>
      <c>c2b76c</c>
      <c></c>
      <c>context rule violated</c>
      <c>61c2b7</c>
      <c></c>
      <c>context rule violated</c>
      <c>6cc2b761</c>
      <c></c>
      <c>context rule violated</c>
      <c>61c2b761</c>
      <c></c>
      <c>context rule violated</c>
      <c>6cc2b76c</c>
      <c>6cc2b76c</c>
      <c></c>
      <c>616cc2b76c61</c>
      <c>616cc2b76c61</c>
      <c></c>
    </texttable>
  </section>
  <section title="Context Rule 4">
    <texttable>
      <ttcol>Input</ttcol>
      <ttcol>Output</ttcol>
      <ttcol>Err</ttcol>
      <c>cdb5</c>
      <c></c>
      <c>context rule violated</c>
      <c>cdb561</c>
      <c></c>
      <c>context rule violated</c>
      <c>ceb1cdb5</c>
      <c></c>
      <c>context rule violated</c>
      <c>cdb5ceb1</c>
      <c>cdb5ceb1</c>
      <c></c>
      <c>ceb1cdb5ceb1</c>
      <c>ceb1cdb5ceb1</c>
      <c></c>
      <c>cdb5cdb5ceb1</c>
      <c>cdb5cdb5ceb1</c>
      <c></c>
      <c>ceb1cdb5cdb5ceb1</c>
      <c>ceb1cdb5cdb5ceb1</c>
      <c></c>
      <c>ceb1cdb5cdb5</c>
      <c></c>
      <c>context rule violated</c>
      <c>ceb1cdb5cdb561</c>
      <c></c>
      <c>context rule violated</c>
    </texttable>
  </section>
  <section title="Context Rule 5+6">
    <texttable>
      <ttcol>Input</ttcol>
      <ttcol>Output</ttcol>
      <ttcol>Err</ttcol>
      <c>d7b3</c>
      <c></c>
      <c>context rule violated</c>
      <c>d7b3d794</c>
      <c></c>
      <c>context rule violated</c>
      <c>61d7b362</c>
      <c></c>
      <c>context rule violated</c>
      <c>d7a9d7b3</c>
      <c>d7a9d7b3</c>
      <c></c>
      <c>d7a9d7b3d7b3d7b3</c>
      <c>d7a9d7b3d7b3d7b3</c>
      <c></c>
      <c>d7b4</c>
      <c></c>
      <c>context rule violated</c>
      <c>d7b4d794</c>
      <c></c>
      <c>context rule violated</c>
      <c>61d7b462</c>
      <c></c>
      <c>context rule violated</c>
      <c>d7a9d7b4</c>
      <c>d7a9d7b4</c>
      <c></c>
      <c>d7a9d7b4d7b4d7b4</c>
      <c>d7a9d7b4d7b4d7b4</c>
      <c></c>
      <c>61d7a9d7b4d7b4d7b4</c>
      <c>61d7a9d7b4d7b4d7b4</c>
      <c></c>
    </texttable>
  </section>
  <section title="Context Rule 7">
    <texttable>
      <ttcol>Input</ttcol>
      <ttcol>Output</ttcol>
      <ttcol>Err</ttcol>
      <c>e383bb</c>
      <c></c>
      <c>context rule violated</c>
      <c>616263e383bb</c>
      <c></c>
      <c>context rule violated</c>
      <c>e383bb646566</c>
      <c></c>
      <c>context rule violated</c>
      <c>616263e383bb646566</c>
      <c></c>
      <c>context rule violated</c>
      <c>61e3838563e383bb646566</c>
      <c>61e3838563e383bb646566</c>
      <c></c>
      <c>616263e383bb64e381b666</c>
      <c>616263e383bb64e381b666</c>
      <c></c>
      <c>e2ba906263e383bb646566</c>
      <c>e2ba906263e383bb646566</c>
      <c></c>
    </texttable>
  </section>
  <section title="Context Rule 8+9">
    <texttable>
      <ttcol>Input</ttcol>
      <ttcol>Output</ttcol>
      <ttcol>Err</ttcol>
      <c>d9a1d9a2d9a3d9a4d9a5dbb6</c>
      <c></c>
      <c>context rule violated</c>
      <c>dbb1dbb2dbb3dbb4dbb5d9a6</c>
      <c></c>
      <c>context rule violated</c>
      <c>d9a1d9a2d9a3d9a4d9a5</c>
      <c>d9a1d9a2d9a3d9a4d9a5</c>
      <c></c>
      <c>dbb1dbb2dbb3dbb4dbb5</c>
      <c>dbb1dbb2dbb3dbb4dbb5</c>
      <c></c>
    </texttable>
  </section>
  <section title="Nickname">
    <texttable>
      <ttcol>Input</ttcol>
      <ttcol>Output</ttcol>
      <ttcol>Err</ttcol>
      <c>20205377616e20206f6620202041766f6e202020</c>
      <c>5377616e206f662041766f6e</c>
      <c></c>
      <c></c>
      <c></c>
      <c>disallowed empty string</c>
      <c>20</c>
      <c></c>
      <c>disallowed empty string</c>
      <c>2020</c>
      <c></c>
      <c>disallowed empty string</c>
      <c>61c2a061e19a8061e2808061e2808161e2808261e2808361e2808461e2808561e2808661e2808761e2808861e2808961e2808a61e280af61e2819f61e3808061</c>
      <c>612061206120612061206120612061206120612061206120612061206120612061</c>
      <c></c>
      <c>466f6f</c>
      <c>466f6f</c>
      <c></c>
      <c>666f6f</c>
      <c>666f6f</c>
      <c></c>
      <c>466f6f20426172</c>
      <c>466f6f20426172</c>
      <c></c>
      <c>666f6f20626172</c>
      <c>666f6f20626172</c>
      <c></c>
      <c>cea3</c>
      <c>cea3</c>
      <c></c>
      <c>cf83</c>
      <c>cf83</c>
      <c></c>
      <c>cf82</c>
      <c>cf82</c>
      <c></c>
      <c>e2999a</c>
      <c>e2999a</c>
      <c></c>
      <c>5269636861726420e285a3</c>
      <c>52696368617264204956</c>
      <c></c>
      <c>e284ab</c>
      <c>c385</c>
      <c></c>
      <c>efac80</c>
      <c>6666</c>
      <c></c>
      <c>d7a961</c>
      <c>d7a961</c>
      <c></c>
      <c>eb8f99ec9dbceca1b0eab1b4ebb380eab2bded9788eb9dbd</c>
      <c>eb8f99ec9dbceca1b0eab1b4ebb380eab2bded9788eb9dbd</c>
      <c></c>
    </texttable>
  </section>
  <section title="OpaqueString">
    <texttable>
      <ttcol>Input</ttcol>
      <ttcol>Output</ttcol>
      <ttcol>Err</ttcol>
      <c>20205377616e20206f6620202041766f6e202020</c>
      <c>20205377616e20206f6620202041766f6e202020</c>
      <c></c>
      <c></c>
      <c></c>
      <c>disallowed empty string</c>
      <c>20</c>
      <c>20</c>
      <c></c>
      <c>2020</c>
      <c>2020</c>
      <c></c>
      <c>61c2a061e19a8061e2808061e2808161e2808261e2808361e2808461e2808561e2808661e2808761e2808861e2808961e2808a61e280af61e2819f61e3808061</c>
      <c>612061206120612061206120612061206120612061206120612061206120612061</c>
      <c></c>
      <c>466f6f</c>
      <c>466f6f</c>
      <c></c>
      <c>666f6f</c>
      <c>666f6f</c>
      <c></c>
      <c>466f6f20426172</c>
      <c>466f6f20426172</c>
      <c></c>
      <c>666f6f20626172</c>
      <c>666f6f20626172</c>
      <c></c>
      <c>cf83</c>
      <c>cf83</c>
      <c></c>
      <c>5269636861726420e285a3</c>
      <c>5269636861726420e285a3</c>
      <c></c>
      <c>e284ab</c>
      <c>c385</c>
      <c></c>
      <c>4a61636b206f6620e299a673</c>
      <c>4a61636b206f6620e299a673</c>
      <c></c>
      <c>6d7920636174206973206120096279</c>
      <c></c>
      <c>disallowed rune</c>
      <c>d7a961</c>
      <c>d7a961</c>
      <c></c>
    </texttable>
  </section>
  <section title="UsernameCaseMapped">
    <texttable>
      <ttcol>Input</ttcol>
      <ttcol>Output</ttcol>
      <ttcol>Err</ttcol>
      <c>6a756c696574406578616d706c652e636f6d</c>
      <c>6a756c696574406578616d706c652e636f6d</c>
      <c></c>
      <c>6675737362616c6c</c>
      <c>6675737362616c6c</c>
      <c></c>
      <c>6675c39f62616c6c</c>
      <c>6675c39f62616c6c</c>
      <c></c>
      <c>cf80</c>
      <c>cf80</c>
      <c></c>
      <c>cea3</c>
      <c>cf83</c>
      <c></c>
      <c>cf83</c>
      <c>cf83</c>
      <c></c>
      <c>cf82</c>
      <c>cf82</c>
      <c></c>
      <c>49</c>
      <c>69</c>
      <c></c>
      <c>49</c>
      <c>69</c>
      <c></c>
      <c>cf92</c>
      <c></c>
      <c>disallowed rune</c>
      <c>ceb0</c>
      <c>ceb0</c>
      <c></c>
      <c>666f6f20626172</c>
      <c></c>
      <c>disallowed rune</c>
      <c>e2999a</c>
      <c></c>
      <c>failed bidi rule</c>
      <c>7e</c>
      <c>7e</c>
      <c></c>
      <c>61</c>
      <c>61</c>
      <c></c>
      <c>21</c>
      <c>21</c>
      <c></c>
      <c>c2b2</c>
      <c></c>
      <c>failed bidi rule</c>
      <c>09</c>
      <c></c>
      <c>disallowed rune</c>
      <c>0a</c>
      <c></c>
      <c>disallowed rune</c>
      <c>e29b96</c>
      <c></c>
      <c>failed bidi rule</c>
      <c>e29bbf</c>
      <c></c>
      <c>failed bidi rule</c>
      <c>efac80</c>
      <c></c>
      <c>disallowed rune</c>
      <c>e19a80</c>
      <c></c>
      <c>failed bidi rule</c>
      <c>20</c>
      <c></c>
      <c>disallowed rune</c>
      <c>2020</c>
      <c></c>
      <c>disallowed rune</c>
      <c>c785</c>
      <c></c>
      <c>disallowed rune</c>
      <c>e19bae</c>
      <c></c>
      <c>disallowed rune</c>
      <c>d288</c>
      <c></c>
      <c>failed bidi rule</c>
      <c>e284ab</c>
      <c>c3a5</c>
      <c></c>
      <c>41cc8a</c>
      <c>c3a5</c>
      <c></c>
      <c>c385</c>
      <c>c3a5</c>
      <c></c>
      <c>c3a7</c>
      <c>c3a7</c>
      <c></c>
      <c>63cca7</c>
      <c>c3a7</c>
      <c></c>
      <c>c598</c>
      <c>c599</c>
      <c></c>
      <c>52cc8c</c>
      <c>c599</c>
      <c></c>
      <c>e1b9a1</c>
      <c>e1b9a1</c>
      <c></c>
      <c>d090</c>
      <c>d0b0</c>
      <c></c>
      <c>efbca1efbca2</c>
      <c>6162</c>
      <c></c>
      <c>d7a963</c>
      <c></c>
      <c>failed bidi rule</c>
    </texttable>
  </section>
  <section title="UsernameCasePreserved">
    <texttable>
      <ttcol>Input</ttcol>
      <ttcol>Output</ttcol>
      <ttcol>Err</ttcol>
      <c>414243</c>
      <c>414243</c>
      <c></c>
      <c>efbca1efbca2</c>
      <c>4142</c>
      <c></c>
      <c>d7a963</c>
      <c></c>
      <c>failed bidi rule</c>
      <c>efac80</c>
      <c></c>
      <c>disallowed rune</c>
      <c>e284ab</c>
      <c>c385</c>
      <c></c>
      <c>e1ba9b</c>
      <c></c>
      <c>disallowed rune</c>
    </texttable>
  </section>
</section>
<section title="Comparison Tests">
  <section title="Nickname">
    <texttable>
      <ttcol>A</ttcol>
      <ttcol>B</ttcol>
      <ttcol>Result</ttcol>
      <c>61</c>
      <c>62</c>
      <c>false</c>
      <c>20205377616e20206f6620202041766f6e202020</c>
      <c>7377616e206f662061766f6e</c>
      <c>true</c>
      <c>466f6f</c>
      <c>666f6f</c>
      <c>true</c>
      <c>666f6f</c>
      <c>666f6f</c>
      <c>true</c>
      <c>466f6f20426172</c>
      <c>666f6f20626172</c>
      <c>true</c>
      <c>666f6f20626172</c>
      <c>666f6f20626172</c>
      <c>true</c>
      <c>cea3</c>
      <c>cf83</c>
      <c>true</c>
      <c>cea3</c>
      <c>cf82</c>
      <c>false</c>
      <c>cf83</c>
      <c>cf82</c>
      <c>false</c>
      <c>5269636861726420e285a3</c>
      <c>72696368617264206976</c>
      <c>true</c>
      <c>e284ab</c>
      <c>c3a5</c>
      <c>true</c>
      <c>efac80</c>
      <c>6666</c>
      <c>true</c>
      <c>c39f</c>
      <c>7353</c>
      <c>false</c>
      <c>c2a8</c>
      <c>20cc88</c>
      <c>false</c>
      <c>20cc88</c>
      <c>cc88</c>
      <c>true</c>
    </texttable>
  </section>
</section>
_______________________________________________
precis mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/precis

Reply via email to