Kwargs: assert functions (#6406)
Closes https://github.com/KittyCAD/modeling-app/issues/6408
This commit is contained in:
File diff suppressed because one or more lines are too long
40
docs/kcl/assertIs.md
Normal file
40
docs/kcl/assertIs.md
Normal file
File diff suppressed because one or more lines are too long
@ -40,11 +40,7 @@ layout: manual
|
||||
* [`arc`](kcl/arc)
|
||||
* [`asin`](kcl/asin)
|
||||
* [`assert`](kcl/assert)
|
||||
* [`assertEqual`](kcl/assertEqual)
|
||||
* [`assertGreaterThan`](kcl/assertGreaterThan)
|
||||
* [`assertGreaterThanOrEq`](kcl/assertGreaterThanOrEq)
|
||||
* [`assertLessThan`](kcl/assertLessThan)
|
||||
* [`assertLessThanOrEq`](kcl/assertLessThanOrEq)
|
||||
* [`assertIs`](kcl/assertIs)
|
||||
* [`atan`](kcl/atan)
|
||||
* [`atan2`](kcl/atan2)
|
||||
* [`bezierCurve`](kcl/bezierCurve)
|
||||
|
@ -34,7 +34,7 @@ int(num: number): number
|
||||
|
||||
```js
|
||||
n = int(ceil(5 / 2))
|
||||
assertEqual(n, 3, 0.0001, "5/2 = 2.5, rounded up makes 3")
|
||||
assert(n, isEqualTo = 3, error = "5/2 = 2.5, rounded up makes 3")
|
||||
// Draw n cylinders.
|
||||
startSketchOn(XZ)
|
||||
|> circle(center = [0, 0], radius = 2)
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -49435,13 +49435,211 @@
|
||||
},
|
||||
{
|
||||
"name": "assert",
|
||||
"summary": "Check a value at runtime, and raise an error if the argument provided is false.",
|
||||
"summary": "Check a value meets some expected conditions at runtime. Program terminates with an error if conditions aren't met. If you provide multiple conditions, they will all be checked and all must be met.",
|
||||
"description": "",
|
||||
"tags": [],
|
||||
"keywordArguments": false,
|
||||
"keywordArguments": true,
|
||||
"args": [
|
||||
{
|
||||
"name": "data",
|
||||
"name": "actual",
|
||||
"type": "number",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "TyF64",
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"description": "Value to check. It will be compared with one of the comparison arguments.",
|
||||
"labelRequired": false
|
||||
},
|
||||
{
|
||||
"name": "isGreaterThan",
|
||||
"type": "number",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "Nullable_TyF64",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/TyF64"
|
||||
}
|
||||
],
|
||||
"nullable": true,
|
||||
"definitions": {
|
||||
"TyF64": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": false,
|
||||
"description": "Comparison argument. If given, checks the `actual` value is greater than this.",
|
||||
"labelRequired": true
|
||||
},
|
||||
{
|
||||
"name": "isLessThan",
|
||||
"type": "number",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "Nullable_TyF64",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/TyF64"
|
||||
}
|
||||
],
|
||||
"nullable": true,
|
||||
"definitions": {
|
||||
"TyF64": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": false,
|
||||
"description": "Comparison argument. If given, checks the `actual` value is less than this.",
|
||||
"labelRequired": true
|
||||
},
|
||||
{
|
||||
"name": "isGreaterThanOrEqual",
|
||||
"type": "number",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "Nullable_TyF64",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/TyF64"
|
||||
}
|
||||
],
|
||||
"nullable": true,
|
||||
"definitions": {
|
||||
"TyF64": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": false,
|
||||
"description": "Comparison argument. If given, checks the `actual` value is greater than or equal to this.",
|
||||
"labelRequired": true
|
||||
},
|
||||
{
|
||||
"name": "isLessThanOrEqual",
|
||||
"type": "number",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "Nullable_TyF64",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/TyF64"
|
||||
}
|
||||
],
|
||||
"nullable": true,
|
||||
"definitions": {
|
||||
"TyF64": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": false,
|
||||
"description": "Comparison argument. If given, checks the `actual` value is less than or equal to this.",
|
||||
"labelRequired": true
|
||||
},
|
||||
{
|
||||
"name": "isEqualTo",
|
||||
"type": "number",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "Nullable_TyF64",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/TyF64"
|
||||
}
|
||||
],
|
||||
"nullable": true,
|
||||
"definitions": {
|
||||
"TyF64": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": false,
|
||||
"includeInSnippet": true,
|
||||
"description": "Comparison argument. If given, checks the `actual` value is less than or equal to this.",
|
||||
"labelRequired": true
|
||||
},
|
||||
{
|
||||
"name": "tolerance",
|
||||
"type": "number",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "Nullable_TyF64",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/TyF64"
|
||||
}
|
||||
],
|
||||
"nullable": true,
|
||||
"definitions": {
|
||||
"TyF64": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": false,
|
||||
"description": "If `isEqualTo` is used, this is the tolerance to allow for the comparison. This tolerance is used because KCL's number system has some floating-point imprecision when used with very large decimal places.",
|
||||
"labelRequired": true
|
||||
},
|
||||
{
|
||||
"name": "error",
|
||||
"type": "String",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "Nullable_String",
|
||||
"type": "string",
|
||||
"nullable": true,
|
||||
"definitions": {
|
||||
"TyF64": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": false,
|
||||
"description": "If the value was false, the program will terminate with this error message",
|
||||
"labelRequired": true
|
||||
}
|
||||
],
|
||||
"returnValue": {
|
||||
"name": "",
|
||||
"type": "()",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "Null",
|
||||
"type": "null"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
},
|
||||
"unpublished": false,
|
||||
"deprecated": false,
|
||||
"examples": [
|
||||
"n = 10\nassert(n, isEqualTo = 10)\nassert(\n n,\n isGreaterThanOrEqual = 0,\n isLessThan = 100,\n error = \"number should be between 0 and 100\",\n)\nassert(\n 1.0000000000012,\n isEqualTo = 1,\n tolerance = 0.0001,\n error = \"number should be almost exactly 1\",\n)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "assertIs",
|
||||
"summary": "Asserts that a value is the boolean value true.",
|
||||
"description": "",
|
||||
"tags": [],
|
||||
"keywordArguments": true,
|
||||
"args": [
|
||||
{
|
||||
"name": "actual",
|
||||
"type": "bool",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
@ -49450,18 +49648,20 @@
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
"description": "Value to check. If this is the boolean value true, assert passes. Otherwise it fails.",
|
||||
"labelRequired": false
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"type": "string",
|
||||
"name": "error",
|
||||
"type": "String",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "String",
|
||||
"type": "string"
|
||||
"title": "Nullable_String",
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"required": false,
|
||||
"description": "If the value was false, the program will terminate with this error message",
|
||||
"labelRequired": true
|
||||
}
|
||||
],
|
||||
@ -49480,340 +49680,7 @@
|
||||
"unpublished": false,
|
||||
"deprecated": false,
|
||||
"examples": [
|
||||
"myVar = true\nassert(myVar, \"should always be true\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "assertEqual",
|
||||
"summary": "Check that a numerical value equals another at runtime, otherwise raise an error.",
|
||||
"description": "",
|
||||
"tags": [],
|
||||
"keywordArguments": false,
|
||||
"args": [
|
||||
{
|
||||
"name": "left",
|
||||
"type": "number",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "double",
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
},
|
||||
{
|
||||
"name": "right",
|
||||
"type": "number",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "double",
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
},
|
||||
{
|
||||
"name": "epsilon",
|
||||
"type": "number",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "double",
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"type": "string",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "String",
|
||||
"type": "string"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
}
|
||||
],
|
||||
"returnValue": {
|
||||
"name": "",
|
||||
"type": "()",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "Null",
|
||||
"type": "null"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
},
|
||||
"unpublished": false,
|
||||
"deprecated": false,
|
||||
"examples": [
|
||||
"n = 1.0285\no = 1.0286\nassertEqual(n, o, 0.01, \"n is within the given tolerance for o\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "assertGreaterThan",
|
||||
"summary": "Check that a numerical value is greater than another at runtime, otherwise raise an error.",
|
||||
"description": "",
|
||||
"tags": [],
|
||||
"keywordArguments": false,
|
||||
"args": [
|
||||
{
|
||||
"name": "left",
|
||||
"type": "number",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "double",
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
},
|
||||
{
|
||||
"name": "right",
|
||||
"type": "number",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "double",
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"type": "string",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "String",
|
||||
"type": "string"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
}
|
||||
],
|
||||
"returnValue": {
|
||||
"name": "",
|
||||
"type": "()",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "Null",
|
||||
"type": "null"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
},
|
||||
"unpublished": false,
|
||||
"deprecated": false,
|
||||
"examples": [
|
||||
"assertGreaterThan(2, 1, \"2 is greater than 1\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "assertGreaterThanOrEq",
|
||||
"summary": "Check that a numerical value is greater than or equal to another at runtime, otherwise raise an error.",
|
||||
"description": "",
|
||||
"tags": [],
|
||||
"keywordArguments": false,
|
||||
"args": [
|
||||
{
|
||||
"name": "left",
|
||||
"type": "number",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "double",
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
},
|
||||
{
|
||||
"name": "right",
|
||||
"type": "number",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "double",
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"type": "string",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "String",
|
||||
"type": "string"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
}
|
||||
],
|
||||
"returnValue": {
|
||||
"name": "",
|
||||
"type": "()",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "Null",
|
||||
"type": "null"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
},
|
||||
"unpublished": false,
|
||||
"deprecated": false,
|
||||
"examples": [
|
||||
"assertGreaterThanOrEq(2, 1, \"2 is greater than 1\")\nassertGreaterThanOrEq(1, 1, \"1 is equal to 1\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "assertLessThan",
|
||||
"summary": "Check that a numerical value is less than to another at runtime, otherwise raise an error.",
|
||||
"description": "",
|
||||
"tags": [],
|
||||
"keywordArguments": false,
|
||||
"args": [
|
||||
{
|
||||
"name": "left",
|
||||
"type": "number",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "double",
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
},
|
||||
{
|
||||
"name": "right",
|
||||
"type": "number",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "double",
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"type": "string",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "String",
|
||||
"type": "string"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
}
|
||||
],
|
||||
"returnValue": {
|
||||
"name": "",
|
||||
"type": "()",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "Null",
|
||||
"type": "null"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
},
|
||||
"unpublished": false,
|
||||
"deprecated": false,
|
||||
"examples": [
|
||||
"assertLessThan(1, 2, \"1 is less than 2\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "assertLessThanOrEq",
|
||||
"summary": "Check that a numerical value is less than or equal to another at runtime, otherwise raise an error.",
|
||||
"description": "",
|
||||
"tags": [],
|
||||
"keywordArguments": false,
|
||||
"args": [
|
||||
{
|
||||
"name": "left",
|
||||
"type": "number",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "double",
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
},
|
||||
{
|
||||
"name": "right",
|
||||
"type": "number",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "double",
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"type": "string",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "String",
|
||||
"type": "string"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
}
|
||||
],
|
||||
"returnValue": {
|
||||
"name": "",
|
||||
"type": "()",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "Null",
|
||||
"type": "null"
|
||||
},
|
||||
"required": true,
|
||||
"includeInSnippet": true,
|
||||
"labelRequired": true
|
||||
},
|
||||
"unpublished": false,
|
||||
"deprecated": false,
|
||||
"examples": [
|
||||
"assertLessThanOrEq(1, 2, \"1 is less than 2\")\nassertLessThanOrEq(1, 1, \"1 is equal to 1\")"
|
||||
"kclIsFun = true\nassertIs(kclIsFun)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -113042,7 +112909,7 @@
|
||||
"unpublished": false,
|
||||
"deprecated": true,
|
||||
"examples": [
|
||||
"n = int(ceil(5 / 2))\nassertEqual(n, 3, 0.0001, \"5/2 = 2.5, rounded up makes 3\")\n// Draw n cylinders.\nstartSketchOn(XZ)\n |> circle(center = [0, 0], radius = 2)\n |> extrude(length = 5)\n |> patternTransform(\n instances = n,\n transform = fn(id) {\n return { translate = [4 * id, 0, 0] }\n },\n )"
|
||||
"n = int(ceil(5 / 2))\nassert(n, isEqualTo = 3, error = \"5/2 = 2.5, rounded up makes 3\")\n// Draw n cylinders.\nstartSketchOn(XZ)\n |> circle(center = [0, 0], radius = 2)\n |> extrude(length = 5)\n |> patternTransform(\n instances = n,\n transform = fn(id) {\n return { translate = [4 * id, 0, 0] }\n },\n )"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -237871,7 +237738,7 @@
|
||||
"unpublished": false,
|
||||
"deprecated": false,
|
||||
"examples": [
|
||||
"arr = [1, 2, 3, 4]\nnew_arr = pop(arr)\nassertEqual(new_arr[0], 1, 0.00001, \"1 is the first element of the array\")\nassertEqual(new_arr[1], 2, 0.00001, \"2 is the second element of the array\")\nassertEqual(new_arr[2], 3, 0.00001, \"3 is the third element of the array\")"
|
||||
"arr = [1, 2, 3, 4]\nnew_arr = pop(arr)\nassert(\n new_arr[0],\n isEqualTo = 1,\n tolerance = 0.00001,\n error = \"1 is the first element of the array\",\n)\nassert(\n new_arr[1],\n isEqualTo = 2,\n tolerance = 0.00001,\n error = \"2 is the second element of the array\",\n)\nassert(\n new_arr[2],\n isEqualTo = 3,\n tolerance = 0.00001,\n error = \"3 is the third element of the array\",\n)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -251362,7 +251229,7 @@
|
||||
"unpublished": false,
|
||||
"deprecated": false,
|
||||
"examples": [
|
||||
"arr = [1, 2, 3]\nnew_arr = push(arr, 4)\nassertEqual(new_arr[3], 4, 0.00001, \"4 was added to the end of the array\")"
|
||||
"arr = [1, 2, 3]\nnew_arr = push(arr, 4)\nassert(\n new_arr[3],\n isEqualTo = 4,\n tolerance = 0.1,\n error = \"4 was added to the end of the array\",\n)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -262197,8 +262064,8 @@
|
||||
"unpublished": false,
|
||||
"deprecated": false,
|
||||
"examples": [
|
||||
"// This function adds two numbers.\nfn add(a, b) {\n return a + b\n}\n\n// This function adds an array of numbers.\n// It uses the `reduce` function, to call the `add` function on every\n// element of the `arr` parameter. The starting value is 0.\nfn sum(arr) {\n return reduce(arr, 0, add)\n}\n\n/* The above is basically like this pseudo-code:\nfn sum(arr):\n sumSoFar = 0\n for i in arr:\n sumSoFar = add(sumSoFar, i)\n return sumSoFar */\n\n// We use `assertEqual` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassertEqual(sum([1, 2, 3]), 6, 0.00001, \"1 + 2 + 3 summed is 6\")",
|
||||
"// This example works just like the previous example above, but it uses\n// an anonymous `add` function as its parameter, instead of declaring a\n// named function outside.\narr = [1, 2, 3]\nsum = reduce(arr, 0, fn(i, result_so_far) {\n return i + result_so_far\n})\n\n// We use `assertEqual` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassertEqual(sum, 6, 0.00001, \"1 + 2 + 3 summed is 6\")",
|
||||
"// This function adds two numbers.\nfn add(a, b) {\n return a + b\n}\n\n// This function adds an array of numbers.\n// It uses the `reduce` function, to call the `add` function on every\n// element of the `arr` parameter. The starting value is 0.\nfn sum(arr) {\n return reduce(arr, 0, add)\n}\n\n/* The above is basically like this pseudo-code:\nfn sum(arr):\n sumSoFar = 0\n for i in arr:\n sumSoFar = add(sumSoFar, i)\n return sumSoFar */\n\n// We use `assert` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassert(\n sum([1, 2, 3]),\n isEqualTo = 6,\n tolerance = 0.1,\n error = \"1 + 2 + 3 summed is 6\",\n)",
|
||||
"// This example works just like the previous example above, but it uses\n// an anonymous `add` function as its parameter, instead of declaring a\n// named function outside.\narr = [1, 2, 3]\nsum = reduce(arr, 0, fn(i, result_so_far) {\n return i + result_so_far\n})\n\n// We use `assert` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassert(\n sum,\n isEqualTo = 6,\n tolerance = 0.1,\n error = \"1 + 2 + 3 summed is 6\",\n)",
|
||||
"// Declare a function that sketches a decagon.\nfn decagon(radius) {\n // Each side of the decagon is turned this many radians from the previous angle.\n stepAngle = 1 / 10 * TAU\n\n // Start the decagon sketch at this point.\n startOfDecagonSketch = startSketchOn(XY)\n |> startProfileAt([cos(0) * radius, sin(0) * radius], %)\n\n // Use a `reduce` to draw the remaining decagon sides.\n // For each number in the array 1..10, run the given function,\n // which takes a partially-sketched decagon and adds one more edge to it.\n fullDecagon = reduce([1..10], startOfDecagonSketch, fn(i, partialDecagon) {\n // Draw one edge of the decagon.\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n return line(partialDecagon, end = [x, y])\n })\n\n return fullDecagon\n}\n\n/* The `decagon` above is basically like this pseudo-code:\nfn decagon(radius):\n stepAngle = (1/10) * TAU\n plane = startSketchOn('XY')\n startOfDecagonSketch = startProfileAt([(cos(0)*radius), (sin(0) * radius)], plane)\n\n // Here's the reduce part.\n partialDecagon = startOfDecagonSketch\n for i in [1..10]:\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n partialDecagon = line(partialDecagon, end = [x, y])\n fullDecagon = partialDecagon // it's now full\n return fullDecagon */\n\n// Use the `decagon` function declared above, to sketch a decagon with radius 5.\ndecagon(5.0)\n |> close()"
|
||||
]
|
||||
},
|
||||
@ -262256,7 +262123,7 @@
|
||||
"unpublished": false,
|
||||
"deprecated": false,
|
||||
"examples": [
|
||||
"assertEqual(rem(7, divisor = 4), 3, 0.01, \"remainder is 3\")\nassertEqual(rem(-7, divisor = 4), -3, 0.01, \"remainder is -3\")\nassertEqual(rem(7, divisor = -4), 3, 0.01, \"remainder is 3\")\nassertEqual(rem(6, divisor = 2.5), 1, 0.01, \"remainder is 1\")\nassertEqual(rem(6.5, divisor = 2.5), 1.5, 0.01, \"remainder is 1.5\")\nassertEqual(rem(6.5, divisor = 2), 0.5, 0.01, \"remainder is 0.5\")"
|
||||
"assert(rem(7, divisor = 4), isEqualTo = 3, error = \"remainder is 3\")\nassert(rem(-7, divisor = 4), isEqualTo = -3, error = \"remainder is -3\")\nassert(rem(7, divisor = -4), isEqualTo = 3, error = \"remainder is 3\")\nassert(rem(6, divisor = 2.5), isEqualTo = 1, error = \"remainder is 1\")\nassert(rem(6.5, divisor = 2.5), isEqualTo = 1.5, error = \"remainder is 1.5\")\nassert(rem(6.5, divisor = 2), isEqualTo = 0.5, error = \"remainder is 0.5\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -25,10 +25,10 @@ shelfMountingHolePlacementOffset = shelfMountingHoleDiameter * 1.5
|
||||
wallMountingHolePlacementOffset = wallMountingHoleDiameter * 1.5
|
||||
|
||||
// Add checks to ensure bracket is possible. These make sure that there is adequate distance between holes and edges.
|
||||
assertGreaterThanOrEq(wallMountLength, wallMountingHoleDiameter * 3, "Holes not possible. Either decrease hole diameter or increase wallMountLength")
|
||||
assertGreaterThanOrEq(shelfMountLength, shelfMountingHoleDiameter * 5.5, "wallMountLength must be longer for hole sizes to work. Either decrease mounting hole diameters or increase shelfMountLength")
|
||||
assertGreaterThanOrEq(width, shelfMountingHoleDiameter * 5.5, "Holes not possible. Either decrease hole diameter or increase width")
|
||||
assertGreaterThanOrEq(width, wallMountingHoleDiameter * 5.5, "Holes not possible. Either decrease hole diameter or increase width")
|
||||
assert(wallMountLength, isGreaterThanOrEqual = wallMountingHoleDiameter * 3, error = "Holes not possible. Either decrease hole diameter or increase wallMountLength")
|
||||
assert(shelfMountLength, isGreaterThanOrEqual = shelfMountingHoleDiameter * 5.5, error = "wallMountLength must be longer for hole sizes to work. Either decrease mounting hole diameters or increase shelfMountLength")
|
||||
assert(width, isGreaterThanOrEqual = shelfMountingHoleDiameter * 5.5, error = "Holes not possible. Either decrease hole diameter or increase width")
|
||||
assert(width, isGreaterThanOrEqual = wallMountingHoleDiameter * 5.5, error = "Holes not possible. Either decrease hole diameter or increase width")
|
||||
|
||||
// Create the body of the bracket
|
||||
bracketBody = startSketchOn(XZ)
|
||||
|
@ -18,7 +18,7 @@ topTotalThickness = totalThickness - (bottomThickness + baseThickness)
|
||||
nHoles = 4
|
||||
|
||||
// Add assertion so nHoles are always greater than 1
|
||||
assertGreaterThan(nHoles, 1, "nHoles must be greater than 1")
|
||||
assert(nHoles, isGreaterThan = 1, error = "nHoles must be greater than 1")
|
||||
|
||||
// Create the circular pattern for the mounting holes
|
||||
circles = startSketchOn(XY)
|
||||
|
@ -22,8 +22,8 @@ lSegments = totalLength / lbumps
|
||||
wSegments = totalWidth / wbumps
|
||||
|
||||
// Add assertions to ensure that the number of bumps are greater than 1
|
||||
assertGreaterThan(lbumps, 1, "lbumps must be greater than 1")
|
||||
assertGreaterThan(wbumps, 1, "wbumps must be greater than 1")
|
||||
assert(lbumps, isGreaterThan = 1, error = "lbumps must be greater than 1")
|
||||
assert(wbumps, isGreaterThan = 1, error = "wbumps must be greater than 1")
|
||||
|
||||
// Make the base
|
||||
base = startSketchOn(XY)
|
||||
|
@ -4,7 +4,7 @@ const arr = [0, 0, 0, 10]
|
||||
const i = 3
|
||||
const ten = arr[i]
|
||||
|
||||
assertEqual(ten, 10, 0.000001, "oops")
|
||||
assert(ten, isEqualTo = 10, error = "oops")
|
||||
|
||||
const p = "foo"
|
||||
const obj = {
|
||||
@ -13,4 +13,4 @@ const obj = {
|
||||
}
|
||||
const one = obj[p]
|
||||
|
||||
assertEqual(one, 1, 0.0000001, "oops")
|
||||
assert(one, isEqualTo = 1, error = "oops")
|
||||
|
@ -1,25 +1,25 @@
|
||||
import identity from "identity.kcl"
|
||||
|
||||
answer = identity(42)
|
||||
assertEqual(answer, 42, 0.0001, "identity")
|
||||
assert(answer, isEqualTo = 42, error = "identity")
|
||||
|
||||
import identity as id from "identity.kcl"
|
||||
|
||||
answer43 = id(43)
|
||||
assertEqual(answer43, 43, 0.0001, "identity")
|
||||
assert(answer43, isEqualTo = 43, error = "identity")
|
||||
|
||||
import increment, decrement from "numbers.kcl"
|
||||
|
||||
answer3 = increment(2)
|
||||
assertEqual(answer3, 3, 0.0001, "increment")
|
||||
assert(answer3, isEqualTo = 3, error = "increment")
|
||||
|
||||
answer5 = decrement(6)
|
||||
assertEqual(answer5, 5, 0.0001, "decrement")
|
||||
assert(answer5, isEqualTo = 5, error = "decrement")
|
||||
|
||||
import increment as inc, decrement as dec from "numbers.kcl"
|
||||
|
||||
answer4 = inc(3)
|
||||
assertEqual(answer4, 4, 0.0001, "inc")
|
||||
assert(answer4, isEqualTo = 4, error = "inc")
|
||||
|
||||
answer6 = dec(7)
|
||||
assertEqual(answer6, 6, 0.0001, "dec")
|
||||
assert(answer6, isEqualTo = 6, error = "dec")
|
||||
|
@ -1830,18 +1830,18 @@ const bracket = startSketchOn(XY)
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn test_unary_operator_not_succeeds() {
|
||||
let ast = r#"
|
||||
fn returnTrue = () => { return !false }
|
||||
const t = true
|
||||
const f = false
|
||||
let notTrue = !t
|
||||
let notFalse = !f
|
||||
let c = !!true
|
||||
let d = !returnTrue()
|
||||
fn returnTrue() { return !false }
|
||||
t = true
|
||||
f = false
|
||||
notTrue = !t
|
||||
notFalse = !f
|
||||
c = !!true
|
||||
d = !returnTrue()
|
||||
|
||||
assert(!false, "expected to pass")
|
||||
assertIs(!false, error = "expected to pass")
|
||||
|
||||
fn check = (x) => {
|
||||
assert(!x, "expected argument to be false")
|
||||
assertIs(!x, error = "expected argument to be false")
|
||||
return true
|
||||
}
|
||||
check(false)
|
||||
|
@ -115,9 +115,9 @@ pub async fn reduce(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
/// return sumSoFar
|
||||
/// */
|
||||
///
|
||||
/// // We use `assertEqual` to check that our `sum` function gives the
|
||||
/// // We use `assert` to check that our `sum` function gives the
|
||||
/// // expected result. It's good to check your work!
|
||||
/// assertEqual(sum([1, 2, 3]), 6, 0.00001, "1 + 2 + 3 summed is 6")
|
||||
/// assert(sum([1, 2, 3]), isEqualTo = 6, tolerance = 0.1, error = "1 + 2 + 3 summed is 6")
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// // This example works just like the previous example above, but it uses
|
||||
@ -126,9 +126,9 @@ pub async fn reduce(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
/// arr = [1, 2, 3]
|
||||
/// sum = reduce(arr, 0, (i, result_so_far) => { return i + result_so_far })
|
||||
///
|
||||
/// // We use `assertEqual` to check that our `sum` function gives the
|
||||
/// // We use `assert` to check that our `sum` function gives the
|
||||
/// // expected result. It's good to check your work!
|
||||
/// assertEqual(sum, 6, 0.00001, "1 + 2 + 3 summed is 6")
|
||||
/// assert(sum, isEqualTo = 6, tolerance = 0.1, error = "1 + 2 + 3 summed is 6")
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// // Declare a function that sketches a decagon.
|
||||
@ -224,7 +224,7 @@ async fn call_reduce_closure(
|
||||
/// ```no_run
|
||||
/// arr = [1, 2, 3]
|
||||
/// new_arr = push(arr, 4)
|
||||
/// assertEqual(new_arr[3], 4, 0.00001, "4 was added to the end of the array")
|
||||
/// assert(new_arr[3], isEqualTo = 4, tolerance = 0.1, error = "4 was added to the end of the array")
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "push",
|
||||
@ -260,9 +260,9 @@ pub async fn push(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
/// ```no_run
|
||||
/// arr = [1, 2, 3, 4]
|
||||
/// new_arr = pop(arr)
|
||||
/// assertEqual(new_arr[0], 1, 0.00001, "1 is the first element of the array")
|
||||
/// assertEqual(new_arr[1], 2, 0.00001, "2 is the second element of the array")
|
||||
/// assertEqual(new_arr[2], 3, 0.00001, "3 is the third element of the array")
|
||||
/// assert(new_arr[0], isEqualTo = 1, tolerance = 0.00001, error = "1 is the first element of the array")
|
||||
/// assert(new_arr[1], isEqualTo = 2, tolerance = 0.00001, error = "2 is the second element of the array")
|
||||
/// assert(new_arr[2], isEqualTo = 3, tolerance = 0.00001, error = "3 is the third element of the array")
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "pop",
|
||||
|
@ -21,135 +21,165 @@ async fn _assert(value: bool, message: &str, args: &Args) -> Result<(), KclError
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn assert_is(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let actual = args.get_unlabeled_kw_arg("actual")?;
|
||||
let error = args.get_kw_arg_opt("error")?;
|
||||
inner_assert_is(actual, error, &args).await?;
|
||||
Ok(KclValue::none())
|
||||
}
|
||||
|
||||
/// Check that the provided value is true, or raise a [KclError]
|
||||
/// with the provided description.
|
||||
pub async fn assert(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let (data, description): (bool, String) = args.get_data()?;
|
||||
inner_assert(data, &description, &args).await?;
|
||||
let actual = args.get_unlabeled_kw_arg("actual")?;
|
||||
let gt = args.get_kw_arg_opt("isGreaterThan")?;
|
||||
let lt = args.get_kw_arg_opt("isLessThan")?;
|
||||
let gte = args.get_kw_arg_opt("isGreaterThanOrEqual")?;
|
||||
let lte = args.get_kw_arg_opt("isLessThanOrEqual")?;
|
||||
let eq = args.get_kw_arg_opt("isEqualTo")?;
|
||||
let tolerance = args.get_kw_arg_opt("tolerance")?;
|
||||
let error = args.get_kw_arg_opt("error")?;
|
||||
inner_assert(actual, gt, lt, gte, lte, eq, tolerance, error, &args).await?;
|
||||
Ok(KclValue::none())
|
||||
}
|
||||
|
||||
/// Check a value at runtime, and raise an error if the argument provided
|
||||
/// is false.
|
||||
/// Asserts that a value is the boolean value true.
|
||||
/// ```no_run
|
||||
/// kclIsFun = true
|
||||
/// assertIs(kclIsFun)
|
||||
/// ```
|
||||
#[stdlib{
|
||||
name = "assertIs",
|
||||
keywords = true,
|
||||
unlabeled_first = true,
|
||||
args = {
|
||||
actual = { docs = "Value to check. If this is the boolean value true, assert passes. Otherwise it fails." },
|
||||
error = { docs = "If the value was false, the program will terminate with this error message" },
|
||||
}
|
||||
}]
|
||||
async fn inner_assert_is(actual: bool, error: Option<String>, args: &Args) -> Result<(), KclError> {
|
||||
let error_msg = match &error {
|
||||
Some(x) => x,
|
||||
None => "should have been true, but it was not",
|
||||
};
|
||||
_assert(actual, error_msg, args).await
|
||||
}
|
||||
|
||||
/// Check a value meets some expected conditions at runtime. Program terminates with an error if conditions aren't met.
|
||||
/// If you provide multiple conditions, they will all be checked and all must be met.
|
||||
///
|
||||
/// ```no_run
|
||||
/// myVar = true
|
||||
/// assert(myVar, "should always be true")
|
||||
/// n = 10
|
||||
/// assert(n, isEqualTo = 10)
|
||||
/// assert(n, isGreaterThanOrEqual = 0, isLessThan = 100, error = "number should be between 0 and 100")
|
||||
/// assert(1.0000000000012, isEqualTo = 1, tolerance = 0.0001, error = "number should be almost exactly 1")
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "assert",
|
||||
}]
|
||||
async fn inner_assert(data: bool, message: &str, args: &Args) -> Result<(), KclError> {
|
||||
_assert(data, message, args).await
|
||||
}
|
||||
|
||||
pub async fn assert_lt(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let (left, right, description): (TyF64, TyF64, String) = args.get_data()?;
|
||||
inner_assert_lt(left.n, right.n, &description, &args).await?;
|
||||
Ok(KclValue::none())
|
||||
}
|
||||
|
||||
/// Check that a numerical value is less than to another at runtime,
|
||||
/// otherwise raise an error.
|
||||
///
|
||||
/// ```no_run
|
||||
/// assertLessThan(1, 2, "1 is less than 2")
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "assertLessThan",
|
||||
}]
|
||||
async fn inner_assert_lt(left: f64, right: f64, message: &str, args: &Args) -> Result<(), KclError> {
|
||||
_assert(left < right, message, args).await
|
||||
}
|
||||
|
||||
pub async fn assert_gt(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let (left, right, description): (TyF64, TyF64, String) = args.get_data()?;
|
||||
inner_assert_gt(left.n, right.n, &description, &args).await?;
|
||||
Ok(KclValue::none())
|
||||
}
|
||||
|
||||
/// Check that a numerical value equals another at runtime,
|
||||
/// otherwise raise an error.
|
||||
///
|
||||
/// ```no_run
|
||||
/// n = 1.0285
|
||||
/// o = 1.0286
|
||||
/// assertEqual(n, o, 0.01, "n is within the given tolerance for o")
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "assertEqual",
|
||||
}]
|
||||
async fn inner_assert_equal(left: f64, right: f64, epsilon: f64, message: &str, args: &Args) -> Result<(), KclError> {
|
||||
if epsilon <= 0.0 {
|
||||
Err(KclError::Type(KclErrorDetails {
|
||||
message: "assertEqual epsilon must be greater than zero".to_owned(),
|
||||
source_ranges: vec![args.source_range],
|
||||
}))
|
||||
} else if (right - left).abs() < epsilon {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(KclError::Type(KclErrorDetails {
|
||||
message: format!("assert failed because {left} != {right}: {message}"),
|
||||
source_ranges: vec![args.source_range],
|
||||
}))
|
||||
keywords = true,
|
||||
unlabeled_first = true,
|
||||
args = {
|
||||
actual = { docs = "Value to check. It will be compared with one of the comparison arguments." },
|
||||
is_greater_than = { docs = "Comparison argument. If given, checks the `actual` value is greater than this." },
|
||||
is_less_than = { docs = "Comparison argument. If given, checks the `actual` value is less than this." },
|
||||
is_greater_than_or_equal = { docs = "Comparison argument. If given, checks the `actual` value is greater than or equal to this." },
|
||||
is_less_than_or_equal = { docs = "Comparison argument. If given, checks the `actual` value is less than or equal to this." },
|
||||
is_equal_to = { docs = "Comparison argument. If given, checks the `actual` value is less than or equal to this.", include_in_snippet = true },
|
||||
tolerance = { docs = "If `isEqualTo` is used, this is the tolerance to allow for the comparison. This tolerance is used because KCL's number system has some floating-point imprecision when used with very large decimal places." },
|
||||
error = { docs = "If the value was false, the program will terminate with this error message" },
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn assert_equal(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let (left, right, epsilon, description): (TyF64, TyF64, TyF64, String) = args.get_data()?;
|
||||
inner_assert_equal(left.n, right.n, epsilon.n, &description, &args).await?;
|
||||
Ok(KclValue::none())
|
||||
}
|
||||
|
||||
/// Check that a numerical value is greater than another at runtime,
|
||||
/// otherwise raise an error.
|
||||
///
|
||||
/// ```no_run
|
||||
/// assertGreaterThan(2, 1, "2 is greater than 1")
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "assertGreaterThan",
|
||||
}]
|
||||
async fn inner_assert_gt(left: f64, right: f64, message: &str, args: &Args) -> Result<(), KclError> {
|
||||
_assert(left > right, message, args).await
|
||||
}
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
async fn inner_assert(
|
||||
actual: TyF64,
|
||||
is_greater_than: Option<TyF64>,
|
||||
is_less_than: Option<TyF64>,
|
||||
is_greater_than_or_equal: Option<TyF64>,
|
||||
is_less_than_or_equal: Option<TyF64>,
|
||||
is_equal_to: Option<TyF64>,
|
||||
tolerance: Option<TyF64>,
|
||||
error: Option<String>,
|
||||
args: &Args,
|
||||
) -> Result<(), KclError> {
|
||||
// Validate the args
|
||||
let no_condition_given = [
|
||||
&is_greater_than,
|
||||
&is_less_than,
|
||||
&is_greater_than_or_equal,
|
||||
&is_less_than_or_equal,
|
||||
&is_equal_to,
|
||||
]
|
||||
.iter()
|
||||
.all(|cond| cond.is_none());
|
||||
if no_condition_given {
|
||||
return Err(KclError::Type(KclErrorDetails {
|
||||
message: "You must provide at least one condition in this assert (for example, isEqualTo)".to_owned(),
|
||||
source_ranges: vec![args.source_range],
|
||||
}));
|
||||
}
|
||||
|
||||
pub async fn assert_lte(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let (left, right, description): (TyF64, TyF64, String) = args.get_data()?;
|
||||
inner_assert_lte(left.n, right.n, &description, &args).await?;
|
||||
Ok(KclValue::none())
|
||||
}
|
||||
if tolerance.is_some() && is_equal_to.is_none() {
|
||||
return Err(KclError::Type(KclErrorDetails {
|
||||
message:
|
||||
"The `tolerance` arg is only used with `isEqualTo`. Either remove `tolerance` or add an `isEqualTo` arg."
|
||||
.to_owned(),
|
||||
source_ranges: vec![args.source_range],
|
||||
}));
|
||||
}
|
||||
|
||||
/// Check that a numerical value is less than or equal to another at runtime,
|
||||
/// otherwise raise an error.
|
||||
///
|
||||
/// ```no_run
|
||||
/// assertLessThanOrEq(1, 2, "1 is less than 2")
|
||||
/// assertLessThanOrEq(1, 1, "1 is equal to 1")
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "assertLessThanOrEq",
|
||||
}]
|
||||
async fn inner_assert_lte(left: f64, right: f64, message: &str, args: &Args) -> Result<(), KclError> {
|
||||
_assert(left <= right, message, args).await
|
||||
}
|
||||
let suffix = if let Some(err_string) = error {
|
||||
format!(": {err_string}")
|
||||
} else {
|
||||
Default::default()
|
||||
};
|
||||
let actual = actual.n;
|
||||
|
||||
pub async fn assert_gte(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let (left, right, description): (TyF64, TyF64, String) = args.get_data()?;
|
||||
inner_assert_gte(left.n, right.n, &description, &args).await?;
|
||||
Ok(KclValue::none())
|
||||
}
|
||||
|
||||
/// Check that a numerical value is greater than or equal to another at runtime,
|
||||
/// otherwise raise an error.
|
||||
///
|
||||
/// ```no_run
|
||||
/// assertGreaterThanOrEq(2, 1, "2 is greater than 1")
|
||||
/// assertGreaterThanOrEq(1, 1, "1 is equal to 1")
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "assertGreaterThanOrEq",
|
||||
}]
|
||||
async fn inner_assert_gte(left: f64, right: f64, message: &str, args: &Args) -> Result<(), KclError> {
|
||||
_assert(left >= right, message, args).await
|
||||
// Run the checks.
|
||||
if let Some(exp) = is_greater_than {
|
||||
let exp = exp.n;
|
||||
_assert(
|
||||
actual > exp,
|
||||
&format!("Expected {actual} to be greater than {exp} but it wasn't{suffix}"),
|
||||
args,
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
if let Some(exp) = is_less_than {
|
||||
let exp = exp.n;
|
||||
_assert(
|
||||
actual < exp,
|
||||
&format!("Expected {actual} to be less than {exp} but it wasn't{suffix}"),
|
||||
args,
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
if let Some(exp) = is_greater_than_or_equal {
|
||||
let exp = exp.n;
|
||||
_assert(
|
||||
actual >= exp,
|
||||
&format!("Expected {actual} to be greater than or equal to {exp} but it wasn't{suffix}"),
|
||||
args,
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
if let Some(exp) = is_less_than_or_equal {
|
||||
let exp = exp.n;
|
||||
_assert(
|
||||
actual <= exp,
|
||||
&format!("Expected {actual} to be less than or equal to {exp} but it wasn't{suffix}"),
|
||||
args,
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
if let Some(exp) = is_equal_to {
|
||||
let exp = exp.n;
|
||||
let tolerance = tolerance.map(|e| e.n).unwrap_or(0.0000000001);
|
||||
_assert(
|
||||
(actual - exp).abs() < tolerance,
|
||||
&format!("Expected {actual} to be equal to {exp} but it wasn't{suffix}"),
|
||||
args,
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ pub async fn int(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
||||
///
|
||||
/// ```no_run
|
||||
/// n = int(ceil(5/2))
|
||||
/// assertEqual(n, 3, 0.0001, "5/2 = 2.5, rounded up makes 3")
|
||||
/// assert(n, isEqualTo = 3, error = "5/2 = 2.5, rounded up makes 3")
|
||||
/// // Draw n cylinders.
|
||||
/// startSketchOn('XZ')
|
||||
/// |> circle(center = [0, 0], radius = 2 )
|
||||
|
@ -36,12 +36,12 @@ pub async fn rem(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kcl
|
||||
/// If `num` is negative, the result will be too.
|
||||
///
|
||||
/// ```no_run
|
||||
/// assertEqual(rem( 7, divisor = 4), 3, 0.01, "remainder is 3" )
|
||||
/// assertEqual(rem(-7, divisor = 4), -3, 0.01, "remainder is -3")
|
||||
/// assertEqual(rem( 7, divisor = -4), 3, 0.01, "remainder is 3" )
|
||||
/// assertEqual(rem( 6, divisor = 2.5), 1, 0.01, "remainder is 1" )
|
||||
/// assertEqual(rem( 6.5, divisor = 2.5), 1.5, 0.01, "remainder is 1.5" )
|
||||
/// assertEqual(rem( 6.5, divisor = 2), 0.5, 0.01, "remainder is 0.5" )
|
||||
/// assert(rem( 7, divisor = 4), isEqualTo = 3, error = "remainder is 3")
|
||||
/// assert(rem(-7, divisor = 4), isEqualTo = -3, error = "remainder is -3")
|
||||
/// assert(rem( 7, divisor = -4), isEqualTo = 3, error = "remainder is 3")
|
||||
/// assert(rem( 6, divisor = 2.5), isEqualTo = 1, error = "remainder is 1")
|
||||
/// assert(rem( 6.5, divisor = 2.5), isEqualTo = 1.5, error = "remainder is 1.5")
|
||||
/// assert(rem( 6.5, divisor = 2), isEqualTo = 0.5, error = "remainder is 0.5")
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "rem",
|
||||
|
@ -137,11 +137,7 @@ lazy_static! {
|
||||
Box::new(crate::std::units::FromCm),
|
||||
Box::new(crate::std::units::FromYd),
|
||||
Box::new(crate::std::assert::Assert),
|
||||
Box::new(crate::std::assert::AssertEqual),
|
||||
Box::new(crate::std::assert::AssertLessThan),
|
||||
Box::new(crate::std::assert::AssertGreaterThan),
|
||||
Box::new(crate::std::assert::AssertLessThanOrEq),
|
||||
Box::new(crate::std::assert::AssertGreaterThanOrEq),
|
||||
Box::new(crate::std::assert::AssertIs),
|
||||
Box::new(crate::std::transform::Scale),
|
||||
Box::new(crate::std::transform::Translate),
|
||||
Box::new(crate::std::transform::Rotate),
|
||||
|
@ -2798,6 +2798,68 @@ description: Result of parsing add_lots.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3660",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3660.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Big sum\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Big sum"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -2812,62 +2874,8 @@ description: Result of parsing add_lots.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3660",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3660.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.1,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Big sum\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Big sum"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
|
@ -4,4 +4,4 @@ fn f(i) {
|
||||
|
||||
x = f(0) + f(1) + f(2) + f(3) + f(4) + f(5) + f(6) + f(7) + f(8) + f(9) + f(10) + f(11) + f(12) + f(13) + f(14) + f(15) + f(16) + f(17) + f(18) + f(19) + f(20) + f(21) + f(22) + f(23) + f(24) + f(25) + f(26) + f(27) + f(28) + f(29) + f(30) + f(31) + f(32) + f(33) + f(34) + f(35) + f(36) + f(37) + f(38) + f(39) + f(40) + f(41) + f(42) + f(43) + f(44) + f(45) + f(46) + f(47) + f(48) + f(49) + f(50) + f(51) + f(52) + f(53) + f(54) + f(55) + f(56) + f(57) + f(58) + f(59) + f(60)
|
||||
|
||||
assertEqual(x, 3660, 0.1, "Big sum")
|
||||
assert(x, isEqualTo = 3660, error = "Big sum")
|
||||
|
@ -8,4 +8,4 @@ fn f(i) {
|
||||
|
||||
x = f(0) + f(1) + f(2) + f(3) + f(4) + f(5) + f(6) + f(7) + f(8) + f(9) + f(10) + f(11) + f(12) + f(13) + f(14) + f(15) + f(16) + f(17) + f(18) + f(19) + f(20) + f(21) + f(22) + f(23) + f(24) + f(25) + f(26) + f(27) + f(28) + f(29) + f(30) + f(31) + f(32) + f(33) + f(34) + f(35) + f(36) + f(37) + f(38) + f(39) + f(40) + f(41) + f(42) + f(43) + f(44) + f(45) + f(46) + f(47) + f(48) + f(49) + f(50) + f(51) + f(52) + f(53) + f(54) + f(55) + f(56) + f(57) + f(58) + f(59) + f(60)
|
||||
|
||||
assertEqual(x, 3660, 0.1, "Big sum")
|
||||
assert(x, isEqualTo = 3660, error = "Big sum")
|
||||
|
@ -260,6 +260,68 @@ description: Result of parsing array_elem_pop.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"element 0 should not have changed\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "element 0 should not have changed"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"computed": false,
|
||||
"end": 0,
|
||||
@ -286,62 +348,8 @@ description: Result of parsing array_elem_pop.kcl
|
||||
"start": 0,
|
||||
"type": "MemberExpression",
|
||||
"type": "MemberExpression"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.00001",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.00001,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"element 0 should not have changed\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "element 0 should not have changed"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -352,6 +360,68 @@ description: Result of parsing array_elem_pop.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "2",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 2.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"element 1 should not have changed\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "element 1 should not have changed"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"computed": false,
|
||||
"end": 0,
|
||||
@ -378,62 +448,8 @@ description: Result of parsing array_elem_pop.kcl
|
||||
"start": 0,
|
||||
"type": "MemberExpression",
|
||||
"type": "MemberExpression"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "2",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 2.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.00001",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.00001,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"element 1 should not have changed\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "element 1 should not have changed"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -444,6 +460,68 @@ description: Result of parsing array_elem_pop.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"element 0 should not have changed\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "element 0 should not have changed"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"computed": false,
|
||||
"end": 0,
|
||||
@ -470,62 +548,8 @@ description: Result of parsing array_elem_pop.kcl
|
||||
"start": 0,
|
||||
"type": "MemberExpression",
|
||||
"type": "MemberExpression"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.00001",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.00001,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"element 0 should not have changed\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "element 0 should not have changed"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
|
@ -2,6 +2,6 @@ arr = [1, 2, 3]
|
||||
new_arr1 = pop(arr)
|
||||
new_arr2 = pop(new_arr1)
|
||||
new_arr3 = pop(new_arr2)
|
||||
assertEqual(new_arr1[0], 1, 0.00001, "element 0 should not have changed")
|
||||
assertEqual(new_arr1[1], 2, 0.00001, "element 1 should not have changed")
|
||||
assertEqual(new_arr2[0], 1, 0.00001, "element 0 should not have changed")
|
||||
assert(new_arr1[0], isEqualTo = 1, error = "element 0 should not have changed")
|
||||
assert(new_arr1[1], isEqualTo = 2, error = "element 1 should not have changed")
|
||||
assert(new_arr2[0], isEqualTo = 1, error = "element 0 should not have changed")
|
||||
|
@ -6,6 +6,6 @@ arr = [1, 2, 3]
|
||||
new_arr1 = pop(arr)
|
||||
new_arr2 = pop(new_arr1)
|
||||
new_arr3 = pop(new_arr2)
|
||||
assertEqual(new_arr1[0], 1, 0.00001, "element 0 should not have changed")
|
||||
assertEqual(new_arr1[1], 2, 0.00001, "element 1 should not have changed")
|
||||
assertEqual(new_arr2[0], 1, 0.00001, "element 0 should not have changed")
|
||||
assert(new_arr1[0], isEqualTo = 1, error = "element 0 should not have changed")
|
||||
assert(new_arr1[1], isEqualTo = 2, error = "element 1 should not have changed")
|
||||
assert(new_arr2[0], isEqualTo = 1, error = "element 0 should not have changed")
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,12 +1,12 @@
|
||||
arr = [1, 2, 3]
|
||||
new_arr1 = push(arr, 4)
|
||||
new_arr2 = push(new_arr1, 5)
|
||||
assertEqual(new_arr1[0], 1, 0.00001, "element 0 should not have changed")
|
||||
assertEqual(new_arr1[1], 2, 0.00001, "element 1 should not have changed")
|
||||
assertEqual(new_arr1[2], 3, 0.00001, "element 2 should not have changed")
|
||||
assertEqual(new_arr1[3], 4, 0.00001, "4 was added to the end of the array")
|
||||
assertEqual(new_arr2[0], 1, 0.00001, "element 0 should not have changed")
|
||||
assertEqual(new_arr2[1], 2, 0.00001, "element 1 should not have changed")
|
||||
assertEqual(new_arr2[2], 3, 0.00001, "element 2 should not have changed")
|
||||
assertEqual(new_arr2[3], 4, 0.00001, "4 was added to the end of the array")
|
||||
assertEqual(new_arr2[4], 5, 0.00001, "5 was added to the end of the array")
|
||||
assert(new_arr1[0], isEqualTo = 1, error = "element 0 should not have changed")
|
||||
assert(new_arr1[1], isEqualTo = 2, error = "element 1 should not have changed")
|
||||
assert(new_arr1[2], isEqualTo = 3, error = "element 2 should not have changed")
|
||||
assert(new_arr1[3], isEqualTo = 4, error = "4 was added to the end of the array")
|
||||
assert(new_arr2[0], isEqualTo = 1, error = "element 0 should not have changed")
|
||||
assert(new_arr2[1], isEqualTo = 2, error = "element 1 should not have changed")
|
||||
assert(new_arr2[2], isEqualTo = 3, error = "element 2 should not have changed")
|
||||
assert(new_arr2[3], isEqualTo = 4, error = "4 was added to the end of the array")
|
||||
assert(new_arr2[4], isEqualTo = 5, error = "5 was added to the end of the array")
|
||||
|
@ -5,12 +5,12 @@ description: Result of unparsing array_elem_push.kcl
|
||||
arr = [1, 2, 3]
|
||||
new_arr1 = push(arr, 4)
|
||||
new_arr2 = push(new_arr1, 5)
|
||||
assertEqual(new_arr1[0], 1, 0.00001, "element 0 should not have changed")
|
||||
assertEqual(new_arr1[1], 2, 0.00001, "element 1 should not have changed")
|
||||
assertEqual(new_arr1[2], 3, 0.00001, "element 2 should not have changed")
|
||||
assertEqual(new_arr1[3], 4, 0.00001, "4 was added to the end of the array")
|
||||
assertEqual(new_arr2[0], 1, 0.00001, "element 0 should not have changed")
|
||||
assertEqual(new_arr2[1], 2, 0.00001, "element 1 should not have changed")
|
||||
assertEqual(new_arr2[2], 3, 0.00001, "element 2 should not have changed")
|
||||
assertEqual(new_arr2[3], 4, 0.00001, "4 was added to the end of the array")
|
||||
assertEqual(new_arr2[4], 5, 0.00001, "5 was added to the end of the array")
|
||||
assert(new_arr1[0], isEqualTo = 1, error = "element 0 should not have changed")
|
||||
assert(new_arr1[1], isEqualTo = 2, error = "element 1 should not have changed")
|
||||
assert(new_arr1[2], isEqualTo = 3, error = "element 2 should not have changed")
|
||||
assert(new_arr1[3], isEqualTo = 4, error = "4 was added to the end of the array")
|
||||
assert(new_arr2[0], isEqualTo = 1, error = "element 0 should not have changed")
|
||||
assert(new_arr2[1], isEqualTo = 2, error = "element 1 should not have changed")
|
||||
assert(new_arr2[2], isEqualTo = 3, error = "element 2 should not have changed")
|
||||
assert(new_arr2[3], isEqualTo = 4, error = "4 was added to the end of the array")
|
||||
assert(new_arr2[4], isEqualTo = 5, error = "5 was added to the end of the array")
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
source: kcl-lib/src/simulation_tests.rs
|
||||
description: Error from executing array_elem_push_fail.kcl
|
||||
---
|
||||
KCL UndefinedValue error
|
||||
|
@ -64,6 +64,68 @@ description: Result of parsing array_range_expr.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "4",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 4.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"last element is included\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "last element is included"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"computed": false,
|
||||
"end": 0,
|
||||
@ -90,62 +152,8 @@ description: Result of parsing array_range_expr.kcl
|
||||
"start": 0,
|
||||
"type": "MemberExpression",
|
||||
"type": "MemberExpression"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "4",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 4.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.00001",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.00001,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"last element is included\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "last element is included"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -283,6 +291,68 @@ description: Result of parsing array_range_expr.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "4",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 4.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"last element is included\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "last element is included"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"computed": false,
|
||||
"end": 0,
|
||||
@ -309,62 +379,8 @@ description: Result of parsing array_range_expr.kcl
|
||||
"start": 0,
|
||||
"type": "MemberExpression",
|
||||
"type": "MemberExpression"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "4",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 4.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.00001",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.00001,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"last element is included\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "last element is included"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -517,6 +533,68 @@ description: Result of parsing array_range_expr.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "4",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 4.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"second-to-last element is included\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "second-to-last element is included"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"computed": false,
|
||||
"end": 0,
|
||||
@ -543,62 +621,8 @@ description: Result of parsing array_range_expr.kcl
|
||||
"start": 0,
|
||||
"type": "MemberExpression",
|
||||
"type": "MemberExpression"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "4",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 4.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.00001",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.00001,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"second-to-last element is included\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "second-to-last element is included"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -609,6 +633,68 @@ description: Result of parsing array_range_expr.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "5",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 5.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"last element is included\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "last element is included"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"computed": false,
|
||||
"end": 0,
|
||||
@ -635,62 +721,8 @@ description: Result of parsing array_range_expr.kcl
|
||||
"start": 0,
|
||||
"type": "MemberExpression",
|
||||
"type": "MemberExpression"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "5",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 5.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.00001",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.00001,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"last element is included\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "last element is included"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -850,6 +882,68 @@ description: Result of parsing array_range_expr.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"first element is 1\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "first element is 1"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"computed": false,
|
||||
"end": 0,
|
||||
@ -876,62 +970,8 @@ description: Result of parsing array_range_expr.kcl
|
||||
"start": 0,
|
||||
"type": "MemberExpression",
|
||||
"type": "MemberExpression"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.00001",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.00001,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"first element is 1\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "first element is 1"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -942,6 +982,68 @@ description: Result of parsing array_range_expr.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"second-to-last element is 3\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "second-to-last element is 3"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"computed": false,
|
||||
"end": 0,
|
||||
@ -968,62 +1070,8 @@ description: Result of parsing array_range_expr.kcl
|
||||
"start": 0,
|
||||
"type": "MemberExpression",
|
||||
"type": "MemberExpression"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.00001",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.00001,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"second-to-last element is 3\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "second-to-last element is 3"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -1034,6 +1082,68 @@ description: Result of parsing array_range_expr.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "4",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 4.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"last element is 4\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "last element is 4"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"computed": false,
|
||||
"end": 0,
|
||||
@ -1060,62 +1170,8 @@ description: Result of parsing array_range_expr.kcl
|
||||
"start": 0,
|
||||
"type": "MemberExpression",
|
||||
"type": "MemberExpression"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "4",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 4.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.00001",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.00001,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"last element is 4\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "last element is 4"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
|
@ -1,17 +1,17 @@
|
||||
r1 = [0..4]
|
||||
assertEqual(r1[4], 4, 0.00001, "last element is included")
|
||||
assert(r1[4], isEqualTo = 4, error = "last element is included")
|
||||
|
||||
four = 4
|
||||
zero = 0
|
||||
r2 = [zero..four]
|
||||
assertEqual(r2[4], 4, 0.00001, "last element is included")
|
||||
assert(r2[4], isEqualTo = 4, error = "last element is included")
|
||||
|
||||
five = int(four + 1)
|
||||
r3 = [zero..five]
|
||||
assertEqual(r3[4], 4, 0.00001, "second-to-last element is included")
|
||||
assertEqual(r3[5], 5, 0.00001, "last element is included")
|
||||
assert(r3[4], isEqualTo = 4, error = "second-to-last element is included")
|
||||
assert(r3[5], isEqualTo = 5, error = "last element is included")
|
||||
|
||||
r4 = [int(zero + 1) .. int(five - 1)]
|
||||
assertEqual(r4[0], 1, 0.00001, "first element is 1")
|
||||
assertEqual(r4[2], 3, 0.00001, "second-to-last element is 3")
|
||||
assertEqual(r4[3], 4, 0.00001, "last element is 4")
|
||||
assert(r4[0], isEqualTo = 1, error = "first element is 1")
|
||||
assert(r4[2], isEqualTo = 3, error = "second-to-last element is 3")
|
||||
assert(r4[3], isEqualTo = 4, error = "last element is 4")
|
||||
|
@ -3,19 +3,19 @@ source: kcl-lib/src/simulation_tests.rs
|
||||
description: Result of unparsing array_range_expr.kcl
|
||||
---
|
||||
r1 = [0..4]
|
||||
assertEqual(r1[4], 4, 0.00001, "last element is included")
|
||||
assert(r1[4], isEqualTo = 4, error = "last element is included")
|
||||
|
||||
four = 4
|
||||
zero = 0
|
||||
r2 = [zero..four]
|
||||
assertEqual(r2[4], 4, 0.00001, "last element is included")
|
||||
assert(r2[4], isEqualTo = 4, error = "last element is included")
|
||||
|
||||
five = int(four + 1)
|
||||
r3 = [zero..five]
|
||||
assertEqual(r3[4], 4, 0.00001, "second-to-last element is included")
|
||||
assertEqual(r3[5], 5, 0.00001, "last element is included")
|
||||
assert(r3[4], isEqualTo = 4, error = "second-to-last element is included")
|
||||
assert(r3[5], isEqualTo = 5, error = "last element is included")
|
||||
|
||||
r4 = [int(zero + 1) .. int(five - 1)]
|
||||
assertEqual(r4[0], 1, 0.00001, "first element is 1")
|
||||
assertEqual(r4[2], 3, 0.00001, "second-to-last element is 3")
|
||||
assertEqual(r4[3], 4, 0.00001, "last element is 4")
|
||||
assert(r4[0], isEqualTo = 1, error = "first element is 1")
|
||||
assert(r4[2], isEqualTo = 3, error = "second-to-last element is 3")
|
||||
assert(r4[3], isEqualTo = 4, error = "last element is 4")
|
||||
|
@ -96,6 +96,76 @@ description: Result of parsing array_range_negative_expr.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"argument": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "5",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 5.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"operator": "-",
|
||||
"start": 0,
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"first element is -5\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "first element is -5"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"computed": false,
|
||||
"end": 0,
|
||||
@ -122,70 +192,8 @@ description: Result of parsing array_range_negative_expr.kcl
|
||||
"start": 0,
|
||||
"type": "MemberExpression",
|
||||
"type": "MemberExpression"
|
||||
},
|
||||
{
|
||||
"argument": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "5",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 5.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"operator": "-",
|
||||
"start": 0,
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.001",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.001,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"first element is -5\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "first element is -5"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
|
@ -1,2 +1,2 @@
|
||||
xs = [int(-5) .. 5]
|
||||
assertEqual(xs[0], -5, 0.001, "first element is -5")
|
||||
assert(xs[0], isEqualTo = -5, error = "first element is -5")
|
||||
|
@ -3,4 +3,4 @@ source: kcl-lib/src/simulation_tests.rs
|
||||
description: Result of unparsing array_range_negative_expr.kcl
|
||||
---
|
||||
xs = [int(-5) .. 5]
|
||||
assertEqual(xs[0], -5, 0.001, "first element is -5")
|
||||
assert(xs[0], isEqualTo = -5, error = "first element is -5")
|
||||
|
@ -156,9 +156,68 @@ description: Result of parsing boolean_logical_and.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "2",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 2.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"right branch of and is false makes the whole expression false\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "right branch of and is false makes the whole expression false"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -173,56 +232,9 @@ description: Result of parsing boolean_logical_and.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
"operator": "==",
|
||||
"right": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "2",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 2.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"right branch of and is false makes the whole expression false\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "right branch of and is false makes the whole expression false"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
},
|
||||
@ -377,26 +389,15 @@ description: Result of parsing boolean_logical_and.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "b",
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
"operator": "==",
|
||||
"right": {
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "2",
|
||||
@ -407,12 +408,18 @@ description: Result of parsing boolean_logical_and.kcl
|
||||
"value": 2.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"left branch of and is false makes the whole expression false\"",
|
||||
@ -421,6 +428,7 @@ description: Result of parsing boolean_logical_and.kcl
|
||||
"type": "Literal",
|
||||
"value": "left branch of and is false makes the whole expression false"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
@ -440,8 +448,24 @@ description: Result of parsing boolean_logical_and.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "b",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
@ -598,26 +622,15 @@ description: Result of parsing boolean_logical_and.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "c",
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
"operator": "==",
|
||||
"right": {
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
@ -628,12 +641,18 @@ description: Result of parsing boolean_logical_and.kcl
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"both branches of and are true makes the whole expression true\"",
|
||||
@ -642,6 +661,7 @@ description: Result of parsing boolean_logical_and.kcl
|
||||
"type": "Literal",
|
||||
"value": "both branches of and are true makes the whole expression true"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
@ -661,8 +681,24 @@ description: Result of parsing boolean_logical_and.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "c",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
@ -819,26 +855,15 @@ description: Result of parsing boolean_logical_and.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "d",
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
"operator": "==",
|
||||
"right": {
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "2",
|
||||
@ -849,12 +874,18 @@ description: Result of parsing boolean_logical_and.kcl
|
||||
"value": 2.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"both branches of and are false makes the whole expression false\"",
|
||||
@ -863,6 +894,7 @@ description: Result of parsing boolean_logical_and.kcl
|
||||
"type": "Literal",
|
||||
"value": "both branches of and are false makes the whole expression false"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
@ -882,8 +914,24 @@ description: Result of parsing boolean_logical_and.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "d",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
|
@ -4,7 +4,7 @@ a = if aa {
|
||||
} else {
|
||||
2
|
||||
}
|
||||
assert(a == 2, "right branch of and is false makes the whole expression false")
|
||||
assert(a, isEqualTo = 2, error = "right branch of and is false makes the whole expression false")
|
||||
|
||||
bb = false & true
|
||||
b = if bb {
|
||||
@ -12,7 +12,7 @@ b = if bb {
|
||||
} else {
|
||||
2
|
||||
}
|
||||
assert(b == 2, "left branch of and is false makes the whole expression false")
|
||||
assert(b, isEqualTo = 2, error = "left branch of and is false makes the whole expression false")
|
||||
|
||||
cc = true & true
|
||||
c = if cc {
|
||||
@ -20,7 +20,7 @@ c = if cc {
|
||||
} else {
|
||||
2
|
||||
}
|
||||
assert(c == 1, "both branches of and are true makes the whole expression true")
|
||||
assert(c, isEqualTo = 1, error = "both branches of and are true makes the whole expression true")
|
||||
|
||||
dd = false & false
|
||||
d = if dd {
|
||||
@ -28,4 +28,4 @@ d = if dd {
|
||||
} else {
|
||||
2
|
||||
}
|
||||
assert(d == 2, "both branches of and are false makes the whole expression false")
|
||||
assert(d, isEqualTo = 2, error = "both branches of and are false makes the whole expression false")
|
||||
|
@ -8,7 +8,7 @@ a = if aa {
|
||||
} else {
|
||||
2
|
||||
}
|
||||
assert(a == 2, "right branch of and is false makes the whole expression false")
|
||||
assert(a, isEqualTo = 2, error = "right branch of and is false makes the whole expression false")
|
||||
|
||||
bb = false & true
|
||||
b = if bb {
|
||||
@ -16,7 +16,7 @@ b = if bb {
|
||||
} else {
|
||||
2
|
||||
}
|
||||
assert(b == 2, "left branch of and is false makes the whole expression false")
|
||||
assert(b, isEqualTo = 2, error = "left branch of and is false makes the whole expression false")
|
||||
|
||||
cc = true & true
|
||||
c = if cc {
|
||||
@ -24,7 +24,7 @@ c = if cc {
|
||||
} else {
|
||||
2
|
||||
}
|
||||
assert(c == 1, "both branches of and are true makes the whole expression true")
|
||||
assert(c, isEqualTo = 1, error = "both branches of and are true makes the whole expression true")
|
||||
|
||||
dd = false & false
|
||||
d = if dd {
|
||||
@ -32,4 +32,4 @@ d = if dd {
|
||||
} else {
|
||||
2
|
||||
}
|
||||
assert(d == 2, "both branches of and are false makes the whole expression false")
|
||||
assert(d, isEqualTo = 2, error = "both branches of and are false makes the whole expression false")
|
||||
|
@ -173,26 +173,15 @@ description: Result of parsing boolean_logical_multiple.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "i",
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
"operator": "==",
|
||||
"right": {
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
@ -203,12 +192,18 @@ description: Result of parsing boolean_logical_multiple.kcl
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"and has higher precedence than or\"",
|
||||
@ -217,6 +212,7 @@ description: Result of parsing boolean_logical_multiple.kcl
|
||||
"type": "Literal",
|
||||
"value": "and has higher precedence than or"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
@ -236,8 +232,24 @@ description: Result of parsing boolean_logical_multiple.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "i",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
@ -453,26 +465,15 @@ description: Result of parsing boolean_logical_multiple.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "j",
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
"operator": "==",
|
||||
"right": {
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
@ -483,12 +484,18 @@ description: Result of parsing boolean_logical_multiple.kcl
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"multiple logical operators\"",
|
||||
@ -497,6 +504,7 @@ description: Result of parsing boolean_logical_multiple.kcl
|
||||
"type": "Literal",
|
||||
"value": "multiple logical operators"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
@ -516,8 +524,24 @@ description: Result of parsing boolean_logical_multiple.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "j",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
|
@ -4,7 +4,7 @@ i = if ii {
|
||||
} else {
|
||||
2
|
||||
}
|
||||
assert(i == 1, "and has higher precedence than or")
|
||||
assert(i, isEqualTo = 1, error = "and has higher precedence than or")
|
||||
|
||||
jj = false | true & !false | false & true
|
||||
j = if jj {
|
||||
@ -12,4 +12,4 @@ j = if jj {
|
||||
} else {
|
||||
2
|
||||
}
|
||||
assert(j == 1, "multiple logical operators")
|
||||
assert(j, isEqualTo = 1, error = "multiple logical operators")
|
||||
|
@ -8,7 +8,7 @@ i = if ii {
|
||||
} else {
|
||||
2
|
||||
}
|
||||
assert(i == 1, "and has higher precedence than or")
|
||||
assert(i, isEqualTo = 1, error = "and has higher precedence than or")
|
||||
|
||||
jj = false | true & !false | false & true
|
||||
j = if jj {
|
||||
@ -16,4 +16,4 @@ j = if jj {
|
||||
} else {
|
||||
2
|
||||
}
|
||||
assert(j == 1, "multiple logical operators")
|
||||
assert(j, isEqualTo = 1, error = "multiple logical operators")
|
||||
|
@ -156,9 +156,68 @@ description: Result of parsing boolean_logical_or.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"left branch of or is true makes the whole expression true\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "left branch of or is true makes the whole expression true"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -173,56 +232,9 @@ description: Result of parsing boolean_logical_or.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
"operator": "==",
|
||||
"right": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"left branch of or is true makes the whole expression true\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "left branch of or is true makes the whole expression true"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
},
|
||||
@ -377,26 +389,15 @@ description: Result of parsing boolean_logical_or.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "b",
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
"operator": "==",
|
||||
"right": {
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
@ -407,12 +408,18 @@ description: Result of parsing boolean_logical_or.kcl
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"right branch of or is true makes the whole expression true\"",
|
||||
@ -421,6 +428,7 @@ description: Result of parsing boolean_logical_or.kcl
|
||||
"type": "Literal",
|
||||
"value": "right branch of or is true makes the whole expression true"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
@ -440,8 +448,24 @@ description: Result of parsing boolean_logical_or.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "b",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
@ -598,26 +622,15 @@ description: Result of parsing boolean_logical_or.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "c",
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
"operator": "==",
|
||||
"right": {
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
@ -628,12 +641,18 @@ description: Result of parsing boolean_logical_or.kcl
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"both branches of or are true makes the whole expression true\"",
|
||||
@ -642,6 +661,7 @@ description: Result of parsing boolean_logical_or.kcl
|
||||
"type": "Literal",
|
||||
"value": "both branches of or are true makes the whole expression true"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
@ -661,8 +681,24 @@ description: Result of parsing boolean_logical_or.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "c",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
@ -819,26 +855,15 @@ description: Result of parsing boolean_logical_or.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "d",
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
"operator": "==",
|
||||
"right": {
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "2",
|
||||
@ -849,12 +874,18 @@ description: Result of parsing boolean_logical_or.kcl
|
||||
"value": 2.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"both branches of or are false makes the whole expression false\"",
|
||||
@ -863,6 +894,7 @@ description: Result of parsing boolean_logical_or.kcl
|
||||
"type": "Literal",
|
||||
"value": "both branches of or are false makes the whole expression false"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
@ -882,8 +914,24 @@ description: Result of parsing boolean_logical_or.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "d",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
|
@ -4,7 +4,7 @@ a = if aa {
|
||||
} else {
|
||||
2
|
||||
}
|
||||
assert(a == 1, "left branch of or is true makes the whole expression true")
|
||||
assert(a, isEqualTo = 1, error = "left branch of or is true makes the whole expression true")
|
||||
|
||||
bb = false | true
|
||||
b = if bb {
|
||||
@ -12,7 +12,7 @@ b = if bb {
|
||||
} else {
|
||||
2
|
||||
}
|
||||
assert(b == 1, "right branch of or is true makes the whole expression true")
|
||||
assert(b, isEqualTo = 1, error = "right branch of or is true makes the whole expression true")
|
||||
|
||||
cc = true | true
|
||||
c = if cc {
|
||||
@ -20,7 +20,7 @@ c = if cc {
|
||||
} else {
|
||||
2
|
||||
}
|
||||
assert(c == 1, "both branches of or are true makes the whole expression true")
|
||||
assert(c, isEqualTo = 1, error = "both branches of or are true makes the whole expression true")
|
||||
|
||||
dd = false | false
|
||||
d = if dd {
|
||||
@ -28,4 +28,4 @@ d = if dd {
|
||||
} else {
|
||||
2
|
||||
}
|
||||
assert(d == 2, "both branches of or are false makes the whole expression false")
|
||||
assert(d, isEqualTo = 2, error = "both branches of or are false makes the whole expression false")
|
||||
|
@ -8,7 +8,7 @@ a = if aa {
|
||||
} else {
|
||||
2
|
||||
}
|
||||
assert(a == 1, "left branch of or is true makes the whole expression true")
|
||||
assert(a, isEqualTo = 1, error = "left branch of or is true makes the whole expression true")
|
||||
|
||||
bb = false | true
|
||||
b = if bb {
|
||||
@ -16,7 +16,7 @@ b = if bb {
|
||||
} else {
|
||||
2
|
||||
}
|
||||
assert(b == 1, "right branch of or is true makes the whole expression true")
|
||||
assert(b, isEqualTo = 1, error = "right branch of or is true makes the whole expression true")
|
||||
|
||||
cc = true | true
|
||||
c = if cc {
|
||||
@ -24,7 +24,7 @@ c = if cc {
|
||||
} else {
|
||||
2
|
||||
}
|
||||
assert(c == 1, "both branches of or are true makes the whole expression true")
|
||||
assert(c, isEqualTo = 1, error = "both branches of or are true makes the whole expression true")
|
||||
|
||||
dd = false | false
|
||||
d = if dd {
|
||||
@ -32,4 +32,4 @@ d = if dd {
|
||||
} else {
|
||||
2
|
||||
}
|
||||
assert(d == 2, "both branches of or are false makes the whole expression false")
|
||||
assert(d, isEqualTo = 2, error = "both branches of or are false makes the whole expression false")
|
||||
|
@ -11,9 +11,15 @@ description: Result of parsing comparisons.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
@ -24,25 +30,18 @@ description: Result of parsing comparisons.kcl
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"operator": "==",
|
||||
"right": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"equality\"",
|
||||
@ -51,6 +50,7 @@ description: Result of parsing comparisons.kcl
|
||||
"type": "Literal",
|
||||
"value": "equality"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
@ -70,8 +70,20 @@ description: Result of parsing comparisons.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
@ -83,9 +95,15 @@ description: Result of parsing comparisons.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3.0",
|
||||
@ -96,25 +114,18 @@ description: Result of parsing comparisons.kcl
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"operator": "==",
|
||||
"right": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3.0",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"equality of floats\"",
|
||||
@ -123,77 +134,6 @@ description: Result of parsing comparisons.kcl
|
||||
"type": "Literal",
|
||||
"value": "equality of floats"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"operator": "!=",
|
||||
"right": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "4",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 4.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"non-equality\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "non-equality"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
@ -214,22 +154,9 @@ description: Result of parsing comparisons.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3.0",
|
||||
@ -240,56 +167,9 @@ description: Result of parsing comparisons.kcl
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"operator": "!=",
|
||||
"right": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "4.0",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 4.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"non-equality of floats\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "non-equality of floats"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
},
|
||||
@ -299,22 +179,15 @@ description: Result of parsing comparisons.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"name": "isLessThan",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
"type": "Identifier"
|
||||
},
|
||||
"operator": "<",
|
||||
"right": {
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "4",
|
||||
@ -325,12 +198,18 @@ description: Result of parsing comparisons.kcl
|
||||
"value": 4.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"lt\"",
|
||||
@ -339,6 +218,7 @@ description: Result of parsing comparisons.kcl
|
||||
"type": "Literal",
|
||||
"value": "lt"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
@ -358,8 +238,20 @@ description: Result of parsing comparisons.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
@ -371,22 +263,15 @@ description: Result of parsing comparisons.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"name": "isLessThanOrEqual",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
"type": "Identifier"
|
||||
},
|
||||
"operator": "<=",
|
||||
"right": {
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "4",
|
||||
@ -397,12 +282,18 @@ description: Result of parsing comparisons.kcl
|
||||
"value": 4.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"lte but actually lt\"",
|
||||
@ -411,6 +302,7 @@ description: Result of parsing comparisons.kcl
|
||||
"type": "Literal",
|
||||
"value": "lte but actually lt"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
@ -430,8 +322,20 @@ description: Result of parsing comparisons.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
@ -443,9 +347,15 @@ description: Result of parsing comparisons.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"name": "isLessThanOrEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "4",
|
||||
@ -456,25 +366,18 @@ description: Result of parsing comparisons.kcl
|
||||
"value": 4.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"operator": "<=",
|
||||
"right": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "4",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 4.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"lte but actually eq\"",
|
||||
@ -483,6 +386,7 @@ description: Result of parsing comparisons.kcl
|
||||
"type": "Literal",
|
||||
"value": "lte but actually eq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
@ -502,8 +406,20 @@ description: Result of parsing comparisons.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "4",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 4.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
@ -515,22 +431,15 @@ description: Result of parsing comparisons.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "4",
|
||||
"name": "isGreaterThan",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 4.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
"type": "Identifier"
|
||||
},
|
||||
"operator": ">",
|
||||
"right": {
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
@ -541,12 +450,18 @@ description: Result of parsing comparisons.kcl
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"gt\"",
|
||||
@ -555,6 +470,7 @@ description: Result of parsing comparisons.kcl
|
||||
"type": "Literal",
|
||||
"value": "gt"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
@ -574,22 +490,9 @@ description: Result of parsing comparisons.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "4",
|
||||
@ -600,9 +503,27 @@ description: Result of parsing comparisons.kcl
|
||||
"value": 4.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
"operator": ">=",
|
||||
"right": {
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isGreaterThanOrEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
@ -613,12 +534,18 @@ description: Result of parsing comparisons.kcl
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"gte but actually gt\"",
|
||||
@ -627,6 +554,7 @@ description: Result of parsing comparisons.kcl
|
||||
"type": "Literal",
|
||||
"value": "gte but actually gt"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
@ -646,8 +574,20 @@ description: Result of parsing comparisons.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "4",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 4.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
@ -659,9 +599,15 @@ description: Result of parsing comparisons.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"name": "isGreaterThanOrEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
@ -672,25 +618,18 @@ description: Result of parsing comparisons.kcl
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"operator": ">=",
|
||||
"right": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"gte but actually eq\"",
|
||||
@ -699,6 +638,7 @@ description: Result of parsing comparisons.kcl
|
||||
"type": "Literal",
|
||||
"value": "gte but actually eq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
@ -718,8 +658,20 @@ description: Result of parsing comparisons.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
@ -731,9 +683,15 @@ description: Result of parsing comparisons.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.0",
|
||||
@ -744,25 +702,18 @@ description: Result of parsing comparisons.kcl
|
||||
"value": 0.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"operator": "==",
|
||||
"right": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.0",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"equality of zero\"",
|
||||
@ -771,6 +722,7 @@ description: Result of parsing comparisons.kcl
|
||||
"type": "Literal",
|
||||
"value": "equality of zero"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
@ -790,8 +742,20 @@ description: Result of parsing comparisons.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.0",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
@ -803,22 +767,15 @@ description: Result of parsing comparisons.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.0",
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
"type": "Identifier"
|
||||
},
|
||||
"operator": "==",
|
||||
"right": {
|
||||
"arg": {
|
||||
"argument": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -837,12 +794,18 @@ description: Result of parsing comparisons.kcl
|
||||
"start": 0,
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"equality of zero and neg zero\"",
|
||||
@ -851,6 +814,7 @@ description: Result of parsing comparisons.kcl
|
||||
"type": "Literal",
|
||||
"value": "equality of zero and neg zero"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
@ -870,8 +834,20 @@ description: Result of parsing comparisons.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.0",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
@ -882,7 +858,7 @@ description: Result of parsing comparisons.kcl
|
||||
"end": 0,
|
||||
"nonCodeMeta": {
|
||||
"nonCodeNodes": {
|
||||
"9": [
|
||||
"7": [
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
|
@ -1,13 +1,11 @@
|
||||
assert(3 == 3, "equality")
|
||||
assert(3.0 == 3.0, "equality of floats")
|
||||
assert(3 != 4, "non-equality")
|
||||
assert(3.0 != 4.0, "non-equality of floats")
|
||||
assert(3 < 4, "lt")
|
||||
assert(3 <= 4, "lte but actually lt")
|
||||
assert(4 <= 4, "lte but actually eq")
|
||||
assert(4 > 3, "gt")
|
||||
assert(4 >= 3, "gte but actually gt")
|
||||
assert(3 >= 3, "gte but actually eq")
|
||||
assert(3, isEqualTo = 3, error = "equality")
|
||||
assert(3.0, isEqualTo = 3.0, error = "equality of floats")
|
||||
assert(3, isLessThan = 4, error = "lt")
|
||||
assert(3, isLessThanOrEqual = 4, error = "lte but actually lt")
|
||||
assert(4, isLessThanOrEqual = 4, error = "lte but actually eq")
|
||||
assert(4, isGreaterThan = 3, error = "gt")
|
||||
assert(4, isGreaterThanOrEqual = 3, error = "gte but actually gt")
|
||||
assert(3, isGreaterThanOrEqual = 3, error = "gte but actually eq")
|
||||
|
||||
assert(0.0 == 0.0, "equality of zero")
|
||||
assert(0.0 == -0.0, "equality of zero and neg zero")
|
||||
assert(0.0, isEqualTo = 0.0, error = "equality of zero")
|
||||
assert(0.0, isEqualTo = -0.0, error = "equality of zero and neg zero")
|
||||
|
@ -2,16 +2,14 @@
|
||||
source: kcl-lib/src/simulation_tests.rs
|
||||
description: Result of unparsing comparisons.kcl
|
||||
---
|
||||
assert(3 == 3, "equality")
|
||||
assert(3.0 == 3.0, "equality of floats")
|
||||
assert(3 != 4, "non-equality")
|
||||
assert(3.0 != 4.0, "non-equality of floats")
|
||||
assert(3 < 4, "lt")
|
||||
assert(3 <= 4, "lte but actually lt")
|
||||
assert(4 <= 4, "lte but actually eq")
|
||||
assert(4 > 3, "gt")
|
||||
assert(4 >= 3, "gte but actually gt")
|
||||
assert(3 >= 3, "gte but actually eq")
|
||||
assert(3, isEqualTo = 3, error = "equality")
|
||||
assert(3.0, isEqualTo = 3.0, error = "equality of floats")
|
||||
assert(3, isLessThan = 4, error = "lt")
|
||||
assert(3, isLessThanOrEqual = 4, error = "lte but actually lt")
|
||||
assert(4, isLessThanOrEqual = 4, error = "lte but actually eq")
|
||||
assert(4, isGreaterThan = 3, error = "gt")
|
||||
assert(4, isGreaterThanOrEqual = 3, error = "gte but actually gt")
|
||||
assert(3, isGreaterThanOrEqual = 3, error = "gte but actually eq")
|
||||
|
||||
assert(0.0 == 0.0, "equality of zero")
|
||||
assert(0.0 == -0.0, "equality of zero and neg zero")
|
||||
assert(0.0, isEqualTo = 0.0, error = "equality of zero")
|
||||
assert(0.0, isEqualTo = -0.0, error = "equality of zero and neg zero")
|
||||
|
@ -11,58 +11,15 @@ description: Result of parsing comparisons_multiple.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
"type": "Identifier"
|
||||
},
|
||||
"operator": "==",
|
||||
"right": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
"operator": "==",
|
||||
"right": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
{
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"this should not compile\"",
|
||||
@ -71,6 +28,7 @@ description: Result of parsing comparisons_multiple.kcl
|
||||
"type": "Literal",
|
||||
"value": "this should not compile"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
@ -90,8 +48,60 @@ description: Result of parsing comparisons_multiple.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"operator": "==",
|
||||
"right": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
"operator": "==",
|
||||
"right": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
|
@ -1,12 +1,12 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
source: kcl-lib/src/simulation_tests.rs
|
||||
description: Error from executing comparisons_multiple.kcl
|
||||
---
|
||||
KCL Semantic error
|
||||
|
||||
× semantic: Expected a number, but found a boolean (true/false value)
|
||||
╭────
|
||||
1 │ assert(3 == 3 == 3, "this should not compile")
|
||||
1 │ assert(3 == 3 == 3, error = "this should not compile")
|
||||
· ───┬──
|
||||
· ╰── tests/comparisons_multiple/input.kcl
|
||||
╰────
|
||||
|
@ -1 +1 @@
|
||||
assert(3 == 3 == 3, "this should not compile")
|
||||
assert(3 == 3 == 3, error = "this should not compile")
|
||||
|
@ -2,4 +2,4 @@
|
||||
source: kcl-lib/src/simulation_tests.rs
|
||||
description: Result of unparsing comparisons_multiple.kcl
|
||||
---
|
||||
assert(3 == 3 == 3, "this should not compile")
|
||||
assert(3 == 3 == 3, error = "this should not compile")
|
||||
|
@ -167,6 +167,68 @@ description: Result of parsing computed_var.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "10",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 10.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"oops\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "oops"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -181,62 +243,8 @@ description: Result of parsing computed_var.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "10",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 10.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.000001",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.000001,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"oops\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "oops"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -402,6 +410,68 @@ description: Result of parsing computed_var.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"oops\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "oops"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -416,62 +486,8 @@ description: Result of parsing computed_var.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.0000001",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.0000001,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"oops\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "oops"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -482,6 +498,90 @@ description: Result of parsing computed_var.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "tolerance",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.2",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.2,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"oops pi\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "oops pi"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -496,62 +596,8 @@ description: Result of parsing computed_var.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.2",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.2,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"oops pi\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "oops pi"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -643,6 +689,90 @@ description: Result of parsing computed_var.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "tolerance",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.000001",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.000001,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"oops cos\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "oops cos"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -657,62 +787,8 @@ description: Result of parsing computed_var.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.000001",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.000001,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"oops cos\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "oops cos"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -765,6 +841,17 @@ description: Result of parsing computed_var.kcl
|
||||
"type": "newLine"
|
||||
}
|
||||
}
|
||||
],
|
||||
"8": [
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "newLine"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"startNodes": [
|
||||
|
@ -5,14 +5,15 @@ arr = [0, 0, 0, 10]
|
||||
i = 3
|
||||
ten = arr[i]
|
||||
|
||||
assertEqual(ten, 10, 0.000001, "oops")
|
||||
assert(ten, isEqualTo = 10, error = "oops")
|
||||
|
||||
p = "foo"
|
||||
obj = { foo = 1, bar = 0 }
|
||||
one = obj[p]
|
||||
|
||||
assertEqual(one, 1, 0.0000001, "oops")
|
||||
assert(one, isEqualTo = 1, error = "oops")
|
||||
|
||||
assert(PI, isEqualTo = 3, tolerance = 0.2, error = "oops pi")
|
||||
|
||||
assertEqual(PI, 3, 0.2, "oops pi")
|
||||
x = cos(2 * PI)
|
||||
assertEqual(x, 1, 0.000001, "oops cos")
|
||||
assert(x, isEqualTo = 1, tolerance = 0.000001, error = "oops cos")
|
||||
|
@ -9,14 +9,25 @@ arr = [0, 0, 0, 10]
|
||||
i = 3
|
||||
ten = arr[i]
|
||||
|
||||
assertEqual(ten, 10, 0.000001, "oops")
|
||||
assert(ten, isEqualTo = 10, error = "oops")
|
||||
|
||||
p = "foo"
|
||||
obj = { foo = 1, bar = 0 }
|
||||
one = obj[p]
|
||||
|
||||
assertEqual(one, 1, 0.0000001, "oops")
|
||||
assert(one, isEqualTo = 1, error = "oops")
|
||||
|
||||
assert(
|
||||
PI,
|
||||
isEqualTo = 3,
|
||||
tolerance = 0.2,
|
||||
error = "oops pi",
|
||||
)
|
||||
|
||||
assertEqual(PI, 3, 0.2, "oops pi")
|
||||
x = cos(2 * PI)
|
||||
assertEqual(x, 1, 0.000001, "oops cos")
|
||||
assert(
|
||||
x,
|
||||
isEqualTo = 1,
|
||||
tolerance = 0.000001,
|
||||
error = "oops cos",
|
||||
)
|
||||
|
@ -145,6 +145,68 @@ description: Result of parsing if_else.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"the 'if' branch gets returned\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "the 'if' branch gets returned"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -159,62 +221,8 @@ description: Result of parsing if_else.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.001",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.001,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"the 'if' branch gets returned\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "the 'if' branch gets returned"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -359,6 +367,68 @@ description: Result of parsing if_else.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "4",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 4.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"the 'else if' branch gets returned\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "the 'else if' branch gets returned"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -373,62 +443,8 @@ description: Result of parsing if_else.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "4",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 4.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.001",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.001,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"the 'else if' branch gets returned\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "the 'else if' branch gets returned"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -573,6 +589,68 @@ description: Result of parsing if_else.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isEqualTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "5",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 5.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"the 'else' branch gets returned\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "the 'else' branch gets returned"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -587,62 +665,8 @@ description: Result of parsing if_else.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "5",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 5.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "0.001",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.001,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"the 'else' branch gets returned\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "the 'else' branch gets returned"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
|
@ -8,7 +8,7 @@ a = if true {
|
||||
} else {
|
||||
5
|
||||
}
|
||||
assertEqual(a, 3, 0.001, "the 'if' branch gets returned")
|
||||
assert(a, isEqualTo = 3, error = "the 'if' branch gets returned")
|
||||
|
||||
b = if false {
|
||||
3
|
||||
@ -17,7 +17,7 @@ b = if false {
|
||||
} else {
|
||||
5
|
||||
}
|
||||
assertEqual(b, 4, 0.001, "the 'else if' branch gets returned")
|
||||
assert(b, isEqualTo = 4, error = "the 'else if' branch gets returned")
|
||||
|
||||
c = if false {
|
||||
3
|
||||
@ -26,4 +26,4 @@ c = if false {
|
||||
} else {
|
||||
5
|
||||
}
|
||||
assertEqual(c, 5, 0.001, "the 'else' branch gets returned")
|
||||
assert(c, isEqualTo = 5, error = "the 'else' branch gets returned")
|
||||
|
@ -12,7 +12,7 @@ a = if true {
|
||||
} else {
|
||||
5
|
||||
}
|
||||
assertEqual(a, 3, 0.001, "the 'if' branch gets returned")
|
||||
assert(a, isEqualTo = 3, error = "the 'if' branch gets returned")
|
||||
|
||||
b = if false {
|
||||
3
|
||||
@ -21,7 +21,7 @@ b = if false {
|
||||
} else {
|
||||
5
|
||||
}
|
||||
assertEqual(b, 4, 0.001, "the 'else if' branch gets returned")
|
||||
assert(b, isEqualTo = 4, error = "the 'else if' branch gets returned")
|
||||
|
||||
c = if false {
|
||||
3
|
||||
@ -30,4 +30,4 @@ c = if false {
|
||||
} else {
|
||||
5
|
||||
}
|
||||
assertEqual(c, 5, 0.001, "the 'else' branch gets returned")
|
||||
assert(c, isEqualTo = 5, error = "the 'else' branch gets returned")
|
||||
|
@ -126,6 +126,68 @@ description: Result of parsing index_of_array.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isLessThanOrEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "91",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 91.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Literal property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Literal property lookup"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -140,50 +202,8 @@ description: Result of parsing index_of_array.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "91",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 91.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Literal property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Literal property lookup"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertLessThanOrEq",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -194,6 +214,68 @@ description: Result of parsing index_of_array.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isGreaterThanOrEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "91",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 91.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Literal property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Literal property lookup"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -208,50 +290,8 @@ description: Result of parsing index_of_array.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "91",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 91.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Literal property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Literal property lookup"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertGreaterThanOrEq",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -384,6 +424,68 @@ description: Result of parsing index_of_array.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isLessThanOrEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "91",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 91.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Computed property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Computed property lookup"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -398,50 +500,8 @@ description: Result of parsing index_of_array.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "91",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 91.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Computed property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Computed property lookup"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertLessThanOrEq",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -452,6 +512,68 @@ description: Result of parsing index_of_array.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isGreaterThanOrEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "91",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 91.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Computed property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Computed property lookup"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -466,50 +588,8 @@ description: Result of parsing index_of_array.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "91",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 91.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Computed property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Computed property lookup"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertGreaterThanOrEq",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
|
@ -8,8 +8,8 @@ arr = [90, 91, 92]
|
||||
|
||||
result0 = arr[1]
|
||||
|
||||
assertLessThanOrEq(result0, 91, "Literal property lookup")
|
||||
assertGreaterThanOrEq(result0, 91, "Literal property lookup")
|
||||
assert(result0, isLessThanOrEqual = 91, error = "Literal property lookup")
|
||||
assert(result0, isGreaterThanOrEqual = 91, error = "Literal property lookup")
|
||||
|
||||
// Test: computed index.
|
||||
|
||||
@ -17,5 +17,5 @@ assertGreaterThanOrEq(result0, 91, "Literal property lookup")
|
||||
i = int(1 + 0)
|
||||
result1 = arr[i]
|
||||
|
||||
assertLessThanOrEq(result1, 91, "Computed property lookup")
|
||||
assertGreaterThanOrEq(result1, 91, "Computed property lookup")
|
||||
assert(result1, isLessThanOrEqual = 91, error = "Computed property lookup")
|
||||
assert(result1, isGreaterThanOrEqual = 91, error = "Computed property lookup")
|
||||
|
@ -12,8 +12,8 @@ arr = [90, 91, 92]
|
||||
|
||||
result0 = arr[1]
|
||||
|
||||
assertLessThanOrEq(result0, 91, "Literal property lookup")
|
||||
assertGreaterThanOrEq(result0, 91, "Literal property lookup")
|
||||
assert(result0, isLessThanOrEqual = 91, error = "Literal property lookup")
|
||||
assert(result0, isGreaterThanOrEqual = 91, error = "Literal property lookup")
|
||||
|
||||
// Test: computed index.
|
||||
|
||||
@ -21,5 +21,5 @@ assertGreaterThanOrEq(result0, 91, "Literal property lookup")
|
||||
i = int(1 + 0)
|
||||
result1 = arr[i]
|
||||
|
||||
assertLessThanOrEq(result1, 91, "Computed property lookup")
|
||||
assertGreaterThanOrEq(result1, 91, "Computed property lookup")
|
||||
assert(result1, isLessThanOrEqual = 91, error = "Computed property lookup")
|
||||
assert(result1, isGreaterThanOrEqual = 91, error = "Computed property lookup")
|
||||
|
@ -1,28 +1,28 @@
|
||||
```mermaid
|
||||
flowchart LR
|
||||
subgraph path2 [Path]
|
||||
2["Path<br>[2001, 2026, 0]"]
|
||||
3["Segment<br>[2032, 2090, 0]"]
|
||||
4["Segment<br>[2096, 2135, 0]"]
|
||||
5["Segment<br>[2141, 2188, 0]"]
|
||||
6["Segment<br>[2194, 2240, 0]"]
|
||||
7["Segment<br>[2246, 2285, 0]"]
|
||||
8["Segment<br>[2291, 2361, 0]"]
|
||||
9["Segment<br>[2367, 2374, 0]"]
|
||||
2["Path<br>[2065, 2090, 0]"]
|
||||
3["Segment<br>[2096, 2154, 0]"]
|
||||
4["Segment<br>[2160, 2199, 0]"]
|
||||
5["Segment<br>[2205, 2252, 0]"]
|
||||
6["Segment<br>[2258, 2304, 0]"]
|
||||
7["Segment<br>[2310, 2349, 0]"]
|
||||
8["Segment<br>[2355, 2425, 0]"]
|
||||
9["Segment<br>[2431, 2438, 0]"]
|
||||
10[Solid2d]
|
||||
end
|
||||
subgraph path32 [Path]
|
||||
32["Path<br>[2519, 2709, 0]"]
|
||||
33["Segment<br>[2519, 2709, 0]"]
|
||||
32["Path<br>[2583, 2773, 0]"]
|
||||
33["Segment<br>[2583, 2773, 0]"]
|
||||
34[Solid2d]
|
||||
end
|
||||
subgraph path42 [Path]
|
||||
42["Path<br>[3143, 3345, 0]"]
|
||||
43["Segment<br>[3143, 3345, 0]"]
|
||||
42["Path<br>[3207, 3409, 0]"]
|
||||
43["Segment<br>[3207, 3409, 0]"]
|
||||
44[Solid2d]
|
||||
end
|
||||
1["Plane<br>[1978, 1995, 0]"]
|
||||
11["Sweep Extrusion<br>[2380, 2406, 0]"]
|
||||
1["Plane<br>[2042, 2059, 0]"]
|
||||
11["Sweep Extrusion<br>[2444, 2470, 0]"]
|
||||
12[Wall]
|
||||
13[Wall]
|
||||
14[Wall]
|
||||
@ -43,26 +43,26 @@ flowchart LR
|
||||
29["SweepEdge Adjacent"]
|
||||
30["SweepEdge Opposite"]
|
||||
31["SweepEdge Adjacent"]
|
||||
35["Sweep Extrusion<br>[2995, 3032, 0]"]
|
||||
35["Sweep Extrusion<br>[3059, 3096, 0]"]
|
||||
36[Wall]
|
||||
37["SweepEdge Opposite"]
|
||||
38["SweepEdge Adjacent"]
|
||||
39["Sweep Extrusion<br>[2995, 3032, 0]"]
|
||||
40["Sweep Extrusion<br>[2995, 3032, 0]"]
|
||||
41["Sweep Extrusion<br>[2995, 3032, 0]"]
|
||||
45["Sweep Extrusion<br>[3460, 3497, 0]"]
|
||||
39["Sweep Extrusion<br>[3059, 3096, 0]"]
|
||||
40["Sweep Extrusion<br>[3059, 3096, 0]"]
|
||||
41["Sweep Extrusion<br>[3059, 3096, 0]"]
|
||||
45["Sweep Extrusion<br>[3524, 3561, 0]"]
|
||||
46[Wall]
|
||||
47["SweepEdge Opposite"]
|
||||
48["SweepEdge Adjacent"]
|
||||
49["Sweep Extrusion<br>[3460, 3497, 0]"]
|
||||
50["EdgeCut Fillet<br>[3514, 3594, 0]"]
|
||||
51["EdgeCut Fillet<br>[3595, 3672, 0]"]
|
||||
52["EdgeCut Fillet<br>[3698, 3840, 0]"]
|
||||
53["EdgeCut Fillet<br>[3698, 3840, 0]"]
|
||||
54["EdgeCut Fillet<br>[3698, 3840, 0]"]
|
||||
55["EdgeCut Fillet<br>[3698, 3840, 0]"]
|
||||
56["StartSketchOnFace<br>[2473, 2513, 0]"]
|
||||
57["StartSketchOnFace<br>[3097, 3137, 0]"]
|
||||
49["Sweep Extrusion<br>[3524, 3561, 0]"]
|
||||
50["EdgeCut Fillet<br>[3578, 3658, 0]"]
|
||||
51["EdgeCut Fillet<br>[3659, 3736, 0]"]
|
||||
52["EdgeCut Fillet<br>[3762, 3904, 0]"]
|
||||
53["EdgeCut Fillet<br>[3762, 3904, 0]"]
|
||||
54["EdgeCut Fillet<br>[3762, 3904, 0]"]
|
||||
55["EdgeCut Fillet<br>[3762, 3904, 0]"]
|
||||
56["StartSketchOnFace<br>[2537, 2577, 0]"]
|
||||
57["StartSketchOnFace<br>[3161, 3201, 0]"]
|
||||
1 --- 2
|
||||
2 --- 3
|
||||
2 --- 4
|
||||
|
@ -771,22 +771,15 @@ description: Result of parsing bracket.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"abs_path": false,
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "wallMountLength",
|
||||
"name": "isGreaterThanOrEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
@ -821,8 +814,18 @@ description: Result of parsing bracket.kcl
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Holes not possible. Either decrease hole diameter or increase wallMountLength\"",
|
||||
@ -831,6 +834,7 @@ description: Result of parsing bracket.kcl
|
||||
"type": "Literal",
|
||||
"value": "Holes not possible. Either decrease hole diameter or increase wallMountLength"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
@ -839,7 +843,7 @@ description: Result of parsing bracket.kcl
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertGreaterThanOrEq",
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
@ -850,8 +854,24 @@ description: Result of parsing bracket.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "wallMountLength",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
}
|
||||
},
|
||||
"preComments": [
|
||||
"",
|
||||
@ -868,6 +888,92 @@ description: Result of parsing bracket.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isGreaterThanOrEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "shelfMountingHoleDiameter",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
"operator": "*",
|
||||
"right": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "5.5",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 5.5,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"wallMountLength must be longer for hole sizes to work. Either decrease mounting hole diameters or increase shelfMountLength\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "wallMountLength must be longer for hole sizes to work. Either decrease mounting hole diameters or increase shelfMountLength"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -882,75 +988,9 @@ description: Result of parsing bracket.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "shelfMountingHoleDiameter",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
"operator": "*",
|
||||
"right": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "5.5",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 5.5,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"wallMountLength must be longer for hole sizes to work. Either decrease mounting hole diameters or increase shelfMountLength\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "wallMountLength must be longer for hole sizes to work. Either decrease mounting hole diameters or increase shelfMountLength"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertGreaterThanOrEq",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
},
|
||||
@ -960,22 +1000,15 @@ description: Result of parsing bracket.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"abs_path": false,
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "width",
|
||||
"name": "isGreaterThanOrEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
@ -1010,8 +1043,18 @@ description: Result of parsing bracket.kcl
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Holes not possible. Either decrease hole diameter or increase width\"",
|
||||
@ -1020,6 +1063,7 @@ description: Result of parsing bracket.kcl
|
||||
"type": "Literal",
|
||||
"value": "Holes not possible. Either decrease hole diameter or increase width"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
@ -1028,7 +1072,7 @@ description: Result of parsing bracket.kcl
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertGreaterThanOrEq",
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
@ -1039,19 +1083,9 @@ description: Result of parsing bracket.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -1066,8 +1100,27 @@ description: Result of parsing bracket.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isGreaterThanOrEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"left": {
|
||||
@ -1102,8 +1155,18 @@ description: Result of parsing bracket.kcl
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Holes not possible. Either decrease hole diameter or increase width\"",
|
||||
@ -1112,6 +1175,7 @@ description: Result of parsing bracket.kcl
|
||||
"type": "Literal",
|
||||
"value": "Holes not possible. Either decrease hole diameter or increase width"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
@ -1120,7 +1184,7 @@ description: Result of parsing bracket.kcl
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertGreaterThanOrEq",
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
@ -1131,8 +1195,24 @@ description: Result of parsing bracket.kcl
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "width",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
}
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,55 +1,55 @@
|
||||
```mermaid
|
||||
flowchart LR
|
||||
subgraph path2 [Path]
|
||||
2["Path<br>[850, 935, 0]"]
|
||||
3["Segment<br>[850, 935, 0]"]
|
||||
2["Path<br>[863, 948, 0]"]
|
||||
3["Segment<br>[863, 948, 0]"]
|
||||
4[Solid2d]
|
||||
end
|
||||
subgraph path6 [Path]
|
||||
6["Path<br>[1172, 1217, 0]"]
|
||||
7["Segment<br>[1172, 1217, 0]"]
|
||||
6["Path<br>[1185, 1230, 0]"]
|
||||
7["Segment<br>[1185, 1230, 0]"]
|
||||
8[Solid2d]
|
||||
end
|
||||
subgraph path15 [Path]
|
||||
15["Path<br>[1390, 1444, 0]"]
|
||||
16["Segment<br>[1390, 1444, 0]"]
|
||||
15["Path<br>[1403, 1457, 0]"]
|
||||
16["Segment<br>[1403, 1457, 0]"]
|
||||
17[Solid2d]
|
||||
end
|
||||
subgraph path23 [Path]
|
||||
23["Path<br>[1607, 1664, 0]"]
|
||||
24["Segment<br>[1607, 1664, 0]"]
|
||||
23["Path<br>[1620, 1677, 0]"]
|
||||
24["Segment<br>[1620, 1677, 0]"]
|
||||
25[Solid2d]
|
||||
end
|
||||
subgraph path31 [Path]
|
||||
31["Path<br>[1799, 1844, 0]"]
|
||||
32["Segment<br>[1799, 1844, 0]"]
|
||||
31["Path<br>[1812, 1857, 0]"]
|
||||
32["Segment<br>[1812, 1857, 0]"]
|
||||
33[Solid2d]
|
||||
end
|
||||
1["Plane<br>[827, 844, 0]"]
|
||||
5["Plane<br>[1149, 1166, 0]"]
|
||||
9["Sweep Extrusion<br>[1245, 1276, 0]"]
|
||||
1["Plane<br>[840, 857, 0]"]
|
||||
5["Plane<br>[1162, 1179, 0]"]
|
||||
9["Sweep Extrusion<br>[1258, 1289, 0]"]
|
||||
10[Wall]
|
||||
11["Cap Start"]
|
||||
12["Cap End"]
|
||||
13["SweepEdge Opposite"]
|
||||
14["SweepEdge Adjacent"]
|
||||
18["Sweep Extrusion<br>[1450, 1485, 0]"]
|
||||
18["Sweep Extrusion<br>[1463, 1498, 0]"]
|
||||
19[Wall]
|
||||
20["Cap End"]
|
||||
21["SweepEdge Opposite"]
|
||||
22["SweepEdge Adjacent"]
|
||||
26["Sweep Extrusion<br>[1670, 1703, 0]"]
|
||||
26["Sweep Extrusion<br>[1683, 1716, 0]"]
|
||||
27[Wall]
|
||||
28["Cap End"]
|
||||
29["SweepEdge Opposite"]
|
||||
30["SweepEdge Adjacent"]
|
||||
34["Sweep Extrusion<br>[1850, 1925, 0]"]
|
||||
34["Sweep Extrusion<br>[1863, 1938, 0]"]
|
||||
35[Wall]
|
||||
36["SweepEdge Opposite"]
|
||||
37["SweepEdge Adjacent"]
|
||||
38["StartSketchOnFace<br>[1347, 1384, 0]"]
|
||||
39["StartSketchOnFace<br>[1562, 1601, 0]"]
|
||||
40["StartSketchOnFace<br>[1754, 1793, 0]"]
|
||||
38["StartSketchOnFace<br>[1360, 1397, 0]"]
|
||||
39["StartSketchOnFace<br>[1575, 1614, 0]"]
|
||||
40["StartSketchOnFace<br>[1767, 1806, 0]"]
|
||||
1 --- 2
|
||||
2 --- 3
|
||||
2 --- 4
|
||||
|
@ -429,6 +429,68 @@ description: Result of parsing flange.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isGreaterThan",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"nHoles must be greater than 1\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "nHoles must be greater than 1"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -443,50 +505,8 @@ description: Result of parsing flange.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"nHoles must be greater than 1\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "nHoles must be greater than 1"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertGreaterThan",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"preComments": [
|
||||
"",
|
||||
"",
|
||||
|
@ -1,33 +1,33 @@
|
||||
```mermaid
|
||||
flowchart LR
|
||||
subgraph path2 [Path]
|
||||
2["Path<br>[993, 1047, 0]"]
|
||||
3["Segment<br>[1053, 1080, 0]"]
|
||||
4["Segment<br>[1086, 1114, 0]"]
|
||||
5["Segment<br>[1120, 1148, 0]"]
|
||||
6["Segment<br>[1154, 1161, 0]"]
|
||||
2["Path<br>[1019, 1073, 0]"]
|
||||
3["Segment<br>[1079, 1106, 0]"]
|
||||
4["Segment<br>[1112, 1140, 0]"]
|
||||
5["Segment<br>[1146, 1174, 0]"]
|
||||
6["Segment<br>[1180, 1187, 0]"]
|
||||
7[Solid2d]
|
||||
end
|
||||
subgraph path23 [Path]
|
||||
23["Path<br>[1408, 1495, 0]"]
|
||||
24["Segment<br>[1501, 1538, 0]"]
|
||||
25["Segment<br>[1544, 1582, 0]"]
|
||||
26["Segment<br>[1588, 1628, 0]"]
|
||||
27["Segment<br>[1634, 1641, 0]"]
|
||||
23["Path<br>[1434, 1521, 0]"]
|
||||
24["Segment<br>[1527, 1564, 0]"]
|
||||
25["Segment<br>[1570, 1608, 0]"]
|
||||
26["Segment<br>[1614, 1654, 0]"]
|
||||
27["Segment<br>[1660, 1667, 0]"]
|
||||
28[Solid2d]
|
||||
end
|
||||
subgraph path43 [Path]
|
||||
43["Path<br>[1765, 1912, 0]"]
|
||||
44["Segment<br>[1765, 1912, 0]"]
|
||||
43["Path<br>[1791, 1938, 0]"]
|
||||
44["Segment<br>[1791, 1938, 0]"]
|
||||
45[Solid2d]
|
||||
end
|
||||
subgraph path56 [Path]
|
||||
56["Path<br>[2202, 2377, 0]"]
|
||||
57["Segment<br>[2202, 2377, 0]"]
|
||||
56["Path<br>[2228, 2403, 0]"]
|
||||
57["Segment<br>[2228, 2403, 0]"]
|
||||
58[Solid2d]
|
||||
end
|
||||
1["Plane<br>[970, 987, 0]"]
|
||||
8["Sweep Extrusion<br>[1167, 1191, 0]"]
|
||||
1["Plane<br>[996, 1013, 0]"]
|
||||
8["Sweep Extrusion<br>[1193, 1217, 0]"]
|
||||
9[Wall]
|
||||
10[Wall]
|
||||
11[Wall]
|
||||
@ -42,7 +42,7 @@ flowchart LR
|
||||
20["SweepEdge Adjacent"]
|
||||
21["SweepEdge Opposite"]
|
||||
22["SweepEdge Adjacent"]
|
||||
29["Sweep Extrusion<br>[1647, 1678, 0]"]
|
||||
29["Sweep Extrusion<br>[1673, 1704, 0]"]
|
||||
30[Wall]
|
||||
31[Wall]
|
||||
32[Wall]
|
||||
@ -56,25 +56,25 @@ flowchart LR
|
||||
40["SweepEdge Adjacent"]
|
||||
41["SweepEdge Opposite"]
|
||||
42["SweepEdge Adjacent"]
|
||||
46["Sweep Extrusion<br>[2066, 2094, 0]"]
|
||||
46["Sweep Extrusion<br>[2092, 2120, 0]"]
|
||||
47[Wall]
|
||||
48["Cap End"]
|
||||
49["SweepEdge Opposite"]
|
||||
50["SweepEdge Adjacent"]
|
||||
51["Sweep Extrusion<br>[2066, 2094, 0]"]
|
||||
52["Sweep Extrusion<br>[2066, 2094, 0]"]
|
||||
53["Sweep Extrusion<br>[2066, 2094, 0]"]
|
||||
54["Sweep Extrusion<br>[2066, 2094, 0]"]
|
||||
55["Sweep Extrusion<br>[2066, 2094, 0]"]
|
||||
59["Sweep Extrusion<br>[2539, 2567, 0]"]
|
||||
51["Sweep Extrusion<br>[2092, 2120, 0]"]
|
||||
52["Sweep Extrusion<br>[2092, 2120, 0]"]
|
||||
53["Sweep Extrusion<br>[2092, 2120, 0]"]
|
||||
54["Sweep Extrusion<br>[2092, 2120, 0]"]
|
||||
55["Sweep Extrusion<br>[2092, 2120, 0]"]
|
||||
59["Sweep Extrusion<br>[2565, 2593, 0]"]
|
||||
60[Wall]
|
||||
61["Cap End"]
|
||||
62["SweepEdge Opposite"]
|
||||
63["SweepEdge Adjacent"]
|
||||
64["Sweep Extrusion<br>[2539, 2567, 0]"]
|
||||
65["StartSketchOnFace<br>[1369, 1402, 0]"]
|
||||
66["StartSketchOnFace<br>[1728, 1759, 0]"]
|
||||
67["StartSketchOnFace<br>[2155, 2196, 0]"]
|
||||
64["Sweep Extrusion<br>[2565, 2593, 0]"]
|
||||
65["StartSketchOnFace<br>[1395, 1428, 0]"]
|
||||
66["StartSketchOnFace<br>[1754, 1785, 0]"]
|
||||
67["StartSketchOnFace<br>[2181, 2222, 0]"]
|
||||
1 --- 2
|
||||
2 --- 3
|
||||
2 --- 4
|
||||
|
@ -768,6 +768,68 @@ description: Result of parsing lego.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isGreaterThan",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"lbumps must be greater than 1\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "lbumps must be greater than 1"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -782,50 +844,8 @@ description: Result of parsing lego.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"lbumps must be greater than 1\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "lbumps must be greater than 1"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertGreaterThan",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"preComments": [
|
||||
"",
|
||||
"",
|
||||
@ -841,6 +861,68 @@ description: Result of parsing lego.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isGreaterThan",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"wbumps must be greater than 1\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "wbumps must be greater than 1"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -855,50 +937,8 @@ description: Result of parsing lego.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"wbumps must be greater than 1\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "wbumps must be greater than 1"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertGreaterThan",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
|
BIN
rust/kcl-lib/tests/outputs/serial_test_example_assert_is0.png
Normal file
BIN
rust/kcl-lib/tests/outputs/serial_test_example_assert_is0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
BIN
rust/kcl-lib/tests/outputs/serial_test_example_assert_order0.png
Normal file
BIN
rust/kcl-lib/tests/outputs/serial_test_example_assert_order0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
@ -137,6 +137,68 @@ description: Result of parsing property_of_object.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isLessThanOrEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Literal property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Literal property lookup"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -151,50 +213,8 @@ description: Result of parsing property_of_object.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Literal property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Literal property lookup"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertLessThanOrEq",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -205,6 +225,68 @@ description: Result of parsing property_of_object.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isGreaterThanOrEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Literal property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Literal property lookup"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -219,50 +301,8 @@ description: Result of parsing property_of_object.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Literal property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Literal property lookup"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertGreaterThanOrEq",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -348,6 +388,68 @@ description: Result of parsing property_of_object.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isLessThanOrEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Computed property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Computed property lookup"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -362,50 +464,8 @@ description: Result of parsing property_of_object.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Computed property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Computed property lookup"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertLessThanOrEq",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -416,6 +476,68 @@ description: Result of parsing property_of_object.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isGreaterThanOrEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Computed property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Computed property lookup"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -430,50 +552,8 @@ description: Result of parsing property_of_object.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Computed property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Computed property lookup"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertGreaterThanOrEq",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -605,6 +685,68 @@ description: Result of parsing property_of_object.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isLessThanOrEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Literal property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Literal property lookup"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -619,50 +761,8 @@ description: Result of parsing property_of_object.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Literal property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Literal property lookup"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertLessThanOrEq",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -673,6 +773,68 @@ description: Result of parsing property_of_object.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isGreaterThanOrEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Literal property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Literal property lookup"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -687,50 +849,8 @@ description: Result of parsing property_of_object.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Literal property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Literal property lookup"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertGreaterThanOrEq",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -802,6 +922,68 @@ description: Result of parsing property_of_object.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isLessThanOrEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Computed property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Computed property lookup"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -816,50 +998,8 @@ description: Result of parsing property_of_object.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Computed property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Computed property lookup"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertLessThanOrEq",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
@ -870,6 +1010,68 @@ description: Result of parsing property_of_object.kcl
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "isGreaterThanOrEqual",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "error",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Computed property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Computed property lookup"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assert",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
@ -884,50 +1086,8 @@ description: Result of parsing property_of_object.kcl
|
||||
"start": 0,
|
||||
"type": "Name",
|
||||
"type": "Name"
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"raw": "\"Computed property lookup\"",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Computed property lookup"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"abs_path": false,
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": {
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"name": "assertGreaterThanOrEq",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"path": [],
|
||||
"start": 0,
|
||||
"type": "Name"
|
||||
},
|
||||
"commentStart": 0,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
|
@ -8,8 +8,8 @@ obj = { foo = 1, bar = 0 }
|
||||
|
||||
one_a = obj["foo"]
|
||||
|
||||
assertLessThanOrEq(one_a, 1, "Literal property lookup")
|
||||
assertGreaterThanOrEq(one_a, 1, "Literal property lookup")
|
||||
assert(one_a, isLessThanOrEqual = 1, error = "Literal property lookup")
|
||||
assert(one_a, isGreaterThanOrEqual = 1, error = "Literal property lookup")
|
||||
|
||||
// Test: the property is a variable,
|
||||
// which must be evaluated before looking it up.
|
||||
@ -18,8 +18,8 @@ assertGreaterThanOrEq(one_a, 1, "Literal property lookup")
|
||||
p = "foo"
|
||||
one_b = obj[p]
|
||||
|
||||
assertLessThanOrEq(one_b, 1, "Computed property lookup")
|
||||
assertGreaterThanOrEq(one_b, 1, "Computed property lookup")
|
||||
assert(one_b, isLessThanOrEqual = 1, error = "Computed property lookup")
|
||||
assert(one_b, isGreaterThanOrEqual = 1, error = "Computed property lookup")
|
||||
|
||||
// Test: multiple literal properties.
|
||||
|
||||
@ -28,13 +28,13 @@ obj2 = { inner = obj }
|
||||
|
||||
one_c = obj2.inner["foo"]
|
||||
|
||||
assertLessThanOrEq(one_c, 1, "Literal property lookup")
|
||||
assertGreaterThanOrEq(one_c, 1, "Literal property lookup")
|
||||
assert(one_c, isLessThanOrEqual = 1, error = "Literal property lookup")
|
||||
assert(one_c, isGreaterThanOrEqual = 1, error = "Literal property lookup")
|
||||
|
||||
// Test: multiple properties, mix of literal and computed.
|
||||
|
||||
|
||||
one_d = obj2.inner[p]
|
||||
|
||||
assertLessThanOrEq(one_d, 1, "Computed property lookup")
|
||||
assertGreaterThanOrEq(one_d, 1, "Computed property lookup")
|
||||
assert(one_d, isLessThanOrEqual = 1, error = "Computed property lookup")
|
||||
assert(one_d, isGreaterThanOrEqual = 1, error = "Computed property lookup")
|
||||
|
@ -12,8 +12,8 @@ obj = { foo = 1, bar = 0 }
|
||||
|
||||
one_a = obj["foo"]
|
||||
|
||||
assertLessThanOrEq(one_a, 1, "Literal property lookup")
|
||||
assertGreaterThanOrEq(one_a, 1, "Literal property lookup")
|
||||
assert(one_a, isLessThanOrEqual = 1, error = "Literal property lookup")
|
||||
assert(one_a, isGreaterThanOrEqual = 1, error = "Literal property lookup")
|
||||
|
||||
// Test: the property is a variable,
|
||||
// which must be evaluated before looking it up.
|
||||
@ -22,8 +22,8 @@ assertGreaterThanOrEq(one_a, 1, "Literal property lookup")
|
||||
p = "foo"
|
||||
one_b = obj[p]
|
||||
|
||||
assertLessThanOrEq(one_b, 1, "Computed property lookup")
|
||||
assertGreaterThanOrEq(one_b, 1, "Computed property lookup")
|
||||
assert(one_b, isLessThanOrEqual = 1, error = "Computed property lookup")
|
||||
assert(one_b, isGreaterThanOrEqual = 1, error = "Computed property lookup")
|
||||
|
||||
// Test: multiple literal properties.
|
||||
|
||||
@ -32,13 +32,13 @@ obj2 = { inner = obj }
|
||||
|
||||
one_c = obj2.inner["foo"]
|
||||
|
||||
assertLessThanOrEq(one_c, 1, "Literal property lookup")
|
||||
assertGreaterThanOrEq(one_c, 1, "Literal property lookup")
|
||||
assert(one_c, isLessThanOrEqual = 1, error = "Literal property lookup")
|
||||
assert(one_c, isGreaterThanOrEqual = 1, error = "Literal property lookup")
|
||||
|
||||
// Test: multiple properties, mix of literal and computed.
|
||||
|
||||
|
||||
one_d = obj2.inner[p]
|
||||
|
||||
assertLessThanOrEq(one_d, 1, "Computed property lookup")
|
||||
assertGreaterThanOrEq(one_d, 1, "Computed property lookup")
|
||||
assert(one_d, isLessThanOrEqual = 1, error = "Computed property lookup")
|
||||
assert(one_d, isGreaterThanOrEqual = 1, error = "Computed property lookup")
|
||||
|
Reference in New Issue
Block a user