Netencode Generator Test Specification

This document defines test cases that all netencode language implementations must pass. Each test case is defined using the unified API function names and expected binary output.

Format

Each test case follows this structure:

### Test Name
- **Category**: Basic Types | Composite Types | Complex Scenarios | Error Cases
- **Input**: Function calls using unified API
- **Expected**: Binary output in hex or bytes
- **Description**: What this test validates

Basic Types

Unit Value

Natural Zero

Natural Number

Natural Max U64

Integer Zero

Integer Positive

Integer Negative

Integer Max I64

Integer Min I64

Boolean True

Boolean False

Text Empty

Text Simple

Text With Space

Text UTF8 Accented

Text UTF8 Emoji

Text With Quotes

Text With Newline

Binary Empty

Binary Simple

Binary With Nulls

Composite Types

Tag Simple

Tag Empty Name

Tag With Value

Tag UTF8

Record Single Field

Record Two Fields

Record Alphabetical Sort

Record Explicit Order

List Empty

List Single Item

List Multiple Items

Complex Scenarios

Nested List in Record

All Types Record

Unicode Field Names

Unicode Complex

Unicode Tag Name

Nested Record in List

Field Name Prefixes

Text With Null Byte

Deeply Nested Structures

Large Binary

Error Cases

Natural Negative Error

Natural Overflow Error

Integer Overflow Positive

Integer Overflow Negative

Implementation Notes

  1. All text values must be valid UTF-8
  2. Binary data can contain any byte values
  3. Record fields from dict are sorted alphabetically by key
  4. Record fields from ordered structures preserve insertion order
  5. Empty structures are valid (empty text, binary, list)
  6. Tag names and record field names are UTF-8 encoded
  7. Length prefixes count bytes, not characters