### INT4 INT4 Aster: POWER Function Example Source: https://help.int4.com/int4-aster-documentation/3.14/syntax-and-features Demonstrates the POWER function for exponentiation. It takes two arguments: the base and the exponent. The example shows a direct call and an equivalent call using LOWER. ```INT4 Aster POWER(2,3) # Evaluates to 8, as 2^3=8 {LOWER("PO")&"wEr"}(2,3) # Also evaluates to 8, equivalent to the above ``` -------------------------------- ### List Initialization and Modification in ASTER Source: https://help.int4.com/int4-aster-documentation/3.14/tables-and-dynamic-symbols Shows basic list creation, assignment, and element modification in ASTER. It highlights how assignments create copies of values and how direct indexing can change list elements. The example also includes a boolean expression to verify changes. ```ASTER A=(1,2,3,4); # list (one dimensional array) B=A; # assignment copies values A[2]=5; NOT (A[2] == B[2]) AND A[3] == B[3] # evals to true - A[2] is not equal to B[2] ``` -------------------------------- ### INT4 INT4 Aster: SUBstr Function Example Source: https://help.int4.com/int4-aster-documentation/3.14/syntax-and-features Illustrates the SUBstr function for extracting a substring from a given string. It requires the string, the starting position, and the length of the substring to extract. ```INT4 Aster SUBstr("Text",1,2) # Evaluates to 'ex' ``` -------------------------------- ### Listing List Elements in ASTER Source: https://help.int4.com/int4-aster-documentation/3.14/tables-and-dynamic-symbols Provides a custom function `PRINTLIST2` to list all elements of a list in ASTER in an arbitrary order. It utilizes `INDEXES` to get all keys and `COUNT` to iterate through them, concatenating the values into a formatted string. The example shows how to call this function and its expected output. ```ASTER DEFUN("PRINTLIST2",("LIST"), LOCALS(("I","R","J"), FOR(I=1;R="";J=INDEXES(LIST),I<=COUNT(J),I=I+1, (R=R&LIST[J[I]]&",")); "[" & SUBSTR(R,0,-1) & "]" )); A=(1,2,3,4); PRINTLIST2(A) # will evaluate to [1,2,3,4] ``` -------------------------------- ### ASTER Scripting: Expressions, Comments, and Assignments Source: https://help.int4.com/int4-aster-documentation/3.14/syntax-and-features Demonstrates basic ASTER script structure, including expression sequencing with semicolons, line comments starting with '#', and assignment operations with side effects. The UCHAR function is used to create characters from Unicode values. ```ASTER A="Hello"; B="World"; # this is a comment, runs until the end of line C=UCHAR(32); D=UCHAR(11*3); # UCHAR assigns a character based on the 32 bit Unicode map A&C&B&D ``` -------------------------------- ### Conditional Payload Retrieval using Design Mode Source: https://help.int4.com/int4-aster-documentation/3.14/int4-test-execution-specific-functions This example demonstrates how to conditionally retrieve payloads based on whether the script is running in design mode. It uses GET_TC_OUTPUTS in design mode and GET_CONTEXT_PAYLOAD otherwise. ```Int4 Script PAYLOAD = IF(_DESIGN_MODE_, GET_TC_OUTPUTS()[1], GET_CONTEXT_PAYLOAD()); ``` -------------------------------- ### Concise Looping with FOR in ASTER Source: https://help.int4.com/int4-aster-documentation/3.14/control-flow The FOR function offers a more concise way to write loops. It starts with an initialization step, then checks a condition. If TRUE, it executes the code block, followed by an increment step, before re-evaluating the condition. The loop evaluates to the last executed expression within the code block. ```aster # example of using a FOR loop to create a text representation of # the data contained in the list # note that using INDEXES here means that the order # of the elements listed may be arbitrary DEFUN("PRINTLIST",("LIST"), LOCALS(("I","R","J"), FOR( I=1;R="";J=INDEXES(LIST), # initialization I<=COUNT(J), # condition I=I+1, # increment (R=R&LIST[J[i]]&",") # evaluated code ); "[" & SUBSTR(R,0,-1) & "]" # this is executed after loop ) # returning the value after cutting the last comma ); A=(1,2,3,4); PRINTLIST(A) # returns list value as [1,2,3,4] ``` -------------------------------- ### Variable Shadowing with DEFUN (ASTER) Source: https://help.int4.com/int4-aster-documentation/3.14/defining-your-own Illustrates variable scoping in ASTER functions. A global variable 'A' is defined, then a function 'AP' is defined using DEFUN with 'A' as an argument. The example shows that the function uses its local 'A', leaving the global 'A' unchanged. ```ASTER A=5; DEFUN("AP",("A"),A+1); # Define function AP, the global variable A is not accesible AP(1); # Returns 2, as the global value of A was shadowed A==5 # TRUE - Global variable is not changed ``` -------------------------------- ### Get Process Test Case List (Int4 Script) Source: https://help.int4.com/int4-aster-documentation/3.14/int4-test-execution-specific-functions Fetches a list of basic test case information for all test cases within the currently executing process in Int4 Suite. This includes SCENARIOID, PARENTID, TYPEID, CASEID, DESCR, AO, BO, DOCNUM, STATUS, and ME. Data is meaningful only when a test case number is provided in the editor. ```Int4 Script P=GET_PROCESS_TCLIST(); ``` -------------------------------- ### Get Process Test Case Data by Index (Int4 Script) Source: https://help.int4.com/int4-aster-documentation/3.14/int4-test-execution-specific-functions Retrieves detailed data for a specific test case within the current process, identified by its index 'x'. The index must correspond to the output of GET_PROCESS_TCLIST(). It returns INPUT, OUTPUTS, ACTUALS, VARIABLES, and STATUS. Requires GET_PROCESS_TCLIST() to be executed first to avoid errors. ```Int4 Script PROC=GET_PROCESS_TCLIST(); IX = INDEXES(PROC); FOR(I=1, I<=COUNT(IX), I+=1, LOG_MESSAGE("I", "STATUS OF TC " & PROC[I]["CASEID"] & ": " & GET_PROCESS_TCDATA(IX[I])["STATUS"] ) ); ``` -------------------------------- ### Get Test Case Variable Values in Int4 Suite Source: https://help.int4.com/int4-aster-documentation/3.14/int4-test-execution-specific-functions Reads variable values from the execution context, returning a two-dimensional table. The first dimension indicates the variable state ('VAR' for before execution, 'NEWVAR' for after). The second dimension is a numbered list of values. ```Int4 Scripting X=GET_TC_VAR("PO"); ``` -------------------------------- ### Get Array Indexes with INDEXES() Source: https://help.int4.com/int4-aster-documentation/3.14/built-in-functions The INDEXES function retrieves a list of all indexes for a given array. This is particularly useful for iterating over arrays that use string-based keys. Example: INDEXES(B) where B is an array with string keys. ```N/A B["APPLES"] = 1; B["BANANS"] = 2; IND = INDEXES(B) IND[2] # evals to “BANANAS” ``` -------------------------------- ### Example: Loop Execution Limit in ASTER Source: https://help.int4.com/int4-aster-documentation/3.14/execution-limits This ASTER code demonstrates a potential infinite loop scenario due to a forgotten increment. The loop will automatically terminate once the execution limit of 100,000 iterations is reached, preventing script failure. ```ASTER SUM = 0; WITH(I=0;Limit=100, WHILE(I 20 # Evals to ' ' - single space represents false value 1.5 > -2 # Evals to 'X' - single X represents true value NOT (5 > 10) # Evals to 'X' - single X represents true value 15;20 # Evals to 20 - value of last instruction is taken into account {"A"} # Evals to variable A and eventually it's value A=2 # Evals to 2, and result of evaluation is assigned to variable A ``` -------------------------------- ### Sorting with Inline Lambda Function (ASTER) Source: https://help.int4.com/int4-aster-documentation/3.14/defining-your-own Shows how to use an inline lambda function with ASTER's qsort for sorting. A list of random numbers is generated, and then sorted using a lambda function that defines the comparison logic (a < b). ```ASTER # sorting i=0; while( i<100, i=i+1;list[i]=ROUND(RANDOM(1000,9000),3)); # creating a list of 100 random numbers sorted = qsort(list, lambda(("a","b"), A=3, x=x-1;CONTINUE(x);B=15;x); # note that B=15 is not executed # C was assigned to IX = x; # execution resumes here D=20; C ); "F:"&A(x) & " B:" & B & " C:" & C & " D:" & D & " IX:" & IX # Evaluates to F:2 B:10 C:2 D:20 IX:2 # IX, D and C are altered during the normal function execution # Loop returns 2, as when it enters at X = 3, it decrements and uses # the decremented value as argument to final CONTINUE exiting the loop ``` -------------------------------- ### Utility Functions Source: https://help.int4.com/int4-aster-documentation/3.14/built-in-functions Miscellaneous utility functions including character conversion and regular expression matching. ```APIDOC ## UCHAR(x) ### Description Returns a character based on the provided 32-bit Unicode character number `x`. Refer to Unicode Map (e.g., Unicode Map.com) for character codes. ### Method UCHAR ### Endpoint N/A (Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **x** (integer) - The Unicode character number. ### Request Example ``` UCHAR(65) # evals to A ``` ### Response #### Success Response (200) Returns the character corresponding to the Unicode number. #### Response Example ``` "A" ``` ``` -------------------------------- ### XML Parsing and Rendering Source: https://help.int4.com/int4-aster-documentation/3.14/built-in-functions Functions for parsing XML strings into a manipulable tree structure and rendering that structure back into XML. ```APIDOC ## CXML_PARSE(x, y) ### Description Parses XML text in `x` into a tree structure that allows manipulation and browsing. Parameter `y` represents optional control parameters. Provide `S` for strict operation - throws an error for invalid input. ### Method CXML_PARSE ### Endpoint N/A (Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **x** (string) - The XML text to parse. * **y** (string, optional) - Control parameters. 'S' for strict operation. ### Request Example ``` xml=' confirmed 07-19-2012 Part No. 0110 Part No. 1609 Part No. 1710 '; p = cxml_parse(xml); ``` ### Response #### Success Response (Tree Structure) Returns a tree structure representing the parsed XML. #### Response Example (Internal tree representation, not directly shown as a string) ## CXML_RENDER(x, y) ### Description Converts a tree structure, as created by `CXML_PARSE` (or manually, if conforming) to XML representation. Parameter `y` represents optional control parameters. None supported in this version. ### Method CXML_RENDER ### Endpoint N/A (Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **x** (tree structure) - The XML tree structure to render. * **y** (string, optional) - Control parameters (none supported). ### Request Example ``` // Assuming 'p' is a tree structure from cxml_parse r = cxml_render(p); cxml_parse(r) EQL p # true ``` ### Response #### Success Response (200) Returns an XML string representation of the input tree structure. #### Response Example ```xml confirmed 07-19-2012 Part No. 0110 Part No. 1609 Part No. 1710 ``` ``` -------------------------------- ### String Manipulation Functions Source: https://help.int4.com/int4-aster-documentation/3.14/built-in-functions A collection of functions for manipulating strings, including finding substrings, changing case, replacing characters, and extracting parts of strings. ```APIDOC ## FIND(x, y) ### Description Finds the position of the first occurrence of substring `x` in string `y`, zero-based. Returns -1 if not found. ### Method FIND ### Endpoint N/A (Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **x** (string) - The substring to find. * **y** (string) - The string to search within. ### Request Example ``` FIND("A", "BACA") # evals to 1 ``` ### Response #### Success Response (200) Returns the zero-based index of the first occurrence, or -1 if not found. #### Response Example ``` 1 ``` ## LEFT(x, y) ### Description Gets the leftmost `y` characters from string `x`. ### Method LEFT ### Endpoint N/A (Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **x** (string) - The input string. * **y** (integer) - The number of characters to retrieve from the left. ### Request Example ``` LEFT("abc", 2) # evals "ab" ``` ### Response #### Success Response (200) Returns the leftmost characters of the string. #### Response Example ``` "ab" ``` ## LOWER(x) ### Description Converts string `x` to lower case. ### Method LOWER ### Endpoint N/A (Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **x** (string) - The string to convert. ### Request Example ``` LOWER("Abc") # evals "abc" ``` ### Response #### Success Response (200) Returns the lower-cased string. #### Response Example ``` "abc" ``` ## REPLACE(x, y, z) ### Description Replaces all occurrences of substring `x` in string `z` with substring `y`. ### Method REPLACE ### Endpoint N/A (Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **x** (string) - The substring to find and replace. * **y** (string) - The substring to replace with. * **z** (string) - The input string. ### Request Example ``` REPLACE("ABC", "DEF", "ABCDEF") # "DEFDEF" ``` ### Response #### Success Response (200) Returns the string with replacements made. #### Response Example ``` "DEFDEF" ``` ## RFIND(x, y) ### Description Finds the position of the first occurrence of substring `x` in string `y`, zero-based, using POSIX-based regular expression matching. Returns -1 if not found. ### Method RFIND ### Endpoint N/A (Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **x** (string) - The regular expression pattern to find. * **y** (string) - The string to search within. ### Request Example ``` RFIND("[cde]+", "BAcA") # evals to 2 ``` ### Response #### Success Response (200) Returns the zero-based index of the first match, or -1 if not found. #### Response Example ``` 2 ``` ## RIGHT(x, y) ### Description Gets the rightmost `y` characters from string `x`. ### Method RIGHT ### Endpoint N/A (Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **x** (string) - The input string. * **y** (integer) - The number of characters to retrieve from the right. ### Request Example ``` RIGHT("abc", 2) # evals "bc" ``` ### Response #### Success Response (200) Returns the rightmost characters of the string. #### Response Example ``` "bc" ``` ## RREPLACE(x, y, z) ### Description Replaces all occurrences of substring `x` in string `z` with substring `y`, using POSIX-based regular expression matching. ### Method RREPLACE ### Endpoint N/A (Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **x** (string) - The regular expression pattern to find and replace. * **y** (string) - The substring to replace with. * **z** (string) - The input string. ### Request Example ``` RREPLACE("[ABC]", "DEF", "ABCDEF") # "DEFDEFDEFDEF" ``` ### Response #### Success Response (200) Returns the string with replacements made. #### Response Example ``` "DEFDEFDEFDEF" ``` ## SUBSTR(x, y, z) ### Description Gets `z` characters from string `x`, after skipping the first `y` characters. ### Method SUBSTR ### Endpoint N/A (Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **x** (string) - The input string. * **y** (integer) - The number of characters to skip from the beginning. * **z** (integer) - The number of characters to retrieve. ### Request Example ``` SUBSTR("abc", 1, 2) # evals "bc" ``` ### Response #### Success Response (200) Returns the extracted substring. #### Response Example ``` "bc" ``` ## UPPER(x) ### Description Converts string `x` to upper case. ### Method UPPER ### Endpoint N/A (Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **x** (string) - The string to convert. ### Request Example ``` UPPER("Abc") # evals "ABC" ``` ### Response #### Success Response (200) Returns the upper-cased string. #### Response Example ``` "ABC" ``` ``` -------------------------------- ### Retrieve Reference Database Data Payload Source: https://help.int4.com/int4-aster-documentation/3.14/int4-test-execution-specific-functions Retrieves the reference database data payload in XML format from the current test case execution context. This is useful for accessing and validating reference data. ```Int4 Script P=GET_TC_REF_DB_DATA(); ``` -------------------------------- ### JSON Parsing and Rendering Source: https://help.int4.com/int4-aster-documentation/3.14/built-in-functions Functions for parsing JSON strings into a manipulable tree structure and rendering that structure back into JSON. ```APIDOC ## JSON_PARSE(x, y) ### Description Parses JSON text in `x` into a tree structure that allows manipulation and browsing. Parameter `y` represents optional control parameters. Provide `S` for strict operation - throws an error for invalid input. ### Method JSON_PARSE ### Endpoint N/A (Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **x** (string) - The JSON text to parse. * **y** (string, optional) - Control parameters. 'S' for strict operation. ### Request Example ``` json_string = '{"name": "John", "age": 30}'; json_tree = JSON_PARSE(json_string); ``` ### Response #### Success Response (Tree Structure) Returns a tree structure representing the parsed JSON. #### Response Example (Internal tree representation, not directly shown as a string) ## JSON_RENDER(x, y) ### Description Converts a tree structure, as created by `JSON_PARSE` (or manually, if conforming) to JSON representation. Parameter `y` represents optional control parameters. None supported in this version. ### Method JSON_RENDER ### Endpoint N/A (Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **x** (tree structure) - The JSON tree structure to render. * **y** (string, optional) - Control parameters (none supported). ### Request Example ``` // Assuming 'json_tree' is a tree structure from JSON_PARSE rendered_json = JSON_RENDER(json_tree); ``` ### Response #### Success Response (200) Returns a JSON string representation of the input tree structure. #### Response Example ```json { "name": "John", "age": 30 } ``` ``` -------------------------------- ### List and Table Operators - ASTER Source: https://help.int4.com/int4-aster-documentation/3.14/operators Operators for list creation, manipulation, and indexing. The comma (,) creates lists, while semicolon (;) separates operations. Square brackets ([]) are used for indexing and assignment in tables and lists. The backslash (\) is an alternative read-only indexing operator. ```ASTER A=(3,2,1) # A[1] = 3; A[2] = 2; A[3] = 1 A=3;B=2;C=A*B # sets C, evals to 6 A = 2 # sets A to 2, evals to 2 A[2][1] # returns element A[2]["FIELD"] = "value" # assignment A\2\1 # returns element value = A\2\1 # reading only! value = A\1"OFF" # reading only! ``` -------------------------------- ### XPath and XSLT Source: https://help.int4.com/int4-aster-documentation/3.14/built-in-functions Functions for querying XML data using XPath expressions and transforming XML data using XSLT. ```APIDOC ## CXPATH(x, y) ### Description Runs XPath matching on XML string `y` using string `x` as the XPath expression. Returns a list of matching nodes. ### Method CXPATH ### Endpoint N/A (Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **x** (string) - The XPath expression. * **y** (string) - The XML string to query. ### Request Example ``` XML=' ' 'AAC value ' '; XP='//cl[@id=3]/enumeration[@value="AAC"]'; R=CXPATH(XP,XML); # R[1] == "AAC value" ``` ### Response #### Success Response (200) Returns a list of matching nodes (strings). #### Response Example ``` ["AAC value"] ``` ## CXSLT(x, y, z) ### Description Runs a XSLT Transformation defined in `x` on XML data in `y`, using optionally provided XSLT parameters in `z`. Returns the result of transformation execution. ### Method CXSLT ### Endpoint N/A (Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **x** (string or loaded data) - The XSLT transformation definition. * **y** (string) - The input XML data. * **z** (object, optional) - Key-value pairs for XSLT parameters. ### Request Example ``` xslt_par=''; xslt_par["A"] = "1234"; xslt_par["B"] = "5678"; xml_in = ' abcd def '; xslt = LOAD('xml_payload_data'); // Assuming LOAD function retrieves XSLT content xml_out = CXSLT(xslt, xml_in, xslt_par); ``` ### Response #### Success Response (200) Returns the result of the XSLT transformation (typically an XML string). #### Response Example (Depends on the XSLT transformation applied) ``` -------------------------------- ### Looping with WHILE in ASTER Source: https://help.int4.com/int4-aster-documentation/3.14/control-flow The WHILE function implements a classical loop construct. It repeatedly evaluates a condition and, if TRUE, executes the provided code block. Execution stops when the condition evaluates to FALSE. The loop evaluates to the last executed expression within the code block. Care must be taken to avoid infinite loops. ```aster # example of a looping (instead of recurrent) implementation of factorial # note how the control variable X is tested in condition and then # reduced by 1 in every loop execution, ensuring that the looping finishes eventually DEFUN("LOOPING_FACTORIAL",("X"), LOCALS(("R"), R=1; # initialization done outside the loop WHILE(X>1, # loop continuation condition R=R*X; # calculations X=X-1); # counter decrement, to ensure the loop can stop! R # this value will be returned by LOCALS block ) # and by consequence, also by the function ) ``` -------------------------------- ### Retrieve Test Case Output Payloads Source: https://help.int4.com/int4-aster-documentation/3.14/int4-test-execution-specific-functions Retrieves the list of output payloads from the current test case execution context. It can be used to access specific outputs by index. ```Int4 Script P=GET_TC_OUTPUTS()[1]; ``` -------------------------------- ### Render JSON with JSON_RENDER Source: https://help.int4.com/int4-aster-documentation/3.14/built-in-functions Converts a tree structure (created by JSON_PARSE or manually) into a JSON string representation. Currently, no optional control parameters are supported. ```code json_tree = {"name":"Jane", "age":25}; json_string = JSON_RENDER(json_tree); ``` -------------------------------- ### Debug Message Logging in Int4 Suite Source: https://help.int4.com/int4-aster-documentation/3.14/int4-test-execution-specific-functions Sends a debugging message with the provided content to the test execution log. This function is useful for tracing script execution and identifying issues during testing. ```Int4 Scripting DEBUG("Helpful notice"); ``` -------------------------------- ### XPath Matching with CXPATH Source: https://help.int4.com/int4-aster-documentation/3.14/built-in-functions Executes an XPath query on an XML string to find matching nodes. The result is a list of the nodes that satisfy the XPath expression. ```code ' 'AAC value ' ``` XP='//cl[@id=3]/enumeration[@value="AAC"]' R=CXPATH(XP,XML); # R[1] == “AAC value" ``` -------------------------------- ### Comparison Operators - ASTER Source: https://help.int4.com/int4-aster-documentation/3.14/operators Provides operators for numeric and string comparisons. Numeric operators include equality (==), inequality (!=), greater/less than (>, <), and greater/less than or equal (>=, <=). String comparison uses '$==' and '$!='. ```ASTER 3 == 3 # evals to true 3 != 3 # evals to false 3 >= 3 # evals to true 3 > 1 # evals to true 2 < 5 # evals to true 3 <= 3 # evals to true "A" $== "A" # evals to true "A" $!= "A" # evals to false ``` -------------------------------- ### Log Message with Status in Int4 Suite Source: https://help.int4.com/int4-aster-documentation/3.14/int4-test-execution-specific-functions Sends a log message with a specified status to the test execution log. Supported message types include Error (E), Info (I), Success (S), and Warning (W). ```Int4 Scripting LOG_MESSAGE("E","Error"); LOG_MESSAGE("S","Eureka!"); ``` -------------------------------- ### Convert to Lowercase with LOWER Source: https://help.int4.com/int4-aster-documentation/3.14/built-in-functions Converts all characters in a given string to lowercase. ```code LOWER("Abc") # evals “abc” ``` -------------------------------- ### Recursive Factorial Calculation using DEFUN Source: https://help.int4.com/int4-aster-documentation/3.14/defining-your-own This snippet demonstrates how to define and call a recursive function in DEFUN to calculate the factorial of a number. The function 'S' calculates factorial using the recursive definition: S(X) = 1 if X=1, otherwise S(X) = S(X-1) * X. It takes an integer X as input and returns its factorial. ```DEFUN DEFUN("S","X",IF(X==1,1,S(X-1)*X)); S(5) == (5*4*3*2*1) ``` -------------------------------- ### Base64 Decoding with DECODE_BASE64() Source: https://help.int4.com/int4-aster-documentation/3.14/built-in-functions The DECODE_BASE64 function decodes a Base64 encoded scalar string. It will fail if the input data is not valid Base64. Ensure the input string is correctly encoded. ```N/A E=”VEVTVA==”; T=DECODE_BASE64(E);T $== “TEST” ``` -------------------------------- ### Map Operation with Lambda Function (ASTER) Source: https://help.int4.com/int4-aster-documentation/3.14/defining-your-own Demonstrates a 'map' operation in ASTER using a lambda function. A named function 'fsquare' is defined using lambda, and then a generic 'map' function is defined using DEFUN to apply 'fsquare' to each element of a list. ```ASTER # map operation fsquare = lambda("x",x*x); defun("map",("list","fun"), with(i=0;r=0;c=count(list), unset(r); while(i2,A="This will not evaluate"); # only condition gets evaluated, IF will return FALSE IF(1>2,A=1,A=2); # A is now equal 2, IF will return 2 IF(1>0,A=1,A=2); # A is now equal 1, IF will return 1 ``` -------------------------------- ### Removing Elements from a List in ASTER Source: https://help.int4.com/int4-aster-documentation/3.14/tables-and-dynamic-symbols Illustrates the use of the `UNSET` function to remove elements from a list in ASTER. It clarifies that `UNSET` removes the element but does not re-index the remaining elements, preserving their original indices. ```ASTER A=(1,2,3,4); UNSET(A[2]) # A is now (1,3,4) # note that unset does not alter indexes, that is : A[1] == 1, A[3] == 3, A[4] == 4 ``` -------------------------------- ### Find Substring with FIND Source: https://help.int4.com/int4-aster-documentation/3.14/built-in-functions Finds the zero-based index of the first occurrence of a substring within a string. Returns -1 if the substring is not found. ```code FIND("A","BACA") # evals to 1 ``` -------------------------------- ### Find Substring with RFIND (Regex) Source: https://help.int4.com/int4-aster-documentation/3.14/built-in-functions Finds the zero-based index of the first occurrence of a pattern matching a POSIX-based regular expression within a string. Returns -1 if no match is found. ```code RFIND("[cde]+","BAcA") # evals to 2 ``` -------------------------------- ### Conditional Variable Assignment based on Design Mode (ASTER) Source: https://help.int4.com/int4-aster-documentation/3.14/int4-test-execution-runtime-variables This snippet demonstrates how to conditionally assign values to variables based on whether the script is running in the design editor (_DESIGN_MODE_ is true) or during test execution. It utilizes ASTER's IF function and other Int4-specific functions like GET_TC_VAR, GET_TC_OUTPUTS, and GET_CONTEXT_PAYLOAD. ```ASTER PO = IF(_DESIGN_MODE_, "AFT_S4_123", GET_TC_VAR("PO")[1]["NEWVAR"]); PAYLOAD = IF(_DESIGN_MODE_, GET_TC_OUTPUTS()[1], GET_CONTEXT_PAYLOAD()); ```