You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by ji...@apache.org on 2021/03/30 15:15:20 UTC

[daffodil] 04/09: Test all integer sizes, signs, and byte orders

This is an automated email from the ASF dual-hosted git repository.

jinterrante pushed a commit to branch runtime2-2202
in repository https://gitbox.apache.org/repos/asf/daffodil.git

commit be9cf975c311aa86fd394bd03c7356ad608d3732
Author: John Interrante <in...@research.ge.com>
AuthorDate: Thu Dec 17 16:10:07 2020 -0500

    Test all integer sizes, signs, and byte orders
    
    Update pull request in response to reviewer feedback.  Lift byteOrder
    restriction so both bigEndian and littleEndian integers can be tested.
    Expand test schema to test all integer sizes, signs, and byte orders.
    
    In bin.LICENSE, add os-lib and directories-jvm licenses since we need
    to make it clear daffodil-cli uses them at runtime.
    
    In TestCLIGenerateC.scala, rename ex_int32 to ex_ints.
    
    Add c/Makefile to make it easier for people to build generated code
    themselves after running "daffodil generate c -s <schema>".
    
    In xml_reader.c, add strtounum since we need another function to parse
    64-bit unsigned integers successfully.
    
    In xml_writer.c, update comment as requested by pull request review.
    
    Replace ex_int32.[ch] with ex_ints.[ch] since test schema now attempts
    to test all integer sizes, signs, and byte orders.
    
    In BinaryIntegerKnownLengthCodeGenerator.scala, remove byteOrder
    restriction to allow littleEndian as well as bigEndian.  Add comment
    to explain unusual memory bit pattern (and change it to 0xCCC... which
    is the Microsoft magic debug value for uninitialized stack memory).
    Generate calls to both "be" and "le" endian conversion functions.
    
    In CodeGeneratorState.scala, add comment to explain degenerate cases
    of endian conversion functions and add littleEndian functions as well.
    
    In TestRuntime2.dfdl.xsd, remove alignment properties to ensure
    TestRuntime2.tdml will pass under both daffodil-runtime1 and
    daffodil-runtime2 and replace ex_int32 with ex_ints in order to test
    all integer sizes, signs, and byte orders.
    
    In TestRuntime2.tdml, replace ex_int32 tests with more comprehensive
    ex_ints tests.  Change binary and XML test files to have .dat and .xml
    file extensions as requested and update their contents to make tests
    pass under both runtime1 and runtime2.
    
    In TestRuntime2.scala, rename ex_int32 tests to ex_ints.
    
    In Rat.scala, rename binary test files and move them before sapi.
---
 daffodil-cli/bin.LICENSE                           | 405 +++++++++++
 .../daffodil/generating/TestCLIGenerateC.scala     |   6 +-
 daffodil-runtime2/src/main/resources/c/Makefile    |  52 ++
 .../src/main/resources/c/libcli/xml_reader.c       |  49 +-
 .../src/main/resources/c/libcli/xml_writer.c       |   2 +-
 .../src/main/resources/examples/ex_int32.c         | 263 -------
 .../src/main/resources/examples/ex_ints.c          | 766 +++++++++++++++++++++
 .../resources/examples/{ex_int32.h => ex_ints.h}   |  29 +-
 .../BinaryIntegerKnownLengthCodeGenerator.scala    |  27 +-
 .../runtime2/generators/CodeGeneratorState.scala   |  11 +-
 .../apache/daffodil/runtime2/TestRuntime2.dfdl.xsd |  33 +-
 .../org/apache/daffodil/runtime2/TestRuntime2.tdml |  29 +-
 .../org/apache/daffodil/runtime2/ex_int32_parse    | Bin 12 -> 0 bytes
 .../org/apache/daffodil/runtime2/ex_ints_parse.dat | Bin 0 -> 60 bytes
 .../{ex_int32_unparse => ex_ints_unparse.xml}      |  25 +-
 ...orion_command_parse => orion_command_parse.dat} | Bin
 ...n_command_unparse => orion_command_unparse.xml} |   0
 .../apache/daffodil/runtime2/TestRuntime2.scala    |   4 +-
 project/Rat.scala                                  |   4 +-
 19 files changed, 1362 insertions(+), 343 deletions(-)

diff --git a/daffodil-cli/bin.LICENSE b/daffodil-cli/bin.LICENSE
index f5fe806..63c4098 100644
--- a/daffodil-cli/bin.LICENSE
+++ b/daffodil-cli/bin.LICENSE
@@ -1445,3 +1445,408 @@ is subject to the terms and conditions of the following licenses.
     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     THE SOFTWARE.
+
+  This product bundles libraries from 'libaoyi', including the following files:
+    - lib/com.lihaoyi.geany_<VERSION>.jar
+    - lib/com.lihaoyi.os-lib_<VERSION>.jar
+  These files are available under the MIT license:
+
+    The MIT License (MIT)
+
+    Copyright (c) 2019 Li Haoyi (haoyi.sg@gmail.com)
+
+    Permission is hereby granted, free of charge, to any person obtaining a copy
+    of this software and associated documentation files (the "Software"), to deal
+    in the Software without restriction, including without limitation the rights
+    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+    copies of the Software, and to permit persons to whom the Software is
+    furnished to do so, subject to the following conditions:
+
+    The above copyright notice and this permission notice shall be included in
+    all copies or substantial portions of the Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+    DEALINGS IN THE SOFTWARE.
+
+  This product bundles 'directories-jvm', including the following files:
+    - lib/dirs-dev.directories_<VERSION>.jar
+  These files are available under the Mozilla 2.0 license:
+
+    Mozilla Public License Version 2.0
+    ==================================
+
+    1. Definitions
+    --------------
+
+    1.1. "Contributor"
+        means each individual or legal entity that creates, contributes to
+        the creation of, or owns Covered Software.
+
+    1.2. "Contributor Version"
+        means the combination of the Contributions of others (if any) used
+        by a Contributor and that particular Contributor's Contribution.
+
+    1.3. "Contribution"
+        means Covered Software of a particular Contributor.
+
+    1.4. "Covered Software"
+        means Source Code Form to which the initial Contributor has attached
+        the notice in Exhibit A, the Executable Form of such Source Code
+        Form, and Modifications of such Source Code Form, in each case
+        including portions thereof.
+
+    1.5. "Incompatible With Secondary Licenses"
+        means
+
+        (a) that the initial Contributor has attached the notice described
+            in Exhibit B to the Covered Software; or
+
+        (b) that the Covered Software was made available under the terms of
+            version 1.1 or earlier of the License, but not also under the
+            terms of a Secondary License.
+
+    1.6. "Executable Form"
+        means any form of the work other than Source Code Form.
+
+    1.7. "Larger Work"
+        means a work that combines Covered Software with other material, in
+        a separate file or files, that is not Covered Software.
+
+    1.8. "License"
+        means this document.
+
+    1.9. "Licensable"
+        means having the right to grant, to the maximum extent possible,
+        whether at the time of the initial grant or subsequently, any and
+        all of the rights conveyed by this License.
+
+    1.10. "Modifications"
+        means any of the following:
+
+        (a) any file in Source Code Form that results from an addition to,
+            deletion from, or modification of the contents of Covered
+            Software; or
+
+        (b) any new file in Source Code Form that contains any Covered
+            Software.
+
+    1.11. "Patent Claims" of a Contributor
+        means any patent claim(s), including without limitation, method,
+        process, and apparatus claims, in any patent Licensable by such
+        Contributor that would be infringed, but for the grant of the
+        License, by the making, using, selling, offering for sale, having
+        made, import, or transfer of either its Contributions or its
+        Contributor Version.
+
+    1.12. "Secondary License"
+        means either the GNU General Public License, Version 2.0, the GNU
+        Lesser General Public License, Version 2.1, the GNU Affero General
+        Public License, Version 3.0, or any later versions of those
+        licenses.
+
+    1.13. "Source Code Form"
+        means the form of the work preferred for making modifications.
+
+    1.14. "You" (or "Your")
+        means an individual or a legal entity exercising rights under this
+        License. For legal entities, "You" includes any entity that
+        controls, is controlled by, or is under common control with You. For
+        purposes of this definition, "control" means (a) the power, direct
+        or indirect, to cause the direction or management of such entity,
+        whether by contract or otherwise, or (b) ownership of more than
+        fifty percent (50%) of the outstanding shares or beneficial
+        ownership of such entity.
+
+    2. License Grants and Conditions
+    --------------------------------
+
+    2.1. Grants
+
+    Each Contributor hereby grants You a world-wide, royalty-free,
+    non-exclusive license:
+
+    (a) under intellectual property rights (other than patent or trademark)
+        Licensable by such Contributor to use, reproduce, make available,
+        modify, display, perform, distribute, and otherwise exploit its
+        Contributions, either on an unmodified basis, with Modifications, or
+        as part of a Larger Work; and
+
+    (b) under Patent Claims of such Contributor to make, use, sell, offer
+        for sale, have made, import, and otherwise transfer either its
+        Contributions or its Contributor Version.
+
+    2.2. Effective Date
+
+    The licenses granted in Section 2.1 with respect to any Contribution
+    become effective for each Contribution on the date the Contributor first
+    distributes such Contribution.
+
+    2.3. Limitations on Grant Scope
+
+    The licenses granted in this Section 2 are the only rights granted under
+    this License. No additional rights or licenses will be implied from the
+    distribution or licensing of Covered Software under this License.
+    Notwithstanding Section 2.1(b) above, no patent license is granted by a
+    Contributor:
+
+    (a) for any code that a Contributor has removed from Covered Software;
+        or
+
+    (b) for infringements caused by: (i) Your and any other third party's
+        modifications of Covered Software, or (ii) the combination of its
+        Contributions with other software (except as part of its Contributor
+        Version); or
+
+    (c) under Patent Claims infringed by Covered Software in the absence of
+        its Contributions.
+
+    This License does not grant any rights in the trademarks, service marks,
+    or logos of any Contributor (except as may be necessary to comply with
+    the notice requirements in Section 3.4).
+
+    2.4. Subsequent Licenses
+
+    No Contributor makes additional grants as a result of Your choice to
+    distribute the Covered Software under a subsequent version of this
+    License (see Section 10.2) or under the terms of a Secondary License (if
+    permitted under the terms of Section 3.3).
+
+    2.5. Representation
+
+    Each Contributor represents that the Contributor believes its
+    Contributions are its original creation(s) or it has sufficient rights
+    to grant the rights to its Contributions conveyed by this License.
+
+    2.6. Fair Use
+
+    This License is not intended to limit any rights You have under
+    applicable copyright doctrines of fair use, fair dealing, or other
+    equivalents.
+
+    2.7. Conditions
+
+    Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
+    in Section 2.1.
+
+    3. Responsibilities
+    -------------------
+
+    3.1. Distribution of Source Form
+
+    All distribution of Covered Software in Source Code Form, including any
+    Modifications that You create or to which You contribute, must be under
+    the terms of this License. You must inform recipients that the Source
+    Code Form of the Covered Software is governed by the terms of this
+    License, and how they can obtain a copy of this License. You may not
+    attempt to alter or restrict the recipients' rights in the Source Code
+    Form.
+
+    3.2. Distribution of Executable Form
+
+    If You distribute Covered Software in Executable Form then:
+
+    (a) such Covered Software must also be made available in Source Code
+        Form, as described in Section 3.1, and You must inform recipients of
+        the Executable Form how they can obtain a copy of such Source Code
+        Form by reasonable means in a timely manner, at a charge no more
+        than the cost of distribution to the recipient; and
+
+    (b) You may distribute such Executable Form under the terms of this
+        License, or sublicense it under different terms, provided that the
+        license for the Executable Form does not attempt to limit or alter
+        the recipients' rights in the Source Code Form under this License.
+
+    3.3. Distribution of a Larger Work
+
+    You may create and distribute a Larger Work under terms of Your choice,
+    provided that You also comply with the requirements of this License for
+    the Covered Software. If the Larger Work is a combination of Covered
+    Software with a work governed by one or more Secondary Licenses, and the
+    Covered Software is not Incompatible With Secondary Licenses, this
+    License permits You to additionally distribute such Covered Software
+    under the terms of such Secondary License(s), so that the recipient of
+    the Larger Work may, at their option, further distribute the Covered
+    Software under the terms of either this License or such Secondary
+    License(s).
+
+    3.4. Notices
+
+    You may not remove or alter the substance of any license notices
+    (including copyright notices, patent notices, disclaimers of warranty,
+    or limitations of liability) contained within the Source Code Form of
+    the Covered Software, except that You may alter any license notices to
+    the extent required to remedy known factual inaccuracies.
+
+    3.5. Application of Additional Terms
+
+    You may choose to offer, and to charge a fee for, warranty, support,
+    indemnity or liability obligations to one or more recipients of Covered
+    Software. However, You may do so only on Your own behalf, and not on
+    behalf of any Contributor. You must make it absolutely clear that any
+    such warranty, support, indemnity, or liability obligation is offered by
+    You alone, and You hereby agree to indemnify every Contributor for any
+    liability incurred by such Contributor as a result of warranty, support,
+    indemnity or liability terms You offer. You may include additional
+    disclaimers of warranty and limitations of liability specific to any
+    jurisdiction.
+
+    4. Inability to Comply Due to Statute or Regulation
+    ---------------------------------------------------
+
+    If it is impossible for You to comply with any of the terms of this
+    License with respect to some or all of the Covered Software due to
+    statute, judicial order, or regulation then You must: (a) comply with
+    the terms of this License to the maximum extent possible; and (b)
+    describe the limitations and the code they affect. Such description must
+    be placed in a text file included with all distributions of the Covered
+    Software under this License. Except to the extent prohibited by statute
+    or regulation, such description must be sufficiently detailed for a
+    recipient of ordinary skill to be able to understand it.
+
+    5. Termination
+    --------------
+
+    5.1. The rights granted under this License will terminate automatically
+    if You fail to comply with any of its terms. However, if You become
+    compliant, then the rights granted under this License from a particular
+    Contributor are reinstated (a) provisionally, unless and until such
+    Contributor explicitly and finally terminates Your grants, and (b) on an
+    ongoing basis, if such Contributor fails to notify You of the
+    non-compliance by some reasonable means prior to 60 days after You have
+    come back into compliance. Moreover, Your grants from a particular
+    Contributor are reinstated on an ongoing basis if such Contributor
+    notifies You of the non-compliance by some reasonable means, this is the
+    first time You have received notice of non-compliance with this License
+    from such Contributor, and You become compliant prior to 30 days after
+    Your receipt of the notice.
+
+    5.2. If You initiate litigation against any entity by asserting a patent
+    infringement claim (excluding declaratory judgment actions,
+    counter-claims, and cross-claims) alleging that a Contributor Version
+    directly or indirectly infringes any patent, then the rights granted to
+    You by any and all Contributors for the Covered Software under Section
+    2.1 of this License shall terminate.
+
+    5.3. In the event of termination under Sections 5.1 or 5.2 above, all
+    end user license agreements (excluding distributors and resellers) which
+    have been validly granted by You or Your distributors under this License
+    prior to termination shall survive termination.
+
+    ************************************************************************
+    *                                                                      *
+    *  6. Disclaimer of Warranty                                           *
+    *  -------------------------                                           *
+    *                                                                      *
+    *  Covered Software is provided under this License on an "as is"       *
+    *  basis, without warranty of any kind, either expressed, implied, or  *
+    *  statutory, including, without limitation, warranties that the       *
+    *  Covered Software is free of defects, merchantable, fit for a        *
+    *  particular purpose or non-infringing. The entire risk as to the     *
+    *  quality and performance of the Covered Software is with You.        *
+    *  Should any Covered Software prove defective in any respect, You     *
+    *  (not any Contributor) assume the cost of any necessary servicing,   *
+    *  repair, or correction. This disclaimer of warranty constitutes an   *
+    *  essential part of this License. No use of any Covered Software is   *
+    *  authorized under this License except under this disclaimer.         *
+    *                                                                      *
+    ************************************************************************
+
+    ************************************************************************
+    *                                                                      *
+    *  7. Limitation of Liability                                          *
+    *  --------------------------                                          *
+    *                                                                      *
+    *  Under no circumstances and under no legal theory, whether tort      *
+    *  (including negligence), contract, or otherwise, shall any           *
+    *  Contributor, or anyone who distributes Covered Software as          *
+    *  permitted above, be liable to You for any direct, indirect,         *
+    *  special, incidental, or consequential damages of any character      *
+    *  including, without limitation, damages for lost profits, loss of    *
+    *  goodwill, work stoppage, computer failure or malfunction, or any    *
+    *  and all other commercial damages or losses, even if such party      *
+    *  shall have been informed of the possibility of such damages. This   *
+    *  limitation of liability shall not apply to liability for death or   *
+    *  personal injury resulting from such party's negligence to the       *
+    *  extent applicable law prohibits such limitation. Some               *
+    *  jurisdictions do not allow the exclusion or limitation of           *
+    *  incidental or consequential damages, so this exclusion and          *
+    *  limitation may not apply to You.                                    *
+    *                                                                      *
+    ************************************************************************
+
+    8. Litigation
+    -------------
+
+    Any litigation relating to this License may be brought only in the
+    courts of a jurisdiction where the defendant maintains its principal
+    place of business and such litigation shall be governed by laws of that
+    jurisdiction, without reference to its conflict-of-law provisions.
+    Nothing in this Section shall prevent a party's ability to bring
+    cross-claims or counter-claims.
+
+    9. Miscellaneous
+    ----------------
+
+    This License represents the complete agreement concerning the subject
+    matter hereof. If any provision of this License is held to be
+    unenforceable, such provision shall be reformed only to the extent
+    necessary to make it enforceable. Any law or regulation which provides
+    that the language of a contract shall be construed against the drafter
+    shall not be used to construe this License against a Contributor.
+
+    10. Versions of the License
+    ---------------------------
+
+    10.1. New Versions
+
+    Mozilla Foundation is the license steward. Except as provided in Section
+    10.3, no one other than the license steward has the right to modify or
+    publish new versions of this License. Each version will be given a
+    distinguishing version number.
+
+    10.2. Effect of New Versions
+
+    You may distribute the Covered Software under the terms of the version
+    of the License under which You originally received the Covered Software,
+    or under the terms of any subsequent version published by the license
+    steward.
+
+    10.3. Modified Versions
+
+    If you create software not governed by this License, and you want to
+    create a new license for such software, you may create and use a
+    modified version of this License if you rename the license and remove
+    any references to the name of the license steward (except to note that
+    such modified license differs from this License).
+
+    10.4. Distributing Source Code Form that is Incompatible With Secondary
+    Licenses
+
+    If You choose to distribute Source Code Form that is Incompatible With
+    Secondary Licenses under the terms of this version of the License, the
+    notice described in Exhibit B of this License must be attached.
+
+    Exhibit A - Source Code Form License Notice
+    -------------------------------------------
+
+      This Source Code Form is subject to the terms of the Mozilla Public
+      License, v. 2.0. If a copy of the MPL was not distributed with this
+      file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+    If it is not possible or desirable to put the notice in a particular
+    file, then You may include the notice in a location (such as a LICENSE
+    file in a relevant directory) where a recipient would be likely to look
+    for such a notice.
+
+    You may add additional accurate notices of copyright ownership.
+
+    Exhibit B - "Incompatible With Secondary Licenses" Notice
+    ---------------------------------------------------------
+
+      This Source Code Form is "Incompatible With Secondary Licenses", as
+      defined by the Mozilla Public License, v. 2.0.
diff --git a/daffodil-cli/src/it/scala/org/apache/daffodil/generating/TestCLIGenerateC.scala b/daffodil-cli/src/it/scala/org/apache/daffodil/generating/TestCLIGenerateC.scala
index f4e5cdc..de004d2 100644
--- a/daffodil-cli/src/it/scala/org/apache/daffodil/generating/TestCLIGenerateC.scala
+++ b/daffodil-cli/src/it/scala/org/apache/daffodil/generating/TestCLIGenerateC.scala
@@ -138,7 +138,7 @@ class TestCLIGenerateC {
   }
 
   @Test def test_CLI_Generate_root(): Unit = {
-    val generateCmd = s"$daffodil generate c -s $schemaFile -r {http://example.com}ex_int32 $outputDir"
+    val generateCmd = s"$daffodil generate c -s $schemaFile -r {http://example.com}ex_ints $outputDir"
     val exitCmd = "exit"
 
     val shell = Util.start("")
@@ -154,14 +154,14 @@ class TestCLIGenerateC {
   }
 
   @Test def test_CLI_Generate_root_error(): Unit = {
-    val generateCmd = s"$daffodil generate c -s $schemaFile -r {ex}ex_int32 $outputDir"
+    val generateCmd = s"$daffodil generate c -s $schemaFile -r {ex}ex_ints $outputDir"
     val exitCmd = "exit"
 
     val shell = Util.start("", expectErr = true)
     try {
       shell.sendLine(generateCmd)
       shell.expect(contains("Schema Definition Error"))
-      shell.expect(contains("No global element found for {ex}ex_int32"))
+      shell.expect(contains("No global element found for {ex}ex_ints"))
       shell.sendLine(exitCmd)
       shell.expect(eof())
     } finally {
diff --git a/daffodil-runtime2/src/main/resources/c/Makefile b/daffodil-runtime2/src/main/resources/c/Makefile
new file mode 100644
index 0000000..d3fcb79
--- /dev/null
+++ b/daffodil-runtime2/src/main/resources/c/Makefile
@@ -0,0 +1,52 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Here's how to compile the C sources into a program for running
+# parse/unparse tests (.dat <-> .xml)
+
+SOURCES = libcli/*.[ch] libruntime/*.[ch]
+PROGRAM = ./daffodil
+CFLAGS = -Wall
+
+$(PROGRAM): $(SOURCES)
+	$(CC) $(CFLAGS) -o $(PROGRAM) -I libcli -I libruntime $(SOURCES) -lmxml -lpthread -lm
+
+# Here's how to run parse/unparse tests (.dat <-> .xml, although you
+# will need to create the .dat and .xml files first)
+
+PARSE_DAT = parse.dat
+UNPARSE_XML = unparse.xml
+
+clean:
+	rm -f $(PROGRAM) test_$(PARSE_DAT) test_$(UNPARSE_XML)
+
+tests: parse-test unparse-test
+
+parse-test: $(PROGRAM)
+	$(PROGRAM) parse $(PARSE_DAT) -o test_$(UNPARSE_XML)
+	xmldiff $(UNPARSE_XML) test_$(UNPARSE_XML)
+
+unparse-test: $(PROGRAM)
+	$(PROGRAM) unparse $(UNPARSE_XML) -o test_$(PARSE_DAT)
+	diff $(PARSE_DAT) test_$(PARSE_DAT)
+
+# You will need the Mini-XML library and xmldiff - here's how to
+# install both in Ubuntu 20.04
+
+deps:
+	sudo apt install libmxml-dev xmldiff
+
+.PHONY: deps tests parse-test unparse-test
diff --git a/daffodil-runtime2/src/main/resources/c/libcli/xml_reader.c b/daffodil-runtime2/src/main/resources/c/libcli/xml_reader.c
index 763c5e3..175ca52 100644
--- a/daffodil-runtime2/src/main/resources/c/libcli/xml_reader.c
+++ b/daffodil-runtime2/src/main/resources/c/libcli/xml_reader.c
@@ -22,7 +22,7 @@
 #include <stdint.h>   // for intmax_t, int32_t, INT32_MAX, INT32_MIN
 #include <string.h>   // for strcmp, strlen, strncmp
 
-// Convert an XML element's text to an integer (BSD function not
+// Convert an XML element's text to a signed integer (BSD function not
 // widely available, so roll our own function based on strtoimax)
 
 static intmax_t
@@ -60,6 +60,43 @@ strtonum(const char *numptr, intmax_t minval, intmax_t maxval,
     return value;
 }
 
+// Convert an XML element's text to an unsigned integer (roll our own
+// function based on strtoumax)
+
+static uintmax_t
+strtounum(const char *numptr, uintmax_t maxval, const char **errstrp)
+{
+    char *endptr = NULL;
+
+    // Clear errno to detect failure after calling strtoumax
+    errno = 0;
+    const uintmax_t value = strtoumax(numptr, &endptr, 10);
+
+    // Report any issues converting the string to a number
+    if (errno != 0)
+    {
+        *errstrp = "Error converting XML data to integer";
+    }
+    else if (endptr == numptr)
+    {
+        *errstrp = "Found no number in XML data";
+    }
+    else if (*endptr != '\0')
+    {
+        *errstrp = "Found non-number characters in XML data";
+    }
+    else if (value > maxval)
+    {
+        *errstrp = "Number in XML data out of range";
+    }
+    else
+    {
+        *errstrp = NULL;
+    }
+
+    return value;
+}
+
 // Read XML data from file before walking infoset
 
 static const char *
@@ -187,25 +224,25 @@ xmlIntegerElem(XMLReader *reader, const ERD *erd, void *intLocation)
             // Check for any errors getting the integer number
             const char *errstr = NULL;
 
-            // Need to handle varying bit lengths and signedness
+            // Handle varying bit lengths of both signed & unsigned numbers
             const enum TypeCode typeCode = erd->typeCode;
             switch (typeCode)
             {
             case PRIMITIVE_UINT64:
                 *(uint64_t *)intLocation =
-                    (uint64_t)strtonum(number_from_xml, 0, UINT64_MAX, &errstr);
+                    (uint64_t)strtounum(number_from_xml, UINT64_MAX, &errstr);
                 break;
             case PRIMITIVE_UINT32:
                 *(uint32_t *)intLocation =
-                    (uint32_t)strtonum(number_from_xml, 0, UINT32_MAX, &errstr);
+                    (uint32_t)strtounum(number_from_xml, UINT32_MAX, &errstr);
                 break;
             case PRIMITIVE_UINT16:
                 *(uint16_t *)intLocation =
-                    (uint16_t)strtonum(number_from_xml, 0, UINT16_MAX, &errstr);
+                    (uint16_t)strtounum(number_from_xml, UINT16_MAX, &errstr);
                 break;
             case PRIMITIVE_UINT8:
                 *(uint8_t *)intLocation =
-                    (uint8_t)strtonum(number_from_xml, 0, UINT8_MAX, &errstr);
+                    (uint8_t)strtounum(number_from_xml, UINT8_MAX, &errstr);
                 break;
             case PRIMITIVE_INT64:
                 *(int64_t *)intLocation = (int64_t)strtonum(
diff --git a/daffodil-runtime2/src/main/resources/c/libcli/xml_writer.c b/daffodil-runtime2/src/main/resources/c/libcli/xml_writer.c
index 791968b..9a0be6d 100644
--- a/daffodil-runtime2/src/main/resources/c/libcli/xml_writer.c
+++ b/daffodil-runtime2/src/main/resources/c/libcli/xml_writer.c
@@ -107,7 +107,7 @@ xmlIntegerElem(XMLWriter *writer, const ERD *erd, const void *intLocation)
         mxmlElementSetAttr(simple, xmlns, ns);
     }
 
-    // Need to handle varying bit lengths and signedness
+    // Handle varying bit lengths of both signed & unsigned numbers
     const enum TypeCode typeCode = erd->typeCode;
     mxml_node_t *       text = NULL;
     switch (typeCode)
diff --git a/daffodil-runtime2/src/main/resources/examples/ex_int32.c b/daffodil-runtime2/src/main/resources/examples/ex_int32.c
deleted file mode 100644
index 5e38ae0..0000000
--- a/daffodil-runtime2/src/main/resources/examples/ex_int32.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "ex_int32.h" // for generated code structs
-#include <endian.h>   // for be32toh, htobe32
-#include <stddef.h>   // for ptrdiff_t
-#include <stdio.h>    // for NULL, fread, fwrite, size_t, FILE
-
-// Prototypes needed for compilation
-
-static void        c2_initSelf(c2 *instance);
-static const char *c2_parseSelf(c2 *instance, const PState *pstate);
-static const char *c2_unparseSelf(const c2 *instance, const UState *ustate);
-static void        ex_int32_initSelf(ex_int32 *instance);
-static const char *ex_int32_parseSelf(ex_int32 *instance, const PState *pstate);
-static const char *ex_int32_unparseSelf(const ex_int32 *instance, const UState *ustate);
-
-// Metadata singletons
-
-static const ERD e1_ERD = {
-    {
-        NULL, // namedQName.prefix
-        "e1", // namedQName.local
-        NULL, // namedQName.ns
-    },
-    PRIMITIVE_INT32, // typeCode
-    0,               // numChildren
-    NULL,            // offsets
-    NULL,            // childrenERDs
-    NULL,            // initSelf
-    NULL,            // parseSelf
-    NULL,            // unparseSelf
-};
-
-static const ERD e2_ERD = {
-    {
-        NULL, // namedQName.prefix
-        "e2", // namedQName.local
-        NULL, // namedQName.ns
-    },
-    PRIMITIVE_INT32, // typeCode
-    0,               // numChildren
-    NULL,            // offsets
-    NULL,            // childrenERDs
-    NULL,            // initSelf
-    NULL,            // parseSelf
-    NULL,            // unparseSelf
-};
-
-static const ERD e3_ERD = {
-    {
-        NULL, // namedQName.prefix
-        "e3", // namedQName.local
-        NULL, // namedQName.ns
-    },
-    PRIMITIVE_INT32, // typeCode
-    0,               // numChildren
-    NULL,            // offsets
-    NULL,            // childrenERDs
-    NULL,            // initSelf
-    NULL,            // parseSelf
-    NULL,            // unparseSelf
-};
-
-static const c2 c2_compute_ERD_offsets;
-
-static const ptrdiff_t c2_offsets[2] = {
-    (char *)&c2_compute_ERD_offsets.e2 - (char *)&c2_compute_ERD_offsets,
-    (char *)&c2_compute_ERD_offsets.e3 - (char *)&c2_compute_ERD_offsets};
-
-static const ERD *c2_childrenERDs[2] = {&e2_ERD, &e3_ERD};
-
-static const ERD c2_ERD = {
-    {
-        NULL, // namedQName.prefix
-        "c2", // namedQName.local
-        NULL, // namedQName.ns
-    },
-    COMPLEX,                         // typeCode
-    2,                               // numChildren
-    c2_offsets,                      // offsets
-    c2_childrenERDs,                 // childrenERDs
-    (ERDInitSelf)&c2_initSelf,       // initSelf
-    (ERDParseSelf)&c2_parseSelf,     // parseSelf
-    (ERDUnparseSelf)&c2_unparseSelf, // unparseSelf
-};
-
-static const ex_int32 ex_int32_compute_ERD_offsets;
-
-static const ptrdiff_t ex_int32_offsets[2] = {
-    (char *)&ex_int32_compute_ERD_offsets.e1 - (char *)&ex_int32_compute_ERD_offsets,
-    (char *)&ex_int32_compute_ERD_offsets.c2 - (char *)&ex_int32_compute_ERD_offsets};
-
-static const ERD *ex_int32_childrenERDs[2] = {&e1_ERD, &c2_ERD};
-
-static const ERD ex_int32_ERD = {
-    {
-        NULL, // namedQName.prefix
-        "ex_int32", // namedQName.local
-        "http://example.com", // namedQName.ns
-    },
-    COMPLEX,                         // typeCode
-    2,                               // numChildren
-    ex_int32_offsets,                      // offsets
-    ex_int32_childrenERDs,                 // childrenERDs
-    (ERDInitSelf)&ex_int32_initSelf,       // initSelf
-    (ERDParseSelf)&ex_int32_parseSelf,     // parseSelf
-    (ERDUnparseSelf)&ex_int32_unparseSelf, // unparseSelf
-};
-
-// Return a root element to be used for parsing or unparsing
-
-InfosetBase *
-rootElement()
-{
-    static ex_int32    instance;
-    InfosetBase *root = &instance._base;
-    ex_int32_ERD.initSelf(root);
-    return root;
-}
-
-// Methods to initialize, parse, and unparse infoset nodes
-
-static inline uint8_t be8toh(uint8_t be8b) { return be8b; }
-static inline uint8_t htobe8(uint8_t h8b) { return h8b; }
-
-static void
-c2_initSelf(c2 *instance)
-{
-    instance->e2 = 0xCDCDCDCD;
-    instance->e3 = 0xCDCDCDCD;
-    instance->_base.erd = &c2_ERD;
-}
-
-static const char *
-c2_parseSelf(c2 *instance, const PState *pstate)
-{
-    const char *error_msg = NULL;
-    if (!error_msg)
-    {
-        char   buffer[sizeof(uint32_t)];
-        size_t count = fread(&buffer, 1, sizeof(buffer), pstate->stream);
-        if (count < sizeof(buffer))
-        {
-            error_msg = eof_or_error_msg(pstate->stream);
-        }
-        instance->e2 = be32toh(*((uint32_t *)(&buffer)));
-    }
-    if (!error_msg)
-    {
-        char   buffer[sizeof(uint32_t)];
-        size_t count = fread(&buffer, 1, sizeof(buffer), pstate->stream);
-        if (count < sizeof(buffer))
-        {
-            error_msg = eof_or_error_msg(pstate->stream);
-        }
-        instance->e3 = be32toh(*((uint32_t *)(&buffer)));
-    }
-    return error_msg;
-}
-
-static const char *
-c2_unparseSelf(const c2 *instance, const UState *ustate)
-{
-    const char *error_msg = NULL;
-    if (!error_msg)
-    {
-        union
-        {
-            char     c_val[sizeof(uint32_t)];
-            uint32_t i_val;
-        } buffer;
-        buffer.i_val = htobe32(instance->e2);
-        size_t count = fwrite(buffer.c_val, 1, sizeof(buffer), ustate->stream);
-        if (count < sizeof(buffer))
-        {
-            error_msg = eof_or_error_msg(ustate->stream);
-        }
-    }
-    if (!error_msg)
-    {
-        union
-        {
-            char     c_val[sizeof(uint32_t)];
-            uint32_t i_val;
-        } buffer;
-        buffer.i_val = htobe32(instance->e3);
-        size_t count = fwrite(buffer.c_val, 1, sizeof(buffer), ustate->stream);
-        if (count < sizeof(buffer))
-        {
-            error_msg = eof_or_error_msg(ustate->stream);
-        }
-    }
-    return error_msg;
-}
-
-static void
-ex_int32_initSelf(ex_int32 *instance)
-{
-    instance->e1 = 0xCDCDCDCD;
-    c2_initSelf(&instance->c2);
-    instance->_base.erd = &ex_int32_ERD;
-}
-
-static const char *
-ex_int32_parseSelf(ex_int32 *instance, const PState *pstate)
-{
-    const char *error_msg = NULL;
-    if (!error_msg)
-    {
-        char   buffer[sizeof(uint32_t)];
-        size_t count = fread(&buffer, 1, sizeof(buffer), pstate->stream);
-        if (count < sizeof(buffer))
-        {
-            error_msg = eof_or_error_msg(pstate->stream);
-        }
-        instance->e1 = be32toh(*((uint32_t *)(&buffer)));
-    }
-    if (!error_msg)
-    {
-        error_msg = c2_parseSelf(&instance->c2, pstate);
-    }
-    return error_msg;
-}
-
-static const char *
-ex_int32_unparseSelf(const ex_int32 *instance, const UState *ustate)
-{
-    const char *error_msg = NULL;
-    if (!error_msg)
-    {
-        union
-        {
-            char     c_val[sizeof(uint32_t)];
-            uint32_t i_val;
-        } buffer;
-        buffer.i_val = htobe32(instance->e1);
-        size_t count = fwrite(buffer.c_val, 1, sizeof(buffer), ustate->stream);
-        if (count < sizeof(buffer))
-        {
-            error_msg = eof_or_error_msg(ustate->stream);
-        }
-    }
-    if (!error_msg)
-    {
-        error_msg = c2_unparseSelf(&instance->c2, ustate);
-    }
-    return error_msg;
-}
diff --git a/daffodil-runtime2/src/main/resources/examples/ex_ints.c b/daffodil-runtime2/src/main/resources/examples/ex_ints.c
new file mode 100644
index 0000000..2db53e2
--- /dev/null
+++ b/daffodil-runtime2/src/main/resources/examples/ex_ints.c
@@ -0,0 +1,766 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ex_ints.h" // for generated code structs
+#include <endian.h>         // for be32toh, htobe32, etc.
+#include <stddef.h>         // for ptrdiff_t
+#include <stdio.h>          // for NULL, fread, fwrite, size_t, FILE
+
+// Prototypes needed for compilation
+
+static void        ex_ints_initSelf(ex_ints *instance);
+static const char *ex_ints_parseSelf(ex_ints *instance, const PState *pstate);
+static const char *ex_ints_unparseSelf(const ex_ints *instance, const UState *ustate);
+
+// Metadata singletons
+
+static const ERD be_uint64_ERD = {
+    {
+        NULL, // namedQName.prefix
+        "be_uint64", // namedQName.local
+        NULL, // namedQName.ns
+    },
+    PRIMITIVE_UINT64, // typeCode
+    0,               // numChildren
+    NULL,            // offsets
+    NULL,            // childrenERDs
+    NULL,            // initSelf
+    NULL,            // parseSelf
+    NULL,            // unparseSelf
+};
+
+static const ERD be_uint32_ERD = {
+    {
+        NULL, // namedQName.prefix
+        "be_uint32", // namedQName.local
+        NULL, // namedQName.ns
+    },
+    PRIMITIVE_UINT32, // typeCode
+    0,               // numChildren
+    NULL,            // offsets
+    NULL,            // childrenERDs
+    NULL,            // initSelf
+    NULL,            // parseSelf
+    NULL,            // unparseSelf
+};
+
+static const ERD be_uint16_ERD = {
+    {
+        NULL, // namedQName.prefix
+        "be_uint16", // namedQName.local
+        NULL, // namedQName.ns
+    },
+    PRIMITIVE_UINT16, // typeCode
+    0,               // numChildren
+    NULL,            // offsets
+    NULL,            // childrenERDs
+    NULL,            // initSelf
+    NULL,            // parseSelf
+    NULL,            // unparseSelf
+};
+
+static const ERD be_uint8_ERD = {
+    {
+        NULL, // namedQName.prefix
+        "be_uint8", // namedQName.local
+        NULL, // namedQName.ns
+    },
+    PRIMITIVE_UINT8, // typeCode
+    0,               // numChildren
+    NULL,            // offsets
+    NULL,            // childrenERDs
+    NULL,            // initSelf
+    NULL,            // parseSelf
+    NULL,            // unparseSelf
+};
+
+static const ERD be_int64_ERD = {
+    {
+        NULL, // namedQName.prefix
+        "be_int64", // namedQName.local
+        NULL, // namedQName.ns
+    },
+    PRIMITIVE_INT64, // typeCode
+    0,               // numChildren
+    NULL,            // offsets
+    NULL,            // childrenERDs
+    NULL,            // initSelf
+    NULL,            // parseSelf
+    NULL,            // unparseSelf
+};
+
+static const ERD be_int32_ERD = {
+    {
+        NULL, // namedQName.prefix
+        "be_int32", // namedQName.local
+        NULL, // namedQName.ns
+    },
+    PRIMITIVE_INT32, // typeCode
+    0,               // numChildren
+    NULL,            // offsets
+    NULL,            // childrenERDs
+    NULL,            // initSelf
+    NULL,            // parseSelf
+    NULL,            // unparseSelf
+};
+
+static const ERD be_int16_ERD = {
+    {
+        NULL, // namedQName.prefix
+        "be_int16", // namedQName.local
+        NULL, // namedQName.ns
+    },
+    PRIMITIVE_INT16, // typeCode
+    0,               // numChildren
+    NULL,            // offsets
+    NULL,            // childrenERDs
+    NULL,            // initSelf
+    NULL,            // parseSelf
+    NULL,            // unparseSelf
+};
+
+static const ERD be_int8_ERD = {
+    {
+        NULL, // namedQName.prefix
+        "be_int8", // namedQName.local
+        NULL, // namedQName.ns
+    },
+    PRIMITIVE_INT8, // typeCode
+    0,               // numChildren
+    NULL,            // offsets
+    NULL,            // childrenERDs
+    NULL,            // initSelf
+    NULL,            // parseSelf
+    NULL,            // unparseSelf
+};
+
+static const ERD le_uint64_ERD = {
+    {
+        NULL, // namedQName.prefix
+        "le_uint64", // namedQName.local
+        NULL, // namedQName.ns
+    },
+    PRIMITIVE_UINT64, // typeCode
+    0,               // numChildren
+    NULL,            // offsets
+    NULL,            // childrenERDs
+    NULL,            // initSelf
+    NULL,            // parseSelf
+    NULL,            // unparseSelf
+};
+
+static const ERD le_uint32_ERD = {
+    {
+        NULL, // namedQName.prefix
+        "le_uint32", // namedQName.local
+        NULL, // namedQName.ns
+    },
+    PRIMITIVE_UINT32, // typeCode
+    0,               // numChildren
+    NULL,            // offsets
+    NULL,            // childrenERDs
+    NULL,            // initSelf
+    NULL,            // parseSelf
+    NULL,            // unparseSelf
+};
+
+static const ERD le_uint16_ERD = {
+    {
+        NULL, // namedQName.prefix
+        "le_uint16", // namedQName.local
+        NULL, // namedQName.ns
+    },
+    PRIMITIVE_UINT16, // typeCode
+    0,               // numChildren
+    NULL,            // offsets
+    NULL,            // childrenERDs
+    NULL,            // initSelf
+    NULL,            // parseSelf
+    NULL,            // unparseSelf
+};
+
+static const ERD le_uint8_ERD = {
+    {
+        NULL, // namedQName.prefix
+        "le_uint8", // namedQName.local
+        NULL, // namedQName.ns
+    },
+    PRIMITIVE_UINT8, // typeCode
+    0,               // numChildren
+    NULL,            // offsets
+    NULL,            // childrenERDs
+    NULL,            // initSelf
+    NULL,            // parseSelf
+    NULL,            // unparseSelf
+};
+
+static const ERD le_int64_ERD = {
+    {
+        NULL, // namedQName.prefix
+        "le_int64", // namedQName.local
+        NULL, // namedQName.ns
+    },
+    PRIMITIVE_INT64, // typeCode
+    0,               // numChildren
+    NULL,            // offsets
+    NULL,            // childrenERDs
+    NULL,            // initSelf
+    NULL,            // parseSelf
+    NULL,            // unparseSelf
+};
+
+static const ERD le_int32_ERD = {
+    {
+        NULL, // namedQName.prefix
+        "le_int32", // namedQName.local
+        NULL, // namedQName.ns
+    },
+    PRIMITIVE_INT32, // typeCode
+    0,               // numChildren
+    NULL,            // offsets
+    NULL,            // childrenERDs
+    NULL,            // initSelf
+    NULL,            // parseSelf
+    NULL,            // unparseSelf
+};
+
+static const ERD le_int16_ERD = {
+    {
+        NULL, // namedQName.prefix
+        "le_int16", // namedQName.local
+        NULL, // namedQName.ns
+    },
+    PRIMITIVE_INT16, // typeCode
+    0,               // numChildren
+    NULL,            // offsets
+    NULL,            // childrenERDs
+    NULL,            // initSelf
+    NULL,            // parseSelf
+    NULL,            // unparseSelf
+};
+
+static const ERD le_int8_ERD = {
+    {
+        NULL, // namedQName.prefix
+        "le_int8", // namedQName.local
+        NULL, // namedQName.ns
+    },
+    PRIMITIVE_INT8, // typeCode
+    0,               // numChildren
+    NULL,            // offsets
+    NULL,            // childrenERDs
+    NULL,            // initSelf
+    NULL,            // parseSelf
+    NULL,            // unparseSelf
+};
+
+static const ex_ints ex_ints_compute_ERD_offsets;
+
+static const ptrdiff_t ex_ints_offsets[16] = {
+    (char *)&ex_ints_compute_ERD_offsets.be_uint64 - (char *)&ex_ints_compute_ERD_offsets,
+    (char *)&ex_ints_compute_ERD_offsets.be_uint32 - (char *)&ex_ints_compute_ERD_offsets,
+    (char *)&ex_ints_compute_ERD_offsets.be_uint16 - (char *)&ex_ints_compute_ERD_offsets,
+    (char *)&ex_ints_compute_ERD_offsets.be_uint8 - (char *)&ex_ints_compute_ERD_offsets,
+    (char *)&ex_ints_compute_ERD_offsets.be_int64 - (char *)&ex_ints_compute_ERD_offsets,
+    (char *)&ex_ints_compute_ERD_offsets.be_int32 - (char *)&ex_ints_compute_ERD_offsets,
+    (char *)&ex_ints_compute_ERD_offsets.be_int16 - (char *)&ex_ints_compute_ERD_offsets,
+    (char *)&ex_ints_compute_ERD_offsets.be_int8 - (char *)&ex_ints_compute_ERD_offsets,
+    (char *)&ex_ints_compute_ERD_offsets.le_uint64 - (char *)&ex_ints_compute_ERD_offsets,
+    (char *)&ex_ints_compute_ERD_offsets.le_uint32 - (char *)&ex_ints_compute_ERD_offsets,
+    (char *)&ex_ints_compute_ERD_offsets.le_uint16 - (char *)&ex_ints_compute_ERD_offsets,
+    (char *)&ex_ints_compute_ERD_offsets.le_uint8 - (char *)&ex_ints_compute_ERD_offsets,
+    (char *)&ex_ints_compute_ERD_offsets.le_int64 - (char *)&ex_ints_compute_ERD_offsets,
+    (char *)&ex_ints_compute_ERD_offsets.le_int32 - (char *)&ex_ints_compute_ERD_offsets,
+    (char *)&ex_ints_compute_ERD_offsets.le_int16 - (char *)&ex_ints_compute_ERD_offsets,
+    (char *)&ex_ints_compute_ERD_offsets.le_int8 - (char *)&ex_ints_compute_ERD_offsets
+};
+
+static const ERD *ex_ints_childrenERDs[16] = {
+    &be_uint64_ERD,
+    &be_uint32_ERD,
+    &be_uint16_ERD,
+    &be_uint8_ERD,
+    &be_int64_ERD,
+    &be_int32_ERD,
+    &be_int16_ERD,
+    &be_int8_ERD,
+    &le_uint64_ERD,
+    &le_uint32_ERD,
+    &le_uint16_ERD,
+    &le_uint8_ERD,
+    &le_int64_ERD,
+    &le_int32_ERD,
+    &le_int16_ERD,
+    &le_int8_ERD
+};
+
+static const ERD ex_ints_ERD = {
+    {
+        NULL, // namedQName.prefix
+        "ex_ints", // namedQName.local
+        "http://example.com", // namedQName.ns
+    },
+    COMPLEX,                         // typeCode
+    16,                               // numChildren
+    ex_ints_offsets,                      // offsets
+    ex_ints_childrenERDs,                 // childrenERDs
+    (ERDInitSelf)&ex_ints_initSelf,       // initSelf
+    (ERDParseSelf)&ex_ints_parseSelf,     // parseSelf
+    (ERDUnparseSelf)&ex_ints_unparseSelf, // unparseSelf
+};
+
+// Return a root element to be used for parsing or unparsing
+
+InfosetBase *
+rootElement()
+{
+    static ex_ints    instance;
+    InfosetBase *root = &instance._base;
+    ex_ints_ERD.initSelf(root);
+    return root;
+}
+
+// Degenerate cases of endian-conversion functions called by code
+// generator since <endian.h> handles only 16, 32, and 64-bit cases
+
+static inline uint8_t htobe8(uint8_t h8b) { return h8b; }
+static inline uint8_t htole8(uint8_t h8b) { return h8b; }
+static inline uint8_t be8toh(uint8_t be8b) { return be8b; }
+static inline uint8_t le8toh(uint8_t le8b) { return le8b; }
+
+// Methods to initialize, parse, and unparse infoset nodes
+
+static void
+ex_ints_initSelf(ex_ints *instance)
+{
+    instance->be_uint64 = 0xCCCCCCCCCCCCCCCC;
+    instance->be_uint32 = 0xCCCCCCCC;
+    instance->be_uint16 = 0xCCCC;
+    instance->be_uint8 = 0xCC;
+    instance->be_int64 = 0xCCCCCCCCCCCCCCCC;
+    instance->be_int32 = 0xCCCCCCCC;
+    instance->be_int16 = 0xCCCC;
+    instance->be_int8 = 0xCC;
+    instance->le_uint64 = 0xCCCCCCCCCCCCCCCC;
+    instance->le_uint32 = 0xCCCCCCCC;
+    instance->le_uint16 = 0xCCCC;
+    instance->le_uint8 = 0xCC;
+    instance->le_int64 = 0xCCCCCCCCCCCCCCCC;
+    instance->le_int32 = 0xCCCCCCCC;
+    instance->le_int16 = 0xCCCC;
+    instance->le_int8 = 0xCC;
+    instance->_base.erd = &ex_ints_ERD;
+}
+
+static const char *
+ex_ints_parseSelf(ex_ints *instance, const PState *pstate)
+{
+    const char *error_msg = NULL;
+    if (!error_msg)
+    {
+        char   buffer[sizeof(uint64_t)];
+        size_t count = fread(&buffer, 1, sizeof(buffer), pstate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(pstate->stream);
+        }
+        instance->be_uint64 = be64toh(*((uint64_t *)(&buffer)));
+    }
+    if (!error_msg)
+    {
+        char   buffer[sizeof(uint32_t)];
+        size_t count = fread(&buffer, 1, sizeof(buffer), pstate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(pstate->stream);
+        }
+        instance->be_uint32 = be32toh(*((uint32_t *)(&buffer)));
+    }
+    if (!error_msg)
+    {
+        char   buffer[sizeof(uint16_t)];
+        size_t count = fread(&buffer, 1, sizeof(buffer), pstate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(pstate->stream);
+        }
+        instance->be_uint16 = be16toh(*((uint16_t *)(&buffer)));
+    }
+    if (!error_msg)
+    {
+        char   buffer[sizeof(uint8_t)];
+        size_t count = fread(&buffer, 1, sizeof(buffer), pstate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(pstate->stream);
+        }
+        instance->be_uint8 = be8toh(*((uint8_t *)(&buffer)));
+    }
+    if (!error_msg)
+    {
+        char   buffer[sizeof(uint64_t)];
+        size_t count = fread(&buffer, 1, sizeof(buffer), pstate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(pstate->stream);
+        }
+        instance->be_int64 = be64toh(*((uint64_t *)(&buffer)));
+    }
+    if (!error_msg)
+    {
+        char   buffer[sizeof(uint32_t)];
+        size_t count = fread(&buffer, 1, sizeof(buffer), pstate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(pstate->stream);
+        }
+        instance->be_int32 = be32toh(*((uint32_t *)(&buffer)));
+    }
+    if (!error_msg)
+    {
+        char   buffer[sizeof(uint16_t)];
+        size_t count = fread(&buffer, 1, sizeof(buffer), pstate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(pstate->stream);
+        }
+        instance->be_int16 = be16toh(*((uint16_t *)(&buffer)));
+    }
+    if (!error_msg)
+    {
+        char   buffer[sizeof(uint8_t)];
+        size_t count = fread(&buffer, 1, sizeof(buffer), pstate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(pstate->stream);
+        }
+        instance->be_int8 = be8toh(*((uint8_t *)(&buffer)));
+    }
+    if (!error_msg)
+    {
+        char   buffer[sizeof(uint64_t)];
+        size_t count = fread(&buffer, 1, sizeof(buffer), pstate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(pstate->stream);
+        }
+        instance->le_uint64 = le64toh(*((uint64_t *)(&buffer)));
+    }
+    if (!error_msg)
+    {
+        char   buffer[sizeof(uint32_t)];
+        size_t count = fread(&buffer, 1, sizeof(buffer), pstate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(pstate->stream);
+        }
+        instance->le_uint32 = le32toh(*((uint32_t *)(&buffer)));
+    }
+    if (!error_msg)
+    {
+        char   buffer[sizeof(uint16_t)];
+        size_t count = fread(&buffer, 1, sizeof(buffer), pstate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(pstate->stream);
+        }
+        instance->le_uint16 = le16toh(*((uint16_t *)(&buffer)));
+    }
+    if (!error_msg)
+    {
+        char   buffer[sizeof(uint8_t)];
+        size_t count = fread(&buffer, 1, sizeof(buffer), pstate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(pstate->stream);
+        }
+        instance->le_uint8 = le8toh(*((uint8_t *)(&buffer)));
+    }
+    if (!error_msg)
+    {
+        char   buffer[sizeof(uint64_t)];
+        size_t count = fread(&buffer, 1, sizeof(buffer), pstate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(pstate->stream);
+        }
+        instance->le_int64 = le64toh(*((uint64_t *)(&buffer)));
+    }
+    if (!error_msg)
+    {
+        char   buffer[sizeof(uint32_t)];
+        size_t count = fread(&buffer, 1, sizeof(buffer), pstate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(pstate->stream);
+        }
+        instance->le_int32 = le32toh(*((uint32_t *)(&buffer)));
+    }
+    if (!error_msg)
+    {
+        char   buffer[sizeof(uint16_t)];
+        size_t count = fread(&buffer, 1, sizeof(buffer), pstate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(pstate->stream);
+        }
+        instance->le_int16 = le16toh(*((uint16_t *)(&buffer)));
+    }
+    if (!error_msg)
+    {
+        char   buffer[sizeof(uint8_t)];
+        size_t count = fread(&buffer, 1, sizeof(buffer), pstate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(pstate->stream);
+        }
+        instance->le_int8 = le8toh(*((uint8_t *)(&buffer)));
+    }
+    return error_msg;
+}
+
+static const char *
+ex_ints_unparseSelf(const ex_ints *instance, const UState *ustate)
+{
+    const char *error_msg = NULL;
+    if (!error_msg)
+    {
+        union
+        {
+            char     c_val[sizeof(uint64_t)];
+            uint64_t i_val;
+        } buffer;
+        buffer.i_val = htobe64(instance->be_uint64);
+        size_t count = fwrite(buffer.c_val, 1, sizeof(buffer), ustate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(ustate->stream);
+        }
+    }
+    if (!error_msg)
+    {
+        union
+        {
+            char     c_val[sizeof(uint32_t)];
+            uint32_t i_val;
+        } buffer;
+        buffer.i_val = htobe32(instance->be_uint32);
+        size_t count = fwrite(buffer.c_val, 1, sizeof(buffer), ustate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(ustate->stream);
+        }
+    }
+    if (!error_msg)
+    {
+        union
+        {
+            char     c_val[sizeof(uint16_t)];
+            uint16_t i_val;
+        } buffer;
+        buffer.i_val = htobe16(instance->be_uint16);
+        size_t count = fwrite(buffer.c_val, 1, sizeof(buffer), ustate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(ustate->stream);
+        }
+    }
+    if (!error_msg)
+    {
+        union
+        {
+            char     c_val[sizeof(uint8_t)];
+            uint8_t i_val;
+        } buffer;
+        buffer.i_val = htobe8(instance->be_uint8);
+        size_t count = fwrite(buffer.c_val, 1, sizeof(buffer), ustate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(ustate->stream);
+        }
+    }
+    if (!error_msg)
+    {
+        union
+        {
+            char     c_val[sizeof(uint64_t)];
+            uint64_t i_val;
+        } buffer;
+        buffer.i_val = htobe64(instance->be_int64);
+        size_t count = fwrite(buffer.c_val, 1, sizeof(buffer), ustate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(ustate->stream);
+        }
+    }
+    if (!error_msg)
+    {
+        union
+        {
+            char     c_val[sizeof(uint32_t)];
+            uint32_t i_val;
+        } buffer;
+        buffer.i_val = htobe32(instance->be_int32);
+        size_t count = fwrite(buffer.c_val, 1, sizeof(buffer), ustate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(ustate->stream);
+        }
+    }
+    if (!error_msg)
+    {
+        union
+        {
+            char     c_val[sizeof(uint16_t)];
+            uint16_t i_val;
+        } buffer;
+        buffer.i_val = htobe16(instance->be_int16);
+        size_t count = fwrite(buffer.c_val, 1, sizeof(buffer), ustate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(ustate->stream);
+        }
+    }
+    if (!error_msg)
+    {
+        union
+        {
+            char     c_val[sizeof(uint8_t)];
+            uint8_t i_val;
+        } buffer;
+        buffer.i_val = htobe8(instance->be_int8);
+        size_t count = fwrite(buffer.c_val, 1, sizeof(buffer), ustate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(ustate->stream);
+        }
+    }
+    if (!error_msg)
+    {
+        union
+        {
+            char     c_val[sizeof(uint64_t)];
+            uint64_t i_val;
+        } buffer;
+        buffer.i_val = htole64(instance->le_uint64);
+        size_t count = fwrite(buffer.c_val, 1, sizeof(buffer), ustate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(ustate->stream);
+        }
+    }
+    if (!error_msg)
+    {
+        union
+        {
+            char     c_val[sizeof(uint32_t)];
+            uint32_t i_val;
+        } buffer;
+        buffer.i_val = htole32(instance->le_uint32);
+        size_t count = fwrite(buffer.c_val, 1, sizeof(buffer), ustate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(ustate->stream);
+        }
+    }
+    if (!error_msg)
+    {
+        union
+        {
+            char     c_val[sizeof(uint16_t)];
+            uint16_t i_val;
+        } buffer;
+        buffer.i_val = htole16(instance->le_uint16);
+        size_t count = fwrite(buffer.c_val, 1, sizeof(buffer), ustate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(ustate->stream);
+        }
+    }
+    if (!error_msg)
+    {
+        union
+        {
+            char     c_val[sizeof(uint8_t)];
+            uint8_t i_val;
+        } buffer;
+        buffer.i_val = htole8(instance->le_uint8);
+        size_t count = fwrite(buffer.c_val, 1, sizeof(buffer), ustate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(ustate->stream);
+        }
+    }
+    if (!error_msg)
+    {
+        union
+        {
+            char     c_val[sizeof(uint64_t)];
+            uint64_t i_val;
+        } buffer;
+        buffer.i_val = htole64(instance->le_int64);
+        size_t count = fwrite(buffer.c_val, 1, sizeof(buffer), ustate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(ustate->stream);
+        }
+    }
+    if (!error_msg)
+    {
+        union
+        {
+            char     c_val[sizeof(uint32_t)];
+            uint32_t i_val;
+        } buffer;
+        buffer.i_val = htole32(instance->le_int32);
+        size_t count = fwrite(buffer.c_val, 1, sizeof(buffer), ustate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(ustate->stream);
+        }
+    }
+    if (!error_msg)
+    {
+        union
+        {
+            char     c_val[sizeof(uint16_t)];
+            uint16_t i_val;
+        } buffer;
+        buffer.i_val = htole16(instance->le_int16);
+        size_t count = fwrite(buffer.c_val, 1, sizeof(buffer), ustate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(ustate->stream);
+        }
+    }
+    if (!error_msg)
+    {
+        union
+        {
+            char     c_val[sizeof(uint8_t)];
+            uint8_t i_val;
+        } buffer;
+        buffer.i_val = htole8(instance->le_int8);
+        size_t count = fwrite(buffer.c_val, 1, sizeof(buffer), ustate->stream);
+        if (count < sizeof(buffer))
+        {
+            error_msg = eof_or_error_msg(ustate->stream);
+        }
+    }
+    return error_msg;
+}
+
diff --git a/daffodil-runtime2/src/main/resources/examples/ex_int32.h b/daffodil-runtime2/src/main/resources/examples/ex_ints.h
similarity index 69%
rename from daffodil-runtime2/src/main/resources/examples/ex_int32.h
rename to daffodil-runtime2/src/main/resources/examples/ex_ints.h
index b46c30c..bc8ffd8 100644
--- a/daffodil-runtime2/src/main/resources/examples/ex_int32.h
+++ b/daffodil-runtime2/src/main/resources/examples/ex_ints.h
@@ -23,18 +23,25 @@
 
 // Define some infoset structures
 
-typedef struct c2
+typedef struct ex_ints
 {
     InfosetBase _base;
-    int32_t     e2;
-    int32_t     e3;
-} c2;
-
-typedef struct ex_int32
-{
-    InfosetBase _base;
-    int32_t     e1;
-    c2          c2;
-} ex_int32;
+    uint64_t    be_uint64;
+    uint32_t    be_uint32;
+    uint16_t    be_uint16;
+    uint8_t     be_uint8;
+    int64_t     be_int64;
+    int32_t     be_int32;
+    int16_t     be_int16;
+    int8_t      be_int8;
+    uint64_t    le_uint64;
+    uint32_t    le_uint32;
+    uint16_t    le_uint16;
+    uint8_t     le_uint8;
+    int64_t     le_int64;
+    int32_t     le_int32;
+    int16_t     le_int16;
+    int8_t      le_int8;
+} ex_ints;
 
 #endif // GENERATED_CODE_H
diff --git a/daffodil-runtime2/src/main/scala/org/apache/daffodil/runtime2/generators/BinaryIntegerKnownLengthCodeGenerator.scala b/daffodil-runtime2/src/main/scala/org/apache/daffodil/runtime2/generators/BinaryIntegerKnownLengthCodeGenerator.scala
index 2936ea6..f31a162 100644
--- a/daffodil-runtime2/src/main/scala/org/apache/daffodil/runtime2/generators/BinaryIntegerKnownLengthCodeGenerator.scala
+++ b/daffodil-runtime2/src/main/scala/org/apache/daffodil/runtime2/generators/BinaryIntegerKnownLengthCodeGenerator.scala
@@ -39,26 +39,23 @@ trait BinaryIntegerKnownLengthCodeGenerator {
       bo
     }
 
-    // This insures we can use regular java.io library calls.
-    if (e.alignmentValueInBits.intValue() % 8 != 0)
-      e.SDE("Only alignment to 8-bit (1 byte) boundaries is supported.")
-
-    // The restrictions below are ones we want to eventually lift.
-    if (byteOrder ne ByteOrder.BigEndian)
-      e.SDE("Only dfdl:byteOrder 'bigEndian' is supported.")
-
+    // We eventually want to lift this restriction.
     if (e.bitOrder ne BitOrder.MostSignificantBitFirst)
       e.SDE("Only dfdl:bitOrder 'mostSignificantBitFirst' is supported.")
+    if (e.alignmentValueInBits.intValue() % 8 != 0)
+      e.SDE("Only alignment to 8-bit (1 byte) boundaries is supported.")
 
-    // Start generating code snippets
+    // Use an unusual memory bit pattern (magic debug value) to mark fields as
+    // uninitialized in case generated code fails to set them during parsing.
     val initialValue = lengthInBits match {
-      case 8 => "0xCD"
-      case 16 => "0xCDCD"
-      case 32 => "0xCDCDCDCD"
-      case 64 => "0xCDCDCDCDCDCDCDCD"
+      case 8 => "0xCC"
+      case 16 => "0xCCCC"
+      case 32 => "0xCCCCCCCC"
+      case 64 => "0xCCCCCCCCCCCCCCCC"
       case _ => e.SDE("Lengths other than 8, 16, 32, or 64 bits are not supported.")
     }
     val initStatement = s"    instance->$fieldName = $initialValue;"
+    val conv = if (byteOrder eq ByteOrder.BigEndian) "be" else "le"
     val parseStatement =
       s"""    if (!error_msg)
          |    {
@@ -68,7 +65,7 @@ trait BinaryIntegerKnownLengthCodeGenerator {
          |        {
          |            error_msg = eof_or_error_msg(pstate->stream);
          |        }
-         |        instance->$fieldName = be${lengthInBits}toh(*((uint${lengthInBits}_t *)(&buffer)));
+         |        instance->$fieldName = ${conv}${lengthInBits}toh(*((uint${lengthInBits}_t *)(&buffer)));
          |    }""".stripMargin
     val unparseStatement =
       s"""    if (!error_msg)
@@ -78,7 +75,7 @@ trait BinaryIntegerKnownLengthCodeGenerator {
          |            char     c_val[sizeof(uint${lengthInBits}_t)];
          |            uint${lengthInBits}_t i_val;
          |        } buffer;
-         |        buffer.i_val = htobe${lengthInBits}(instance->$fieldName);
+         |        buffer.i_val = hto${conv}${lengthInBits}(instance->$fieldName);
          |        size_t count = fwrite(buffer.c_val, 1, sizeof(buffer), ustate->stream);
          |        if (count < sizeof(buffer))
          |        {
diff --git a/daffodil-runtime2/src/main/scala/org/apache/daffodil/runtime2/generators/CodeGeneratorState.scala b/daffodil-runtime2/src/main/scala/org/apache/daffodil/runtime2/generators/CodeGeneratorState.scala
index 0255111..f629f14 100644
--- a/daffodil-runtime2/src/main/scala/org/apache/daffodil/runtime2/generators/CodeGeneratorState.scala
+++ b/daffodil-runtime2/src/main/scala/org/apache/daffodil/runtime2/generators/CodeGeneratorState.scala
@@ -248,7 +248,7 @@ class CodeGeneratorState {
     val finalImplementation = this.finalImplementation.mkString("\n")
     val code =
       s"""#include "generated_code.h" // for generated code structs
-         |#include <endian.h>         // for be32toh, htobe32
+         |#include <endian.h>         // for be32toh, htobe32, etc.
          |#include <stddef.h>         // for ptrdiff_t
          |#include <stdio.h>          // for NULL, fread, fwrite, size_t, FILE
          |
@@ -270,10 +270,15 @@ class CodeGeneratorState {
          |    return root;
          |}
          |
-         |// Methods to initialize, parse, and unparse infoset nodes
+         |// Degenerate cases of endian-conversion functions called by code
+         |// generator since <endian.h> handles only 16, 32, and 64-bit cases
          |
-         |static inline uint8_t be8toh(uint8_t be8b) { return be8b; }
          |static inline uint8_t htobe8(uint8_t h8b) { return h8b; }
+         |static inline uint8_t htole8(uint8_t h8b) { return h8b; }
+         |static inline uint8_t be8toh(uint8_t be8b) { return be8b; }
+         |static inline uint8_t le8toh(uint8_t le8b) { return le8b; }
+         |
+         |// Methods to initialize, parse, and unparse infoset nodes
          |
          |$finalImplementation
          |""".stripMargin
diff --git a/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/TestRuntime2.dfdl.xsd b/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/TestRuntime2.dfdl.xsd
index 88fdf56..5998338 100644
--- a/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/TestRuntime2.dfdl.xsd
+++ b/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/TestRuntime2.dfdl.xsd
@@ -29,8 +29,7 @@
     <xs:annotation>
         <xs:appinfo source="http://www.ogf.org/dfdl/">
             <dfdl:format
-                alignment="8"
-                alignmentUnits="bits"
+                byteOrder="bigEndian"
                 encoding="UTF-8"
                 lengthUnits="bits"
                 representation="binary"
@@ -38,39 +37,43 @@
         </xs:appinfo>
     </xs:annotation>
 
-    <xs:element name="ex_int32">
+    <xs:element name="ex_ints">
         <xs:complexType>
             <xs:sequence>
-                <xs:element name="e1" type="xs:int" />
-                <xs:element name="c2">
-                    <xs:complexType>
-                        <xs:sequence>
-                            <xs:element name="e2" type="xs:int" />
-                            <xs:element name="e3" type="xs:int" />
-                        </xs:sequence>
-                    </xs:complexType>
-                </xs:element>
+                <xs:element name="be_uint64" type="xs:unsignedLong" />
+                <xs:element name="be_uint32" type="xs:unsignedInt" />
+                <xs:element name="be_uint16" type="xs:unsignedShort" />
+                <xs:element name="be_uint8" type="xs:unsignedByte" />
+                <xs:element name="be_int64" type="xs:long" />
+                <xs:element name="be_int32" type="xs:int" />
+                <xs:element name="be_int16" type="xs:short" />
+                <xs:element name="be_int8" type="xs:byte" />
+                <xs:element name="le_uint64" type="xs:unsignedLong" dfdl:byteOrder="littleEndian" />
+                <xs:element name="le_uint32" type="xs:unsignedInt" dfdl:byteOrder="littleEndian" />
+                <xs:element name="le_uint16" type="xs:unsignedShort" dfdl:byteOrder="littleEndian" />
+                <xs:element name="le_uint8" type="xs:unsignedByte" dfdl:byteOrder="littleEndian" />
+                <xs:element name="le_int64" type="xs:long" dfdl:byteOrder="littleEndian" />
+                <xs:element name="le_int32" type="xs:int" dfdl:byteOrder="littleEndian" />
+                <xs:element name="le_int16" type="xs:short" dfdl:byteOrder="littleEndian" />
+                <xs:element name="le_int8" type="xs:byte" dfdl:byteOrder="littleEndian" />
             </xs:sequence>
         </xs:complexType>
     </xs:element>
 
     <xs:simpleType
         name="int16"
-        dfdl:alignment="16"
         dfdl:length="16"
         dfdl:lengthKind="explicit">
         <xs:restriction base="xs:short"/>
     </xs:simpleType>
     <xs:simpleType
         name="uint8"
-        dfdl:alignment="8"
         dfdl:length="8"
         dfdl:lengthKind="explicit">
         <xs:restriction base="xs:unsignedByte"/>
     </xs:simpleType>
     <xs:simpleType
         name="uint16"
-        dfdl:alignment="16"
         dfdl:length="16"
         dfdl:lengthKind="explicit">
         <xs:restriction base="xs:unsignedShort"/>
diff --git a/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/TestRuntime2.tdml b/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/TestRuntime2.tdml
index 7b85711..3db679c 100644
--- a/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/TestRuntime2.tdml
+++ b/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/TestRuntime2.tdml
@@ -24,7 +24,6 @@ limitations under the License.
   suiteName="TestRuntime2"
   xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
   xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
-  xmlns:ex="http://example.com"
   xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData"
   xmlns="http://example.com">
 
@@ -41,28 +40,28 @@ limitations under the License.
   </tdml:defineConfig>
 
   <tdml:parserTestCase
-    description="Parse example ex_int32"
+    description="Parse example ex_ints"
     model="TestRuntime2.dfdl.xsd"
-    name="ex_int32_parse"
-    root="ex_int32">
+    name="ex_ints_parse"
+    root="ex_ints">
     <tdml:document>
-      <tdml:documentPart type="file">ex_int32_parse</tdml:documentPart>
+      <tdml:documentPart type="file">ex_ints_parse.dat</tdml:documentPart>
     </tdml:document>
     <tdml:infoset>
-      <tdml:dfdlInfoset type="file">ex_int32_unparse</tdml:dfdlInfoset>
+      <tdml:dfdlInfoset type="file">ex_ints_unparse.xml</tdml:dfdlInfoset>
     </tdml:infoset>
   </tdml:parserTestCase>
 
   <tdml:unparserTestCase
-    description="Unparse example ex_int32"
+    description="Unparse example ex_ints"
     model="TestRuntime2.dfdl.xsd"
-    name="ex_int32_unparse"
-    root="ex_int32">
+    name="ex_ints_unparse"
+    root="ex_ints">
     <tdml:infoset>
-      <tdml:dfdlInfoset type="file">ex_int32_unparse</tdml:dfdlInfoset>
+      <tdml:dfdlInfoset type="file">ex_ints_unparse.xml</tdml:dfdlInfoset>
     </tdml:infoset>
     <tdml:document>
-      <tdml:documentPart type="file">ex_int32_parse</tdml:documentPart>
+      <tdml:documentPart type="file">ex_ints_parse.dat</tdml:documentPart>
     </tdml:document>
   </tdml:unparserTestCase>
 
@@ -72,10 +71,10 @@ limitations under the License.
     name="orion_command_parse"
     root="orion_command">
     <tdml:document>
-      <tdml:documentPart type="file">orion_command_parse</tdml:documentPart>
+      <tdml:documentPart type="file">orion_command_parse.dat</tdml:documentPart>
     </tdml:document>
     <tdml:infoset>
-      <tdml:dfdlInfoset type="file">orion_command_unparse</tdml:dfdlInfoset>
+      <tdml:dfdlInfoset type="file">orion_command_unparse.xml</tdml:dfdlInfoset>
     </tdml:infoset>
   </tdml:parserTestCase>
 
@@ -85,10 +84,10 @@ limitations under the License.
     name="orion_command_unparse"
     root="orion_command">
     <tdml:infoset>
-      <tdml:dfdlInfoset type="file">orion_command_unparse</tdml:dfdlInfoset>
+      <tdml:dfdlInfoset type="file">orion_command_unparse.xml</tdml:dfdlInfoset>
     </tdml:infoset>
     <tdml:document>
-      <tdml:documentPart type="file">orion_command_parse</tdml:documentPart>
+      <tdml:documentPart type="file">orion_command_parse.dat</tdml:documentPart>
     </tdml:document>
   </tdml:unparserTestCase>
 
diff --git a/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_int32_parse b/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_int32_parse
deleted file mode 100644
index fce373f..0000000
Binary files a/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_int32_parse and /dev/null differ
diff --git a/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_ints_parse.dat b/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_ints_parse.dat
new file mode 100644
index 0000000..e16cc72
Binary files /dev/null and b/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_ints_parse.dat differ
diff --git a/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_int32_unparse b/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_ints_unparse.xml
similarity index 63%
rename from daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_int32_unparse
rename to daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_ints_unparse.xml
index cad2f06..8874561 100644
--- a/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_int32_unparse
+++ b/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_ints_unparse.xml
@@ -16,10 +16,21 @@
   limitations under the License.
 -->
 
-<ex_int32 xmlns="http://example.com">
-  <e1>1</e1>
-  <c2>
-    <e2>2</e2>
-    <e3>3</e3>
-  </c2>
-</ex_int32>
+<ex_ints xmlns="http://example.com">
+  <be_uint64>64</be_uint64>
+  <be_uint32>32</be_uint32>
+  <be_uint16>16</be_uint16>
+  <be_uint8>8</be_uint8>
+  <be_int64>-64</be_int64>
+  <be_int32>-32</be_int32>
+  <be_int16>-16</be_int16>
+  <be_int8>-8</be_int8>
+  <le_uint64>64</le_uint64>
+  <le_uint32>32</le_uint32>
+  <le_uint16>16</le_uint16>
+  <le_uint8>8</le_uint8>
+  <le_int64>-64</le_int64>
+  <le_int32>-32</le_int32>
+  <le_int16>-16</le_int16>
+  <le_int8>-8</le_int8>
+</ex_ints>
diff --git a/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/orion_command_parse b/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/orion_command_parse.dat
similarity index 100%
rename from daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/orion_command_parse
rename to daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/orion_command_parse.dat
diff --git a/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/orion_command_unparse b/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/orion_command_unparse.xml
similarity index 100%
rename from daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/orion_command_unparse
rename to daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/orion_command_unparse.xml
diff --git a/daffodil-runtime2/src/test/scala/org/apache/daffodil/runtime2/TestRuntime2.scala b/daffodil-runtime2/src/test/scala/org/apache/daffodil/runtime2/TestRuntime2.scala
index 5a5b7e7..88d7e12 100644
--- a/daffodil-runtime2/src/test/scala/org/apache/daffodil/runtime2/TestRuntime2.scala
+++ b/daffodil-runtime2/src/test/scala/org/apache/daffodil/runtime2/TestRuntime2.scala
@@ -31,8 +31,8 @@ object TestRuntime2 {
 class TestRuntime2 {
   import TestRuntime2._
 
-  @Test def test_ex_int32_parse(): Unit = { runner.runOneTest("ex_int32_parse") }
-  @Test def test_ex_int32_unparse(): Unit = { runner.runOneTest("ex_int32_unparse") }
+  @Test def test_ex_ints_parse(): Unit = { runner.runOneTest("ex_ints_parse") }
+  @Test def test_ex_ints_unparse(): Unit = { runner.runOneTest("ex_ints_unparse") }
   @Test def test_orion_command_parse(): Unit = { runner.runOneTest("orion_command_parse") }
   @Test def test_orion_command_unparse(): Unit = { runner.runOneTest("orion_command_unparse") }
 }
diff --git a/project/Rat.scala b/project/Rat.scala
index aa3b78d..803027b 100644
--- a/project/Rat.scala
+++ b/project/Rat.scala
@@ -107,6 +107,8 @@ object Rat {
     file("daffodil-japi/src/test/resources/test/japi/myData16.dat"),
     file("daffodil-japi/src/test/resources/test/japi/myData19.dat"),
     file("daffodil-japi/src/test/resources/test/japi/myDataBroken.dat"),
+    file("daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_ints_parse.dat"),
+    file("daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/orion_command_parse.dat"),
     file("daffodil-sapi/src/test/resources/test/sapi/01very_simple.txt"),
     file("daffodil-sapi/src/test/resources/test/sapi/myData.dat"),
     file("daffodil-sapi/src/test/resources/test/sapi/myData2.dat"),
@@ -116,8 +118,6 @@ object Rat {
     file("daffodil-sapi/src/test/resources/test/sapi/myData16.dat"),
     file("daffodil-sapi/src/test/resources/test/sapi/myData19.dat"),
     file("daffodil-sapi/src/test/resources/test/sapi/myDataBroken.dat"),
-    file("daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_int32_parse"),
-    file("daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/orion_command_parse"),
     file("daffodil-tdml-lib/src/test/resources/test/tdml/test.bin"),
     file("daffodil-tdml-lib/src/test/resources/test/tdml/test.txt"),
     file("daffodil-tdml-processor/src/test/resources/test/tdml/test.bin"),