Numeric Property Test Specifications
Test cases for property names that are numeric or start with numbers.
Test Case: NUMERIC_001 - Properties Starting With Numbers
Purpose
Test parsing of property names that start with numbers.
Input
{
1property = 'value1',
2ndProperty = 'value2',
3rdItem = 'value3'
}
Expected Result
- Property "1property" = "value1"
- Property "2ndProperty" = "value2"
- Property "3rdItem" = "value3"
Notes
Property names starting with digits are valid in TON.
Test Case: NUMERIC_002 - Pure Numeric Property Names
Purpose
Test parsing of property names that are purely numeric.
Input
{
123 = 'value123',
456 = 'value456',
789 = 'value789'
}
Expected Result
- Property "123" = "value123"
- Property "456" = "value456"
- Property "789" = "value789"
Notes
Pure numeric property names are treated as strings internally.
Test Case: NUMERIC_003 - Year Property Names
Purpose
Test using year values as property names.
Input
{
2022 = 450000000,
2023 = 520000000,
2024 = 380000000
}
Expected Result
- Property "2022" = 450000000
- Property "2023" = 520000000
- Property "2024" = 380000000
Use Case
Common pattern for year-based data (revenues, statistics, etc.).
Test Case: NUMERIC_004 - Mixed Property Names
Purpose
Test document with mix of numeric and regular property names.
Input
{
name = 'John',
123 = 'numeric',
age = 30,
2024 = 'year',
active = true
}
Expected Result
- 5 properties total
- Property "name" = "John"
- Property "123" = "numeric"
- Property "age" = 30
- Property "2024" = "year"
- Property "active" = true
Notes
Numeric and regular names can coexist in same object.
Test Case: NUMERIC_005 - Nested Objects with Numeric Properties
Purpose
Test numeric properties in nested object structures.
Input
{
financials = {
revenue = {
2022 = 450000000,
2023 = 520000000,
2024 = 380000000
},
expenses = {
2022 = 400000000,
2023 = 450000000,
2024 = 320000000
}
}
}
Expected Result
- Root has "financials" property
- financials.revenue.2022 = 450000000
- financials.revenue.2023 = 520000000
- financials.revenue.2024 = 380000000
- financials.expenses.2022 = 400000000
- financials.expenses.2023 = 450000000
- financials.expenses.2024 = 320000000
Test Case: NUMERIC_006 - Serialization of Numeric Properties
Purpose
Test that numeric property names serialize correctly.
Input Object
Properties:
"2022" = 100
"2023" = 200
"2024" = 300
"123" = "test"
"regular" = "value"
Expected Serialization
{
2022 = 100,
2023 = 200,
2024 = 300,
123 = "test",
regular = "value"
}
Notes
Numeric names don't need quotes in serialization.
Test Case: NUMERIC_007 - Zero and Negative Numbers
Purpose
Test edge cases with zero and negative numeric property names.
Input
{
0 = 'zero',
00 = 'double zero',
01 = 'zero one',
10 = 'ten'
}
Expected Result
- Property "0" = "zero"
- Property "00" = "double zero"
- Property "01" = "zero one"
- Property "10" = "ten"
Notes
Leading zeros preserved as distinct property names.
Test Case: NUMERIC_008 - Floating Point Property Names
Purpose
Test property names that look like floating point numbers.
Input
{
3.14 = 'pi',
2.718 = 'e',
1.0 = 'one point zero'
}
Expected Result
- Property "3.14" = "pi"
- Property "2.718" = "e"
- Property "1.0" = "one point zero"
Notes
Decimal points allowed in property names.
Test Case: NUMERIC_009 - Scientific Notation Names
Purpose
Test property names that resemble scientific notation.
Input
{
1e3 = 'thousand',
1e6 = 'million',
1.5e2 = 'one fifty'
}
Expected Result
- Property "1e3" = "thousand"
- Property "1e6" = "million"
- Property "1.5e2" = "one fifty"
Test Case: NUMERIC_010 - Property Access
Purpose
Test programmatic access to numeric properties.
Operations
object.GetProperty("123") // String key
object.GetProperty("2024") // Year as string
object["456"] // Bracket notation
Expected Result
- All access methods work with string keys
- No automatic numeric conversion
- Consistent behavior across access patterns
Implementation Notes
- Numeric property names stored as strings internally
- No quotes needed for numeric names in TON syntax
- Parser must distinguish between property names and values
- Leading zeros preserved (01 ≠ 1 as property names)
- Floating point notation allowed in names
- Scientific notation allowed in names
Edge Cases
- Very large numbers as names (999999999999)
- Negative numbers (requires quotes: "-123")
- Hex/binary notation (0xFF, 0b1010) as names
- Unicode digits from other languages
- Mixed alphanumeric (123abc vs abc123)
Common Use Cases
- Year-based data (financial records, statistics)
- ID-based lookups (user IDs, product codes)
- Version numbers (1.0, 2.1, 3.14)
- Indexed data without arrays
- Sparse numeric keys