Validator Test Specifications

Conformance Level: Level 3 - Full schema validation support required.

Overview

The validator enforces schema constraints on TON documents.

Test Cases

VALIDATOR_001: Required Fields

Purpose: Validate required field enforcement

Schema:

{(person)
    /name = string(required),
    /age = int(required)
}

Invalid Input: {(person) age = 30}

Expected: Validation error for missing required field "name"

VALIDATOR_002: Type Validation

Purpose: Validate type constraints

Test Cases:

Schema Type Input Value Valid
string "hello"
string 123
int 42
int 3.14

VALIDATOR_003: String Constraints

Purpose: Validate string length and pattern constraints

  • minLength(5): "test" → Invalid, "hello" → Valid
  • maxLength(10): "short" → Valid, "very long string" → Invalid
  • pattern(email): "[email protected]" → Valid, "not-email" → Invalid

VALIDATOR_004: Numeric Constraints

Purpose: Validate numeric range constraints

  • min(0): -1 → Invalid, 0 → Valid, 1 → Valid
  • max(100): 99 → Valid, 100 → Valid, 101 → Invalid
  • range(1,10): 0 → Invalid, 5 → Valid, 11 → Invalid

VALIDATOR_005: Array Validation

Purpose: Validate array constraints

  • minCount(2): [1] → Invalid, [1,2] → Valid
  • maxCount(5): [1,2,3,4,5] → Valid, [1,2,3,4,5,6] → Invalid
  • unique: [1,2,3] → Valid, [1,2,2] → Invalid
  • sorted: [1,2,3] → Valid, [1,3,2] → Invalid