306 lines
5.6 KiB
YAML
306 lines
5.6 KiB
YAML
# Kyler Olsen
|
|
# SLS Test Cases
|
|
# November 2025
|
|
|
|
# Could you now help me by creating test cases. Just start by naming any new categories I should have, then I will ask you to name new tests. Token strings should have their tokens listed with in their data
|
|
|
|
# - name: Test Name
|
|
# code: "Test Code"
|
|
# # Lexed tokens or lexer error
|
|
# tokens:
|
|
# - type: Token Type
|
|
# value: Token Value
|
|
# lexer_error:
|
|
# message: Error message.
|
|
# # Parsed operations or parsing error (if no lexer error)
|
|
# operations:
|
|
# - function: Operation Name
|
|
# parsing_error:
|
|
# message: Error message.
|
|
# # Final stack state and/or runtime error (if no lexer or parsing error)
|
|
# stack_final:
|
|
# - type: Stack Item Type
|
|
# value: Stack Item Value
|
|
# runtime_error:
|
|
# message: Error message.
|
|
|
|
- name: Empty_Statement
|
|
code: ""
|
|
tokens: []
|
|
operations: []
|
|
stack_final: []
|
|
|
|
# Basic Integers
|
|
|
|
- name: Integer Default Decimal 0
|
|
code: "0"
|
|
tokens:
|
|
- type: i64
|
|
value: 0
|
|
operations:
|
|
- function: push
|
|
type: i64
|
|
value: 0
|
|
stack_final:
|
|
- type: i64
|
|
value: 0
|
|
|
|
- name: Integer Default Decimal -1 neg
|
|
code: "-1"
|
|
tokens:
|
|
- type: i64
|
|
value: -1
|
|
operations:
|
|
- function: push
|
|
type: i64
|
|
value: -1
|
|
stack_final:
|
|
- type: i64
|
|
value: -1
|
|
|
|
- name: Integer Default Decimal +1 pos
|
|
code: "+1"
|
|
tokens:
|
|
- type: i64
|
|
value: 1
|
|
operations:
|
|
- function: push
|
|
type: i64
|
|
value: 1
|
|
stack_final:
|
|
- type: i64
|
|
value: 1
|
|
|
|
- name: Integer Default Decimal Leading Zeros
|
|
code: "00042"
|
|
tokens:
|
|
- type: i64
|
|
value: 42
|
|
operations:
|
|
- function: push
|
|
type: i64
|
|
value: 42
|
|
stack_final:
|
|
- type: i64
|
|
value: 42
|
|
|
|
- name: Integer Default Hex 0xFF
|
|
code: "0xFF"
|
|
tokens:
|
|
- type: i64
|
|
value: 255
|
|
operations:
|
|
- function: push
|
|
type: i64
|
|
value: 255
|
|
stack_final:
|
|
- type: i64
|
|
value: 255
|
|
|
|
- name: Integer Default Hex 0xdeadbeef
|
|
code: "0xdeadbeef"
|
|
tokens:
|
|
- type: i64
|
|
value: 3735928559
|
|
operations:
|
|
- function: push
|
|
type: i64
|
|
value: 3735928559
|
|
stack_final:
|
|
- type: i64
|
|
value: 3735928559
|
|
|
|
- name: Integer Default Binary 0b1010
|
|
code: "0b1010"
|
|
tokens:
|
|
- type: i64
|
|
value: 10
|
|
operations:
|
|
- function: push
|
|
type: i64
|
|
value: 10
|
|
stack_final:
|
|
- type: i64
|
|
value: 10
|
|
|
|
- name: Integer Default Octal 0o755
|
|
code: "0o755"
|
|
tokens:
|
|
- type: i64
|
|
value: 493
|
|
operations:
|
|
- function: push
|
|
type: i64
|
|
value: 493
|
|
stack_final:
|
|
- type: i64
|
|
value: 493
|
|
|
|
- name: Integer i8 Decimal 127
|
|
code: "127i8"
|
|
tokens:
|
|
- type: i8
|
|
value: 127
|
|
operations:
|
|
- function: push
|
|
type: i8
|
|
value: 127
|
|
stack_final:
|
|
- type: i8
|
|
value: 127
|
|
|
|
- name: Integer i8 Decimal -128
|
|
code: "-128i8"
|
|
tokens:
|
|
- type: i8
|
|
value: -128
|
|
operations:
|
|
- function: push
|
|
type: i8
|
|
value: -128
|
|
stack_final:
|
|
- type: i8
|
|
value: -128
|
|
|
|
- name: Integer u8 Decimal 255
|
|
code: "255u8"
|
|
tokens:
|
|
- type: u8
|
|
value: 255
|
|
operations:
|
|
- function: push
|
|
type: u8
|
|
value: 255
|
|
stack_final:
|
|
- type: u8
|
|
value: 255
|
|
|
|
- name: Integer Default Decimal with Underscore
|
|
code: "1_000_000"
|
|
tokens:
|
|
- type: i64
|
|
value: 1000000
|
|
operations:
|
|
- function: push
|
|
type: i64
|
|
value: 1000000
|
|
stack_final:
|
|
- type: i64
|
|
value: 1000000
|
|
|
|
- name: Integer Default Decimal with Commas Invalid
|
|
code: "1,000,000"
|
|
lexer_error:
|
|
message: "Invalid numeric literal: unexpected ',' in integer."
|
|
|
|
- name: Integer i8 Overflow
|
|
code: "128i8"
|
|
runtime_error:
|
|
message: "Integer overflow: 128 exceeds range for i8."
|
|
|
|
- name: Integer i8 Underflow
|
|
code: "-129i8"
|
|
runtime_error:
|
|
message: "Integer underflow: -129 exceeds range for i8."
|
|
|
|
- name: Integer Default Invalid Characters
|
|
code: "12a3"
|
|
lexer_error:
|
|
message: "Invalid numeric literal: unexpected character 'a'."
|
|
|
|
- name: Integer Default Whitespace
|
|
code: " 42 "
|
|
tokens:
|
|
- type: i64
|
|
value: 42
|
|
operations:
|
|
- function: push
|
|
type: i64
|
|
value: 42
|
|
stack_final:
|
|
- type: i64
|
|
value: 42
|
|
|
|
- name: Integer Default Invalid Prefix
|
|
code: "0b2"
|
|
lexer_error:
|
|
message: "Invalid binary literal: digit '2' not allowed."
|
|
|
|
- name: Integer Default Invalid Underscore Start
|
|
code: "_42"
|
|
lexer_error:
|
|
message: "Invalid numeric literal: cannot start with underscore."
|
|
|
|
- name: Integer Default Invalid Underscore End
|
|
code: "42_"
|
|
lexer_error:
|
|
message: "Invalid numeric literal: cannot end with underscore."
|
|
|
|
- name: Integer Default Invalid Underscore Double
|
|
code: "4__2"
|
|
lexer_error:
|
|
message: "Invalid numeric literal: consecutive underscores not allowed."
|
|
|
|
# Basic Floats
|
|
# Basic Strings
|
|
# Basic Booleans
|
|
# Basic Identifiers
|
|
# Basic Identifier Literals
|
|
# Basic Arrays
|
|
# Basic Token Strings
|
|
# Stack Operations
|
|
# Arithmetic Operations
|
|
# Comparison Operations
|
|
# Logical Operations
|
|
# Bitwise Operations
|
|
# Function Definitions
|
|
# Lambda Functions
|
|
# Conditional Statements
|
|
# While Loops
|
|
# For Loops
|
|
# Match Statements
|
|
# Structs
|
|
# Unions
|
|
# Enums
|
|
# Array Operations
|
|
# Array Combinators
|
|
# Array Arithmetic
|
|
# Array Manipulation
|
|
# Type Inference
|
|
# Type Tuples
|
|
# Trait Definition
|
|
# Trait Implementation
|
|
# Trait Inheritance
|
|
# Stackable Trait
|
|
# Addable Trait
|
|
# Multiplyable Trait
|
|
# Exponentiable Trait
|
|
# Logarithmic Trait
|
|
# Number Trait
|
|
# Orderable Trait
|
|
# Equatable Trait
|
|
# Comparable Trait
|
|
# Logical Trait
|
|
# Bitwise Trait
|
|
# Sized Trait
|
|
# Selectable<T> Trait
|
|
# Sliceable Trait
|
|
# Concatenable Trait
|
|
# ArrayOf<T> Trait
|
|
# Iterable<T> Trait
|
|
# Convertible Trait
|
|
# Stringifiable Trait
|
|
# Parseable Trait
|
|
# String Trait
|
|
# Size Trait
|
|
# Identifier Trait
|
|
# Implementable Trait
|
|
# Generics
|
|
# Eval
|
|
# Std Lib IO
|
|
# Std Lib Strings
|
|
# Std Lib Type conversions
|
|
# Error Handling
|
|
# Reflection
|
|
|