mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
config: packages,json,shared (5 files)
This commit is contained in:
107
packages/json_script_example/tests/expressions.cases.json
Normal file
107
packages/json_script_example/tests/expressions.cases.json
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
104
packages/json_script_example/tests/statements.cases.json
Normal file
104
packages/json_script_example/tests/statements.cases.json
Normal 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"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user