config: packages,json,shared (5 files)

This commit is contained in:
Richard Ward
2025-12-31 13:07:54 +00:00
parent 2a0e104fbd
commit 52775236cc
5 changed files with 714 additions and 0 deletions

View File

@@ -0,0 +1,107 @@
{
"name": "Expression Tests",
"description": "Test all expression types in JSON script",
"tests": [
{
"name": "Binary expressions - addition",
"function": "all_expressions",
"args": [10, 5],
"expected": {
"sum": 15,
"diff": 5,
"product": 50,
"max": 10,
"bothPositive": true,
"message": "Sum: 15, Product: 50, Max: 10"
}
},
{
"name": "Binary expressions - negative numbers",
"function": "all_expressions",
"args": [-10, 5],
"expected": {
"sum": -5,
"diff": -15,
"product": -50,
"max": 5,
"bothPositive": false,
"message": "Sum: -5, Product: -50, Max: 5"
}
},
{
"name": "Binary expressions - equal values",
"function": "all_expressions",
"args": [7, 7],
"expected": {
"sum": 14,
"diff": 0,
"product": 49,
"max": 7,
"bothPositive": true,
"message": "Sum: 14, Product: 49, Max: 7"
}
},
{
"name": "All operators - basic arithmetic",
"function": "all_operators",
"args": [10, 3],
"expected": {
"arithmetic": {
"add": 13,
"subtract": 7,
"multiply": 30,
"divide": 3.3333333333333335,
"modulo": 1
},
"comparison": {
"equal": false,
"notEqual": true,
"lessThan": false,
"greaterThan": true,
"lessOrEqual": false,
"greaterOrEqual": true
},
"logical": {
"and": 3,
"or": 10,
"not": false
},
"unary": {
"negate": -10,
"plus": 10
}
}
},
{
"name": "All operators - equal values",
"function": "all_operators",
"args": [5, 5],
"expected": {
"arithmetic": {
"add": 10,
"subtract": 0,
"multiply": 25,
"divide": 1,
"modulo": 0
},
"comparison": {
"equal": true,
"notEqual": false,
"lessThan": false,
"greaterThan": false,
"lessOrEqual": true,
"greaterOrEqual": true
},
"logical": {
"and": 5,
"or": 5,
"not": false
},
"unary": {
"negate": -5,
"plus": 5
}
}
}
]
}

View File

@@ -0,0 +1,104 @@
{
"name": "Statement Tests",
"description": "Test all statement types in JSON script",
"tests": [
{
"name": "For-each loop with array",
"function": "all_statements",
"args": [[10, 20, 30, 40, 50]],
"expected": {
"count": 5,
"sum": 150,
"average": 30,
"error": null
}
},
{
"name": "For-each loop with empty array",
"function": "all_statements",
"args": [[]],
"expected": {
"count": 0,
"sum": 0,
"average": 0,
"error": null
}
},
{
"name": "For-each loop with single item",
"function": "all_statements",
"args": [[100]],
"expected": {
"count": 1,
"sum": 100,
"average": 100,
"error": null
}
},
{
"name": "Control flow - negative",
"function": "control_flow",
"args": [-5],
"expected": "negative"
},
{
"name": "Control flow - zero",
"function": "control_flow",
"args": [0],
"expected": "zero"
},
{
"name": "Control flow - small",
"function": "control_flow",
"args": [5],
"expected": "small"
},
{
"name": "Control flow - medium",
"function": "control_flow",
"args": [50],
"expected": "medium"
},
{
"name": "Control flow - large",
"function": "control_flow",
"args": [150],
"expected": "large"
},
{
"name": "Control flow - boundary (10)",
"function": "control_flow",
"args": [10],
"expected": "medium"
},
{
"name": "Control flow - boundary (100)",
"function": "control_flow",
"args": [100],
"expected": "large"
},
{
"name": "Data structures - no parameters",
"function": "data_structures",
"args": [],
"expected": {
"numbers": [1, 2, 3, 4, 5],
"person": {
"name": "John Doe",
"age": 30,
"email": "john@example.com",
"active": true
},
"config": {
"server": {
"host": "localhost",
"port": 3000,
"protocol": "http"
},
"features": ["auth", "api", "dashboard"]
},
"extractedName": "John Doe"
}
}
]
}