# US 2024/0004784 A1 · Handling mock objects that are written in the form of multiple assignment instructions

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2024/0004784 A1
- Document ID: US20240004784A1
- Status: Published application
- Kind: A1
- Application number: 17/853,179
- Filed: 2022-06-29
- Published: 2024-01-04
- Earliest claimed: 2022-06-29
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Takaaki Tateishi
- Web page: https://patentgrep.com/patent/US20240004784A1

## CPC

- G06F 11/3688: {for test execution, e.g. scheduling of test suites}
- G06F 11/3624: {by performing operations on the source code, e.g. via a compiler}
- G06F 11/3698: Environments for analysis, debugging or testing of software
- G06F 11/3409: {for performance assessment}
- G06F 2201/86: Event-based monitoring
- G06F 2201/88: Monitoring involving counting
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A computer-implemented method, system and computer program product for effectively handling mock objects written in the form of multiple assignment instructions. A program to test software is instrumented so as to obtain an instrumented program having one or more mock objects. The instrumented program is parsed to identify one or more multiple assignment instructions each corresponding to a mock object. A function is then inserted in the instrumented program for each of the identified multiple assignment instructions corresponding to a mock object, where the function returns a tuple of the first “n” elements of the mock object. The instrumented program (after inserting the function(s) discussed above) is outputted to perform software testing, such as dynamic program analysis. In this manner, by inserting such function(s) in the instrumented program, the mock objects will be able to be executed without causing a failure.

## Claims

### Claim 1

A computer-implemented method for handling mock objects written in a form of multiple assignment instructions, the method comprising:
instrumenting a program to obtain an instrumented program having one or more mock objects, wherein said one or more mock objects are simulated objects that mimic a behavior of real objects;
parsing said instrumented program to identify one or more multiple assignment instructions each corresponding to a mock object;
inserting a first function in said instrumented program for each of said one or more identified multiple assignment instructions, wherein said first function returns a tuple of a first n elements of said mock object, wherein said n is a positive integer number; and
outputting said instrumented program to perform software testing after inserting said first function in said instrumented program for each of said one or more identified multiple assignment instructions.

### Claim 2 (depends on 1)

The method as recited in claim 1 further comprising:
counting a number of variables in each of said one or more identified multiple assignment instructions.

### Claim 3 (depends on 2)

The method as recited in claim 2, wherein a quantity of said first n elements of said mock object corresponds to said number of variables in an identified multiple assignment instruction.

### Claim 4 (depends on 2)

The method as recited in claim 2, wherein said number of variables in an identified multiple assignment instruction corresponds to a number of variables located in a left-hand side of said identified multiple assignment instruction.

### Claim 5 (depends on 1)

The method as recited in claim 1 further comprising:
parsing said instrumented program to identify each loop instruction containing one or more of said identified one or more multiple assignment instructions.

### Claim 6 (depends on 5)

The method as recited in claim 5 further comprising:
inserting a second function in each of said identified loop instruction of said instrumented program, wherein said second function returns of list of said first functions.

### Claim 7 (depends on 1)

The method as recited in claim 1, wherein said program is to perform dynamic program analysis.

### Claim 8

A computer program product for handling mock objects written in a form of multiple assignment instructions, the computer program product comprising one or more computer readable storage mediums having program code embodied therewith, the program code comprising programming instructions for:
instrumenting a program to obtain an instrumented program having one or more mock objects, wherein said one or more mock objects are simulated objects that mimic a behavior of real objects;
parsing said instrumented program to identify one or more multiple assignment instructions each corresponding to a mock object;
inserting a first function in said instrumented program for each of said one or more identified multiple assignment instructions, wherein said first function returns a tuple of a first n elements of said mock object, wherein said n is a positive integer number; and
outputting said instrumented program to perform software testing after inserting said first function in said instrumented program for each of said one or more identified multiple assignment instructions.

### Claim 9 (depends on 8)

The computer program product as recited in claim 8, wherein the program code further comprises the programming instructions for:
counting a number of variables in each of said one or more identified multiple assignment instructions.

### Claim 10 (depends on 9)

The computer program product as recited in claim 9, wherein a quantity of said first n elements of said mock object corresponds to said number of variables in an identified multiple assignment instruction.

### Claim 11 (depends on 9)

The computer program product as recited in claim 9, wherein said number of variables in an identified multiple assignment instruction corresponds to a number of variables located in a left-hand side of said identified multiple assignment instruction.

### Claim 12 (depends on 8)

The computer program product as recited in claim 8, wherein the program code further comprises the programming instructions for:
parsing said instrumented program to identify each loop instruction containing one or more of said identified one or more multiple assignment instructions.

### Claim 13 (depends on 12)

The computer program product as recited in claim 12, wherein the program code further comprises the programming instructions for:
inserting a second function in each of said identified loop instruction of said instrumented program, wherein said second function returns of list of said first functions.

### Claim 14 (depends on 8)

The computer program product as recited in claim 8, wherein said program is to perform dynamic program analysis.

### Claim 15

A system, comprising:
a memory for storing a computer program for handling mock objects written in a form of multiple assignment instructions; and
a processor connected to said memory, wherein said processor is configured to execute program instructions of the computer program comprising:
instrumenting a program to obtain an instrumented program having one or more mock objects, wherein said one or more mock objects are simulated objects that mimic a behavior of real objects;
parsing said instrumented program to identify one or more multiple assignment instructions each corresponding to a mock object;
inserting a first function in said instrumented program for each of said one or more identified multiple assignment instructions, wherein said first function returns a tuple of a first n elements of said mock object, wherein said n is a positive integer number; and
outputting said instrumented program to perform software testing after inserting said first function in said instrumented program for each of said one or more identified multiple assignment instructions.

### Claim 16 (depends on 15)

The system as recited in claim 15, wherein the program instructions of the computer program further comprise:
counting a number of variables in each of said one or more identified multiple assignment instructions.

### Claim 17 (depends on 16)

The system as recited in claim 16, wherein a quantity of said first n elements of said mock object corresponds to said number of variables in an identified multiple assignment instruction.

### Claim 18 (depends on 16)

The system as recited in claim 16, wherein said number of variables in an identified multiple assignment instruction corresponds to a number of variables located in a left-hand side of said identified multiple assignment instruction.

### Claim 19 (depends on 15)

The system as recited in claim 15, wherein the program instructions of the computer program further comprise:
parsing said instrumented program to identify each loop instruction containing one or more of said identified one or more multiple assignment instructions.

### Claim 20 (depends on 19)

The system as recited in claim 19, wherein the program instructions of the computer program further comprise:
inserting a second function in each of said identified loop instruction of said instrumented program, wherein said second function returns of list of said first functions.
