JP2007041804A - Program generation device, program verification device, and verification program - Google Patents

Program generation device, program verification device, and verification program Download PDF

Info

Publication number
JP2007041804A
JP2007041804A JP2005224601A JP2005224601A JP2007041804A JP 2007041804 A JP2007041804 A JP 2007041804A JP 2005224601 A JP2005224601 A JP 2005224601A JP 2005224601 A JP2005224601 A JP 2005224601A JP 2007041804 A JP2007041804 A JP 2007041804A
Authority
JP
Japan
Prior art keywords
input
processing
verification
program
variable
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2005224601A
Other languages
Japanese (ja)
Inventor
Shinichi Egami
慎一 江上
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sharp Corp
Original Assignee
Sharp Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sharp Corp filed Critical Sharp Corp
Priority to JP2005224601A priority Critical patent/JP2007041804A/en
Publication of JP2007041804A publication Critical patent/JP2007041804A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a program generation device and a program verification device 1 for supporting verification without omission whether or not an output value to an input value has not been changed. <P>SOLUTION: An input value computing means 16 computes input values to make a condition formula included in a source code be true and faulty, respectively. A program generation means generates a test program outputting an output value based on the computed true and faulty input values. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

本発明は、内容が変更されたプログラムの不具合を検証する装置に関する。   The present invention relates to an apparatus for verifying a defect in a program whose contents have been changed.

近年、ソフトウェア開発において、ソフトウェアのメンテナンス性を維持および向上する目的で、ソフトウェアの機能を変更せずに、たとえば入力値に対する出力値を変更せずに、ソースコードを改善するリファクタリングが実施されている。このリファクタリングでは、ソースコード書換時の誤記などによって、ソフトウェアの機能が変更されている場合があり、このようなソフトウェアの機能が変更されていないかを検証する必要がある。   In recent years, in software development, for the purpose of maintaining and improving software maintainability, refactoring has been implemented to improve source code without changing software functions, for example, without changing output values for input values. . In this refactoring, there is a case where the function of the software is changed due to an error in rewriting the source code, and it is necessary to verify whether the function of the software is changed.

従来では、リファクタリング前後でプログラムの一部を構成するモジュールの機能が変更されていないか、つまり入力値に対する出力値の同一性が損なわれていないかを検証するための検証テストとして、様々な方法が用いられている。その代表的テストとして、リファクタリング前後でモジュールを擬似的に実行して出力値を演算し、演算される出力値に基づいて、利用者が入力値に対する出力値の同一性を検証することが挙げられる。このような方法では、モジュールを擬似的に実行させるためのテストプログラムを生成する必要がある。このテストプログラムは、プログラマによって生成されている。利用者は、テストプログラムをリファクタリング後に生成されたモジュールに対して実行することによって、入力値に対する出力値に同一性について検証を行っている。   Conventionally, various methods have been used as verification tests for verifying whether the function of a module constituting a part of a program has been changed before and after refactoring, that is, whether the identity of an output value with respect to an input value is not impaired. Is used. As a representative test, a module is simulated before and after refactoring to calculate an output value, and the user verifies the identity of the output value with respect to the input value based on the calculated output value. . In such a method, it is necessary to generate a test program for executing the module in a pseudo manner. This test program is generated by a programmer. The user verifies the identity of the output value with respect to the input value by executing the test program on the module generated after refactoring.

また従来の技術のモジュール試験支援装置は、リファクタリング後のモジュールの入力値に対する出力値の検証を支援するためのテストプログラムを生成可能な装置である。モジュール試験支援装置によって生成されるテストプログラムを実行すると、利用者にモジュールに必要な入力値を促し、入力される入力値に基づいて出力値を出力する。この出力値にも基づいて、モジュールの機能が変更されて、入力値に対する出力値が変更していないかを検証することができる(特許文献1参照)。   A conventional module test support apparatus is an apparatus that can generate a test program for supporting verification of an output value with respect to an input value of a module after refactoring. When the test program generated by the module test support device is executed, the user is prompted for the input value necessary for the module, and the output value is output based on the input value input. Based on the output value, it can be verified whether the function of the module is changed and the output value for the input value is not changed (see Patent Document 1).

特開2000−109644号公報JP 2000-109644 A

従来のように、テストプログラムを生成する場合、モジュール毎にテストプログラムを生成される。それ故、プログラマが複数のモジュールを作成することに加えて、各モジュールに対応するテストプログラムを生成することも必要になり、プログラマの労力の負担が大きくなる。またプログラマは、想定し得る様々な入力値について検証可能なテストプログラムを生成する。しかしながら、これらの入力値によって、プログラムのすべての処理経路を網羅しているといえず、入力値に対する出力値の変更がされていないかを漏れなく検証可能なテストプログラムと言えない。したがって前記テストプログラムによって、すべてのバグを漏れなく検出することが困難であり、この検証結果に基づいて、プログラムのすべてのバグを修正することが困難である。   As in the prior art, when generating a test program, a test program is generated for each module. Therefore, in addition to the programmer creating a plurality of modules, it is also necessary to generate a test program corresponding to each module, increasing the burden on the programmer. In addition, the programmer generates a test program that can be verified for various possible input values. However, it cannot be said that all the processing paths of the program are covered by these input values, and it cannot be said that it is a test program that can verify whether or not the output value is changed with respect to the input value. Therefore, it is difficult to detect all bugs without omission by the test program, and it is difficult to correct all bugs of the program based on the verification result.

従来の技術のモジュール試験支援装置は、各モジュールに基づいてテストプログラムを生成する。したがってプログラマがテストプログラムを生成する必要がなく、プログラマの労力の負担を軽減することができる。しかしながらテストプログラムにおいて、利用者が入力値を入力するので、この装置についても、すべての処理経路が網羅されている検証であるとは言えない。モジュール試験支援装置で生成されるテストプログラムも、入力値に対する出力値の変更がされていないかを漏れなく検証するテストプログラムと言えない。したがって前記テストプログラムによって、すべてのバグを漏れなく検出することが困難であり、この検証結果に基づいて、プログラムのすべてのバグを修正することが困難である。   A conventional module test support apparatus generates a test program based on each module. Therefore, it is not necessary for the programmer to generate a test program, and the burden on the programmer can be reduced. However, since the user inputs an input value in the test program, it cannot be said that this apparatus is a verification that covers all processing paths. The test program generated by the module test support device cannot be said to be a test program for verifying whether or not the output value is changed with respect to the input value. Therefore, it is difficult to detect all bugs without omission by the test program, and it is difficult to correct all bugs of the program based on the verification result.

本発明の目的は、入力値に対する出力値が変更されていないかを漏れなく検証することを支援するプログラム生成装置およびプログラム検証装置を提供することである。   An object of the present invention is to provide a program generation device and a program verification device that assist in verifying whether an output value with respect to an input value has not been changed.

本発明は、入力される入力値に基づいて出力値を出力させる検証対象プログラムのソースコードに含まれる条件式であって、その条件式の真偽によって処理が分岐する条件式が真および偽になる入力値を演算する入力値演算手段と、
検証対象プログラムを用いて、入力値演算手段によって演算される入力値に基づく出力値を出力させるテストプログラムを生成するプログラム生成手段とを含むことを特徴とするプログラム生成装置である。
The present invention relates to a conditional expression included in the source code of a program to be verified that outputs an output value based on an input value that is input, and the conditional expression for which processing branches depending on whether the conditional expression is true or false. Input value calculation means for calculating the input value
A program generation apparatus comprising: a program generation means for generating a test program for outputting an output value based on an input value calculated by an input value calculation means using a verification target program.

また本発明は、入力される入力値に基づいて、出力値を出力させる複数の検証対象プログラムの入力値に対する出力値が同一であるか否かを検証するプログラム検証装置であって、
各検証対象プログラムのソースコードに含まれる条件式であって、その条件式の真偽によって処理が分岐する条件式が真および偽になる入力値を、検証対象プログラム毎に演算する入力値演算手段と、
入力値演算手段によって演算された入力値に基づいて、この入力値の演算に用いられた各検証対象プログラムを実行し、出力値を出力するプログラム実行手段と、
プログラム実行手段によって出力される各検証対象プログラムの出力値をそれぞれ比較する出力値比較手段と、
前記出力比較手段の比較結果に基づいて、各検証対象プログラムの出力値が同一であるか否かを検証する検証手段とを含むことを特徴とするプログラム検証装置である。
また本発明は、前記プログラム検証装置を制御するための検証プログラムである。
Further, the present invention is a program verification device that verifies whether or not output values for input values of a plurality of verification target programs that output output values are the same based on input values that are input,
An input value calculation means for calculating, for each verification target program, an input value that is a conditional expression included in the source code of each verification target program and whose conditional expression is true or false depending on whether the conditional expression is true or false When,
Based on the input value calculated by the input value calculation means, program execution means for executing each verification target program used for calculation of the input value and outputting an output value;
Output value comparison means for comparing the output values of each verification target program output by the program execution means;
And a verification unit that verifies whether the output values of the verification target programs are the same based on the comparison result of the output comparison unit.
The present invention is a verification program for controlling the program verification apparatus.

本発明によれば、入力値演算手段によって、ソースコードに含まれる条件式が真になる入力値(以下、「真入力値」という場合がある)および偽になる入力値(以下、「偽入力値」という場合がある)を演算する。プログラム生成手段は、真および偽入力値に基づく出力値を出力させるテストプログラムを生成する。テストプログラムを実行することによって、真および偽入力値に基づいて出力される出力値を演算できる。複数の検証対象プログラムについて、同様にテストプログラムを生成し実行することによって、各検証対象プログラムの真および偽入力値ならびにこれらの入力値に基づく出力値を演算できる。このように演算された各検証対象プログラムの出力値を比較することによって、各検証対象プログラムの真および偽入力値に基づく出力値が相互に同一であるか否かを容易に検証できる。このように出力値の同一性を容易に検証できるので、たとえばリファクタリングによって変更された変更後のプログラムおよび変更前のプログラムの入力値に対する出力値の同一性を検証できる。すべての条件式の真および偽入力値を演算することによって、各検証対象プログラムで辿り得るすべての処理経路(フロー)について検証することができ、また出力し得るすべての出力値を検証できる。これによって漏れのない検証を実現できる。このような漏れのない検証結果に基づいて、利用者は、変更後のプログラムに含まれるバグを漏れなく検出し、バグを容易に修正できる。   According to the present invention, an input value that is true for a conditional expression included in the source code (hereinafter may be referred to as “true input value”) and an input value that is false (hereinafter “false input”). Value)). The program generation means generates a test program that outputs an output value based on the true and false input values. By executing the test program, the output value output based on the true and false input values can be calculated. By similarly generating and executing test programs for a plurality of verification target programs, true and false input values of each verification target program and output values based on these input values can be calculated. By comparing the output values of the verification target programs calculated in this way, it is possible to easily verify whether or not the output values based on the true and false input values of the verification target programs are the same. Thus, since the identity of the output value can be easily verified, for example, the identity of the output value with respect to the input value of the program after the change changed by refactoring and the program before the change can be verified. By calculating the true and false input values of all the conditional expressions, it is possible to verify all the processing paths (flows) that can be traced by each verification target program, and it is possible to verify all the output values that can be output. This makes it possible to realize a leak-free verification. Based on such a complete verification result, the user can detect the bug included in the changed program without omission and easily correct the bug.

本発明によれば、入力値演算手段によって、ソースコードに含まれる条件式が真になる真入力値および偽になる偽入力値を演算する。プログラム実行手段は、各真および偽入力値に基づいて、これら入力値が演算された検証対象プログラムを実行し、真および偽入力値に基づく出力値を出力する。出力値比較手段は、プログラム実行手段によって出力された各検証対象プログラムの出力値を相互に比較する。検証手段は、出力値比較手段の比較結果に基づいて、各検証対象プログラムの真および偽入力値に基づく出力値が同一であるか否かを検証する。真および偽入力値に基づく出力値が同一であるか否かを検証することによって、たとえばリファクタリングによって変更された変更後のプログラムおよび変更前のプログラムの入力値に対する出力値の同一性を利用者が検証する手間を省くことができる。検証について人の手が介在しないので、利用者の検証漏れを防ぐことができる。またすべての条件式の真および偽入力値を演算することによって、各検証対象プログラムで辿り得るすべての処理経路(フロー)について検証することができ、また出力し得るすべての出力値を検証できる。これによって漏れのない検証を実現できる。このような漏れのない検証結果に基づいて、変更後のプログラムに含まれるバグを漏れなく検出し、利用者が漏れなくバグを修正することを促進できる。   According to the present invention, the input value calculation means calculates the true input value that makes the conditional expression included in the source code true and the false input value that makes false. The program execution means executes the verification target program in which these input values are calculated based on each true and false input value, and outputs an output value based on the true and false input values. The output value comparison unit compares the output values of the verification target programs output by the program execution unit with each other. The verification means verifies whether or not the output values based on the true and false input values of each verification target program are the same based on the comparison result of the output value comparison means. By verifying whether or not the output values based on the true and false input values are the same, for example, the user can determine the identity of the output values with respect to the input values of the changed program and the changed program that have been changed by refactoring. The time and effort for verification can be saved. Since there is no human intervention for verification, it is possible to prevent a user from omission of verification. Further, by calculating the true and false input values of all the conditional expressions, it is possible to verify all the processing paths (flows) that can be traced by each verification target program, and it is possible to verify all the output values that can be output. This makes it possible to realize a leak-free verification. It is possible to detect bugs included in the program after the change without omission based on such omission-free verification results and to promote the user to correct the bug without omission.

本発明によれば、各検証対象プログラムの真および偽出力値が相互に同一であるか否かを容易に検証できる装置を実現できる。   According to the present invention, it is possible to realize an apparatus that can easily verify whether or not the true and false output values of each verification target program are the same.

以下、図面を参照しながら本発明を実施するための形態を、複数の形態について説明する。各形態で先行する形態で説明している事項に対応している部分には同一の参照符を付し、重複する説明を略する場合がある。構成の一部のみを説明している場合、構成の他の部分は、先行して説明している形態と同様とする。また実施の各形態で具体的に説明している部分の組合わせばかりではなく、特に組合わせに支障が生じなければ、実施の形態同士を部分的に組合わせることも可能である。   Hereinafter, a plurality of embodiments for carrying out the present invention will be described with reference to the drawings. Portions corresponding to the matters described in the preceding forms in each embodiment are denoted by the same reference numerals, and overlapping description may be omitted. When only a part of the configuration is described, the other parts of the configuration are the same as those described in the preceding section. In addition to the combination of the parts specifically described in each embodiment, the embodiments may be partially combined as long as the combination is not particularly troublesome.

図1は、本実施の形態のプログラム検証装置1の機能をブロック毎に分けて示すブロック図である。プログラム検証装置1は、入力値に基づいて出力値を出力する複数の検証対象のプログラムの機能の同一性を検証する装置である。具体的には、プログラム検証装置1は、検証対象のプログラムの入力値に対する出力値が同一であるか否かを検証する装置である。プログラム検証装置1は、たとえばリファクタリング前後のプログラムの入力値に対する出力値が同一であるか否かを検証する装置である。プログラム検証装置1は、リファクタリング前後のプログラムを記憶させ、前述のような検証をするための検証プログラムを実行すると、各プログラムの入力値に対する出力値の同一性を検証する。   FIG. 1 is a block diagram showing functions of the program verification apparatus 1 according to the present embodiment separately for each block. The program verification apparatus 1 is an apparatus that verifies the identity of the functions of a plurality of verification target programs that output output values based on input values. Specifically, the program verification apparatus 1 is an apparatus that verifies whether or not the output values for the input values of the verification target program are the same. The program verification device 1 is a device that verifies whether the output values for the input values of the program before and after refactoring are the same, for example. When the program verification apparatus 1 stores the programs before and after refactoring and executes the verification program for performing the verification as described above, the program verification apparatus 1 verifies the identity of the output value with respect to the input value of each program.

以下では、C言語に基づくプログラムの一部を構成するモジュールの検証について説明している。ただしC言語に基づくプログラムおよびモジュールに限定されず、FORTRAN,JAVA(登録商標),C++などの手続き型言語およびオブジェクト指向型言語に基づくプログラムおよびモジュールであってもよく、その言語は限定されない。プログラム検証装置1は、たとえばパーソナルコンピュータである。プログラム検証装置1は、装置本体2、記憶部3、入力部4および出力部5を含む。装置本体2は、たとえば中央演算処理装置(Central Processing Unit:略称CPU)によって構成される。装置本体2は、記憶部3、入力部4および出力部5に電気的に接続される。装置本体2は、出力抽出部7、識別番号付加部8、分岐条件抽出部9、処理経路抽出部10、入力変数検索部11、テスト入力値生成部12、テスト生成部13、テスト実行部14および出力値比較検証部15を含む。   In the following, verification of modules constituting a part of a program based on the C language is described. However, it is not limited to programs and modules based on the C language, but may be programs and modules based on procedural languages and object-oriented languages such as FORTRAN, JAVA (registered trademark), C ++, etc., and the language is not limited. The program verification apparatus 1 is a personal computer, for example. The program verification device 1 includes a device main body 2, a storage unit 3, an input unit 4, and an output unit 5. The apparatus main body 2 is constituted by, for example, a central processing unit (abbreviated as CPU). The apparatus main body 2 is electrically connected to the storage unit 3, the input unit 4, and the output unit 5. The apparatus body 2 includes an output extraction unit 7, an identification number addition unit 8, a branch condition extraction unit 9, a processing path extraction unit 10, an input variable search unit 11, a test input value generation unit 12, a test generation unit 13, and a test execution unit 14. And an output value comparison verification unit 15.

出力抽出部7は、識別番号付加部8およびテスト生成部13に電気的に接続される。出力抽出部7は、ソースコードに基づいて、モジュール情報を抽出する機能を有する。モジュール情報は、検証対象のモジュール(以下、「検証対象モジュール」と称する場合がある)がこれ以外のモジュール(以下、「外部モジュール」と称する場合がある)に対して影響を与える関数、および引数などの有無を示す情報である。モジュール情報には、4つの情報が含まれる。4つの情報は、(1)モジュールに含まれる関数の有無、(2)モジュール内で値が変化する変数であって、引数にて参照渡しされる変数の有無、(3)グローバル変数の有無、および(4)検証対象モジュールから呼び出される外部モジュールに存在する関数(以下、「外部関数」と称する)の有無の情報である。これらの関数および変数は、検証対象モジュールでその値が変化すると、外部モジュールでもその値が維持されるために、これらの情報を抽出している。   The output extraction unit 7 is electrically connected to the identification number adding unit 8 and the test generation unit 13. The output extraction unit 7 has a function of extracting module information based on the source code. The module information includes functions and arguments that the module to be verified (hereinafter may be referred to as “verification target module”) affects other modules (hereinafter may be referred to as “external module”). It is information indicating the presence or absence. The module information includes four pieces of information. The four types of information are (1) presence / absence of functions included in the module, (2) variables whose values change in the module, and whether or not there are variables passed by reference in arguments, (3) presence / absence of global variables, And (4) information on the presence / absence of a function (hereinafter referred to as “external function”) present in an external module called from the verification target module. These functions and variables are extracted because their values are maintained in the external module when their values change in the verification target module.

識別番号付加部8は、テスト生成部13に電気的に接続される。識別番号付加部8は、ソースコードに基づいて、外部関数を抽出し、この外部関数に識別番号を付与する機能を有する。さらに識別番号付加部8は、この付与した識別番号を外部関数の引数に加える機能を有する。識別番号付加部8は、互いの同一の外部関数であっても、ソースコードにおいて異なる位置に記述された外部関数に対して、異なる識別番号を付与する。   The identification number adding unit 8 is electrically connected to the test generation unit 13. The identification number adding unit 8 has a function of extracting an external function based on the source code and assigning an identification number to the external function. Further, the identification number adding unit 8 has a function of adding the assigned identification number to the argument of the external function. The identification number adding unit 8 assigns different identification numbers to the external functions described at different positions in the source code even if they are the same external functions.

分岐条件抽出部9は、処理経路抽出部10および入力変数検索部11に電気的に接続される。分岐条件抽出部9は、ソースコードに基づいて、モジュールの処理経路を分岐させる分岐点およびその分岐させる分岐条件を抽出する機能を有する。処理経路は、各文を実行する順番を示すもの、いわゆるフローである。分岐条件抽出部9は、具体的には、if文およびswicth文などの条件文に基づく分岐点および前記条件文の条件式を抽出する機能を有する。処理経路抽出部10は、入力変数検索部11に電気的に接続される。処理経路抽出部10は、ソースコードに基づいて、モジュールにおいて、分岐点によって派生するすべての処理経路を抽出する機能を有する。   The branch condition extraction unit 9 is electrically connected to the processing path extraction unit 10 and the input variable search unit 11. The branch condition extraction unit 9 has a function of extracting a branch point for branching the processing path of the module and a branch condition for branching based on the source code. The processing path is a so-called flow indicating the order in which each sentence is executed. Specifically, the branch condition extraction unit 9 has a function of extracting a branch point based on a conditional statement such as an if statement and a switch statement and a conditional expression of the conditional statement. The processing path extraction unit 10 is electrically connected to the input variable search unit 11. The processing path extraction unit 10 has a function of extracting all processing paths derived from the branch points in the module based on the source code.

入力変数検索部11は、テスト入力値生成部12に電気的に接続される。入力変数検索部11は、ソースコード、分岐条件抽出部9および処理経路抽出部10で抽出される情報に基づいて、検証対象モジュールに入力すべき変数および外部関数(以下、「入力変数」と称する場合がある)、ならびにこの入力変数に入力すべき入力値(以下、「変数入力値」と称する場合がある)を演算するために必要な条件を検索する機能を有する。テスト入力値生成部12は、テスト生成部13に電気的に接続される。テスト入力値生成部12は、入力変数検索部11で探索される変数および条件に基づいて、変数入力値を演算する機能を有する。   The input variable search unit 11 is electrically connected to the test input value generation unit 12. The input variable search unit 11 is based on information extracted by the source code, the branch condition extraction unit 9 and the processing path extraction unit 10 and variables and external functions (hereinafter referred to as “input variables”) to be input to the verification target module. And a function for searching for a condition necessary for calculating an input value to be input to the input variable (hereinafter sometimes referred to as “variable input value”). The test input value generation unit 12 is electrically connected to the test generation unit 13. The test input value generation unit 12 has a function of calculating a variable input value based on variables and conditions searched by the input variable search unit 11.

テスト生成部13は、テスト実行部14に電気的に接続される。テスト生成部13は、ソースコード、モジュール情報、識別番号、入力変数および変数入力値に基づいて、検証対象モジュールを模擬的に実行しテストするためのテストプログラムを生成する機能を有する。テストプログラムは、各変数入力値に基づく出力値を演算させ出力させるプログラムである。   The test generation unit 13 is electrically connected to the test execution unit 14. The test generation unit 13 has a function of generating a test program for executing and testing the verification target module in a simulated manner based on the source code, module information, identification number, input variable, and variable input value. The test program is a program that calculates and outputs an output value based on each variable input value.

テスト実行部14は、出力値比較検証部15に電気的に接続される。テスト実行部14は、テスト生成部13で生成されるテストプログラムを実行し、各検証対象モジュールの出力値を演算する機能を有する。出力値比較検証部15は、テスト実行部14で出力される各検証対象モジュールの出力値を比較し、同一の変数入力値に対して異なる出力値が演算された変数入力値、およびその出力値などの情報(以下、「検証結果」と称する場合がある)を抽出する機能を有する。さらに出力値比較検証部15は、抽出された検証結果を出力部5に出力する機能を有する。   The test execution unit 14 is electrically connected to the output value comparison verification unit 15. The test execution unit 14 has a function of executing the test program generated by the test generation unit 13 and calculating the output value of each verification target module. The output value comparison / verification unit 15 compares the output value of each verification target module output from the test execution unit 14, the variable input value obtained by calculating different output values for the same variable input value, and the output value thereof And the like (hereinafter, sometimes referred to as “verification result”). Further, the output value comparison verification unit 15 has a function of outputting the extracted verification result to the output unit 5.

記憶部3は、複数の検証対象モジュールのソースコード、モジュール情報、条件式、処理経路、変数入力値、出力値、検証結果などを記憶する機能を有する。各構成部は、記憶部3に記憶されるソースコードに基づいて、演算などを行う。以下、特に記載がなければ、各構成部が各種情報を記憶させる構成部は、記憶部3である。入力部4は、利用者が入力などの操作をすることによって、装置本体2に命令を与えるために設けられる。入力部4は、たとえばキーボードである。出力部5は、変数入力値に基づく出力値および検証結果などを表示または印刷などして、利用者に前記出力値および検証結果を報知する機能を有する。出力部5は、たとえばディスプレイなどの表示部およびプリンタなどの印刷装置である。   The storage unit 3 has a function of storing source codes, module information, conditional expressions, processing paths, variable input values, output values, verification results, and the like of a plurality of verification target modules. Each component performs an operation based on the source code stored in the storage unit 3. Hereinafter, unless otherwise specified, the constituent unit in which each constituent unit stores various information is the storage unit 3. The input unit 4 is provided for giving a command to the apparatus main body 2 when a user performs an operation such as input. The input unit 4 is a keyboard, for example. The output unit 5 has a function of displaying or printing an output value based on a variable input value, a verification result, and the like to notify the user of the output value and the verification result. The output unit 5 is a display unit such as a display and a printing apparatus such as a printer.

プログラム検証装置1において、分岐条件抽出部9、処理経路抽出部10、入力変数検索部11およびテスト入力値生成部12が入力値演算手段16に相当する。テスト生成部13は、プログラム生成手段に相当する。テスト生成部13およびテスト実行部14は、プログラム実行手段17に相当する。出力値比較検証部15は、出力値比較手段および検証手段に相当する。   In the program verification apparatus 1, the branch condition extraction unit 9, the processing path extraction unit 10, the input variable search unit 11, and the test input value generation unit 12 correspond to the input value calculation unit 16. The test generation unit 13 corresponds to a program generation unit. The test generation unit 13 and the test execution unit 14 correspond to the program execution unit 17. The output value comparison / verification unit 15 corresponds to an output value comparison unit and a verification unit.

以下では、このようなプログラム検証装置1の装置本体2の処理動作について説明する。まず、検証対象モジュールについて説明する。本実施の形態では、2つの検証対象モジュールの入力値に対する出力値の同一性を検証する。2つの検証対象モジュールは、モジュールに対しリファクタリングした後のモジュール(以下、「変更後モジュール」と称する場合がある)およびリファクタリングされる前のモジュール(以下、「変更前モジュール」と称する場合がある)である。以下では、これら2つの検証対象モジュールのソースコード(以下、「検証対象ソースコード」と称する場合がある)の記述内容について説明する。   Hereinafter, the processing operation of the apparatus main body 2 of the program verification apparatus 1 will be described. First, the verification target module will be described. In the present embodiment, the identity of output values with respect to input values of two verification target modules is verified. The two verification target modules are a module after refactoring the module (hereinafter may be referred to as “module after change”) and a module before being refactored (hereinafter may be referred to as “module before change”). It is. In the following, description contents of source codes of these two verification target modules (hereinafter sometimes referred to as “verification target source code”) will be described.

まず変更前モジュールのソースコード(以下「変更前ソースコード」と称する場合がある)について説明する。変更前ソースコードを表1に示す。以下、説明の便宜上、ソースコードおよび出力結果などに、各行に行番号を付しているけれども、必ずしも行番号は必要ではない。行番号が付されていなくともよく、単に説明を容易にするためである。   First, the source code of the module before change (hereinafter may be referred to as “source code before change”) will be described. Table 1 shows the source code before the change. Hereinafter, for convenience of explanation, line numbers are given to the respective lines in the source code and the output result, but the line numbers are not necessarily required. It does not have to be line numbers and is merely for ease of explanation.

Figure 2007041804
Figure 2007041804

変更前ソースコードは、変数aおよび配列b[10]を引数とする関数funcについて記述され、前記引数に基づいて関数funcを演算するモジュールのソースコードである。変更前ソースコードは、1行目に関数funcが定義されている。3行目〜9行目には、変数c,d,cntが型宣言され、これら変数に値が代入されている。10行目には、変数aに値が代入されている。12行目〜17行目には、制御文のif文が記述され、if文は、条件式「a≧100かつa<200」の真偽に基づいて、処理経路を分岐させる。18行目〜24行目には、制御文のwhile文が記述されている。while文は、式「cnt<10」を具備しなくなるまで、制御を繰返して行わせる。while文内の19行目〜21行目には、if文が記述されている。条件式「cnt≧c」の真偽に基づいて、処理経路を分岐させる。26行目〜35行目には、制御文のswitch文が記述されている。switch文は、条件式「sub(a)」の値に基づいて、処理経路を分岐させる。   The pre-change source code is a source code of a module in which a function func having a variable a and an array b [10] as arguments is described, and the function func is calculated based on the argument. The function func is defined in the first line of the source code before change. In lines 3 to 9, variables c, d, and cnt are type-declared, and values are assigned to these variables. In the 10th line, a value is assigned to the variable a. In the 12th to 17th lines, the if statement of the control statement is described, and the if statement branches the processing path based on the truth of the conditional expression “a ≧ 100 and a <200”. In the 18th to 24th lines, the while statement of the control statement is described. The while statement causes the control to be repeated until it does not have the expression “cnt <10”. The if statement is described in the 19th to 21st lines in the while statement. Based on the truth of the conditional expression “cnt ≧ c”, the processing path is branched. In the 26th to 35th lines, the switch statement of the control statement is described. The switch statement branches the processing path based on the value of the conditional expression “sub (a)”.

次に変更後モジュールのソースコード(以下、「変更後ソースコード」と称する場合がある)について説明する。変更後ソースコードを表2に示す。   Next, the source code of the module after change (hereinafter sometimes referred to as “source code after change”) will be described. Table 2 shows the changed source code.

Figure 2007041804
Figure 2007041804

変更後ソースコードは、変更前ソースコードと同様に、変数aおよび配列b[10]を引数とする関数funcについて記述され、前記引数に基づいて関数funcを演算するモジュールのソースコードである。変更後ソースコードは、1行目に関数funcが定義されている。3行目には、変数dについて型宣言されている。6行目〜8行目には、if文が記述され、if文は、条件式「a≦100またはa>200」の真偽に基づいて、処理経路を分岐させる。10行目には、変数dに値が代入され、12行目には、関数func2が、5および配列bを引数として、呼び出されている。14行目〜21行目には、if文が記述されている。if文は、条件式「sub(a−1)=1」の真偽に基づいて、処理経路を分岐させる。23行目〜35行目には、関数func2が変数cおよび配列b[10]を引数として定義されている。関数func2では、25行目〜27行目に変数cntが型宣言され、変数cntに値が代入される。28行目〜35行目には、制御文のwhile文が記述されている。while文は、式「cnt<10」を具備しなくなるまで、制御を繰返して行わせる。while文内の29行目〜31行目には、if文が記述され、if文は、条件式「cnt≧c」の真偽に基づいて、処理経路を分岐させる。本実施の形態では、プログラム検証装置1のプログラム検証処理の説明を容易にするために、変更前および変更後ソースコードは、ある入力値が入力されると、所定の同一の入力値に対して互いに異なる出力値が出力されるように作成されている。次に、具体的なプログラム検証装置1の具体的な処理動作について説明する。   The post-change source code is a source code of a module in which a function func having a variable a and an array b [10] as arguments is described, and the function func is calculated based on the argument, similarly to the pre-change source code. In the changed source code, the function func is defined in the first line. In the third line, the type is declared for the variable d. The if statement is described in the sixth to eighth lines, and the if statement branches the processing path based on the truth of the conditional expression “a ≦ 100 or a> 200”. In line 10, a value is assigned to variable d, and in line 12, function func2 is called with 5 and array b as arguments. The if statement is described in the 14th to 21st lines. The “if” statement branches the processing path based on the truth of the conditional expression “sub (a−1) = 1”. In the 23rd to 35th lines, the function func2 is defined with the variable c and the array b [10] as arguments. In the function func2, the variable cnt is type-declared on the 25th to 27th lines, and a value is assigned to the variable cnt. In the 28th line to the 35th line, the while statement of the control statement is described. The while statement causes the control to be repeated until it does not have the expression “cnt <10”. The if statement is described in the 29th to 31st lines in the while statement, and the if statement branches the processing path based on the truth of the conditional expression “cnt ≧ c”. In the present embodiment, in order to facilitate the description of the program verification process of the program verification apparatus 1, the source code before and after the change is input to a predetermined identical input value when a certain input value is input. The output values are different from each other. Next, a specific processing operation of the specific program verification apparatus 1 will be described.

図2は、プログラム検証処理の手順を示すフローチャートである。プログラム検証装置1のプログラム検証処理には、構文解析工程、出力抽出処理工程、識別番号付加処理工程、分岐条件抽出処理工程、処理経路抽出処理工程、入力変数検索処理工程、テスト入力値生成部処理工程、テスト生成工程、テスト実行処理工程、出力値比較検証処理工程および検証結果報知工程を含む。プログラム検証処理は、検証ソースコードを記憶部3に記憶させ、入力部4によって、検証対象ソースコードを指定すると、ステップs1へ移行する。本実施の形態において、検証対象ソースコードは、変更前および変更後ソースコードであり、以下、単に「ソ−スコード」と称する場合がある。   FIG. 2 is a flowchart showing the procedure of the program verification process. The program verification process of the program verification apparatus 1 includes a syntax analysis process, an output extraction process process, an identification number addition process process, a branch condition extraction process process, a process path extraction process process, an input variable search process process, and a test input value generator process. A process, a test generation process, a test execution process, an output value comparison verification process, and a verification result notification process. In the program verification process, when the verification source code is stored in the storage unit 3 and the verification target source code is designated by the input unit 4, the process proceeds to step s1. In the present embodiment, the verification target source code is the source code before and after the change, and may be simply referred to as “source code” hereinafter.

図3は、出力抽出処理の手順を示すフローチャートである。ステップs1の出力抽出処理工程では、出力抽出処理を開始し、出力抽出部7によって、各ソースコードに基づいて、各検証対象モジュールのモジュール情報を抽出する。出力抽出処理において、動作主体は、出力抽出部7である。以下、出力抽出処理において出力抽出部7が制御主体の場合、その記載を省略する場合がある。   FIG. 3 is a flowchart showing the procedure of the output extraction process. In the output extraction processing step of step s1, output extraction processing is started, and the module information of each verification target module is extracted by the output extraction unit 7 based on each source code. In the output extraction process, the operation subject is the output extraction unit 7. Hereinafter, in the output extraction process, when the output extraction unit 7 is a control subject, the description may be omitted.

以下では、出力抽出処理について具体的に説明する。出力抽出処理工程s1に移行すると、出力抽出処理が開始し、ステップa1へ移行する。ステップa1では、各ソースコードに基づいて、最上位の関数が戻り値を返すか否かを検索し、検索結果を記憶させる。最上位の関数は、検証対象モジュールにおいて、プログラム構造上の最上位に位置する関数であり、外部モジュールから呼び出される関数である。関数は、検証対象モジュール内の処理によってその戻り値が変化する。このように関数の戻り値が変化するので、呼び出し元のモジュールの演算処理に影響を与える。関数が戻り値を返すか否かを検索することによって、検証対象モジュールが外部モジュールに影響を与えるモジュールであるか否かを判定できる。変更前ソースコードでは、1行目に関数funcが戻り値を返すものとして定義され、変更後ソースコードでも、1行目に関数funcが戻り値を返すものとして定義されている。したがって変更前および変更後ソースコードにおいて、関数が戻り値を返すことを検出し、記憶させる。関数の検索が終了すると、ステップa1からステップa2へ移行する。   Hereinafter, the output extraction process will be specifically described. When the process proceeds to the output extraction process step s1, the output extraction process starts, and the process proceeds to step a1. In step a1, whether or not the highest function returns a return value is searched based on each source code, and the search result is stored. The top-level function is a function positioned at the top of the program structure in the verification target module, and is a function called from an external module. The return value of the function changes depending on the processing in the verification target module. Since the return value of the function changes in this way, the calculation process of the calling module is affected. By searching whether or not the function returns a return value, it is possible to determine whether or not the verification target module is a module that affects the external module. In the source code before change, the function func is defined to return a return value on the first line, and in the source code after change, the function func is defined to return a return value on the first line. Therefore, it is detected and stored that the function returns a return value in the source code before and after the change. When the function search ends, the process proceeds from step a1 to step a2.

ステップa2は、参照渡しされる変数への代入の有無を検索する工程である。ステップa2では、各ソースコードに基づいて、参照渡しされる変数への代入の有無を検索し、検索結果を記憶させる。参照渡しされる変数は、演算子「&」を用いたアドレス参照、ポインタ変数および配列要素など、モジュール内で値が変更されると、外部モジュールでもその値が維持される変数である。参照渡しされる変数は、モジュール内でその値が変更されると、外部モジュールでもその値が維持されるので、外部モジュールでの演算に影響を与える。参照渡しされる変数への代入の有無を検索することによって、検証対象モジュールが外部モジュールに影響を与えるモジュールであるか否かを判定できる。   Step a2 is a step of searching for the presence or absence of assignment to a variable passed by reference. In step a2, based on each source code, the presence / absence of assignment to a variable passed by reference is searched, and the search result is stored. A variable passed by reference is a variable whose value is maintained in the external module when the value is changed in the module, such as an address reference using an operator “&”, a pointer variable, and an array element. If the value of a variable passed by reference is changed in the module, the value is maintained in the external module, which affects the calculation in the external module. By searching for the presence / absence of assignment to a variable passed by reference, it is possible to determine whether the verification target module is a module that affects the external module.

変更前ソースコードでは、22行目に配列b[10]に値が代入され、変更後ソースコードでも、33行目の配列b[10]に値が代入されている。したがって変更前および変更後ソースコードにおいて、参照渡しされる変数への代入ありと判定し、配列b[10]を抽出し、記憶させる。配列b[10]を抽出する際、その配列要素も抽出し記憶される。参照渡しされる変数への代入の有無の検索が終了すると、ステップa2からステップa3へ移行する。   In the source code before change, a value is assigned to the array b [10] on the 22nd line, and in the source code after change, a value is assigned to the array b [10] on the 33rd line. Therefore, in the source code before and after the change, it is determined that there is an assignment to the variable passed by reference, and the array b [10] is extracted and stored. When the array b [10] is extracted, the array element is also extracted and stored. When the search for the presence / absence of assignment to a variable passed by reference is completed, the process proceeds from step a2 to step a3.

ステップa3では、各ソースコードに基づいて、グローバル変数を検索し、検索結果を記憶させる。グローバル変数は、検証対象モジュールおよび外部モジュールにおいて、有効な変数である。それ故、検証対象モジュール内でグローバル変数に値が変更されると、外部モジュールでもその値が維持されるので、外部モジュールでの演算に影響を与える。グローバル変数の有無を検索することによって、検証対象モジュールが外部モジュールに影響を与えるモジュールであるか否かを判定できる。変更前および変更後ソースコードでは、グローバル変数が記述されていない。したがって変更前および変更後ソースコードにおいて、グローバル変数なしと判定し、記憶させる。グローバル変数の検索が終了すると、ステップa3からステップa4へ移行する。   In step a3, a global variable is searched based on each source code, and the search result is stored. The global variable is an effective variable in the verification target module and the external module. Therefore, when the value is changed to the global variable in the verification target module, the value is maintained in the external module, which affects the calculation in the external module. By searching for the presence or absence of a global variable, it can be determined whether or not the verification target module is a module that affects the external module. Global variables are not described in the source code before and after the change. Therefore, it is determined that there is no global variable in the source code before and after the change and stored. When the search for the global variable is completed, the process proceeds from step a3 to step a4.

ステップa4では、各ソースコードに基づいて、検証対象モジュールから呼ばれる外部関数の有無を検索し、検索結果を記憶させる。外部関数を呼び出すこと自体が外部モジュールへ影響を与えることになる。外部関数の有無を検索することによって、検証対象モジュールが外部モジュールに影響を与えるモジュールであるか否かを判定できる。変更前ソースコードでは、26行目に外部関数「sub(a)」が呼び出され、変更後ソースコードでは、14行目に外部関数「sub(a−1)」が呼び出されている。したがって変更前ソースコードにおいて、外部関数ありと判定し、外部関数「sub(a)」を抽出する。また変更後ソースコードにおいて、外部関数ありと判定し、外部関数「sub(a−1)」を抽出し、記憶させる。このようにしてステップa1からステップa4で検索して抽出されたモジュールを表3および4に示す。表3は、変更前モジュールのモジュール情報であり、表4が変更後モジュールのモジュール情報である。   In step a4, the presence / absence of an external function called from the verification target module is searched based on each source code, and the search result is stored. Calling an external function itself affects the external module. By searching for the presence or absence of an external function, it can be determined whether or not the verification target module is a module that affects the external module. In the source code before change, the external function “sub (a)” is called on the 26th line, and in the source code after change, the external function “sub (a-1)” is called on the 14th line. Accordingly, it is determined that there is an external function in the source code before change, and the external function “sub (a)” is extracted. In the changed source code, it is determined that there is an external function, and the external function “sub (a-1)” is extracted and stored. Tables 3 and 4 show modules extracted by searching in steps a1 to a4 in this way. Table 3 shows module information of the module before change, and Table 4 shows module information of the module after change.

Figure 2007041804
Figure 2007041804

Figure 2007041804
Figure 2007041804

外部関数の検索が終了すると、出力抽出処理が終了し、ステップs1からステップs2へ移行する。   When the search for the external function ends, the output extraction process ends, and the process proceeds from step s1 to step s2.

図4は、識別番号付加処理の手順を示すフローチャートである。図5は、外部関数に識別番号を付与する前および付与した後のソースコードの一部を示す図である。ステップs2である識別番号付加処理工程では、識別番号付加処理を開始し、識別番号付加部8が、各ソースコードに基づいて、外部関数に識別番号を付与し、この付与される識別番号を外部関数の引数に加える。識別番号付加処理において、動作主体は、識別番号付加部8である。以下、識別番号付加処理において識別番号付加部8が制御主体の場合、その記載を省略する場合がある。   FIG. 4 is a flowchart showing the procedure of the identification number addition process. FIG. 5 is a diagram showing a part of source code before and after assigning an identification number to an external function. In the identification number addition processing step which is step s2, the identification number addition processing is started, and the identification number addition unit 8 assigns an identification number to the external function based on each source code, Add to function argument. In the identification number addition process, the operation subject is the identification number addition unit 8. Hereinafter, in the identification number adding process, when the identification number adding unit 8 is a control subject, the description may be omitted.

以下では、識別番号付加処理について具体的に説明する。出力抽出処理工程s1から識別番号付加処理工程s2に移行すると、識別番号付加処理が開始し、ステップb1へ移行する。ステップb1では、各ソースコードの1行目から順に外部関数を検索する。変更前ソースコードでは、26行目に外部関数sub(a)が検出され、変更後ソースコードでは、14行目に外部関数sub(a−1)が検出される。外部関数を検出すると、ステップb1からステップb2へ移行する。   Hereinafter, the identification number adding process will be specifically described. When the process proceeds from the output extraction process step s1 to the identification number addition process step s2, the identification number addition process starts, and the process proceeds to step b1. In step b1, external functions are searched in order from the first line of each source code. In the source code before change, the external function sub (a) is detected on the 26th line, and in the source code after change, the external function sub (a-1) is detected on the 14th line. When the external function is detected, the process proceeds from step b1 to step b2.

ステップb2では、検出される外部関数に識別番号を付与する。識別番号を外部関数に付与し、この識別番号を外部関数の第1引数として加えられる。したがって外部関数の引数は、第1引数として識別番号が入力され、第2引数以降に従前に付与されていた引数が入力される。識別番号は、ソースコードのどの位置で外部関数が呼ばれているのかを明確にするために付与されている。識別番号の付与が終了すると、ステップb2からステップb1へ移行し、外部関数が検出された行の次の行から再度、外部関数の検索を開始する。   In step b2, an identification number is assigned to the detected external function. An identification number is assigned to the external function, and this identification number is added as the first argument of the external function. Therefore, for the argument of the external function, the identification number is input as the first argument, and the argument previously given after the second argument is input. The identification number is given to clarify at which position in the source code the external function is called. When the assignment of the identification number is completed, the process proceeds from step b2 to step b1, and the search for the external function is started again from the line next to the line where the external function is detected.

変更前ソースコードでは、26行目の外部関数sub(a)に、識別番号1を付与し、この識別番号1を第1引数に加える。したがって変更前ソースコードでは、図5に示すように、外部関数sub(a)を外部関数sub(1,a)に変更する。変更後ソースコードでは、14行目の外部関数sub(a−1)に、識別番号1を付与し、この識別番号1を第1引数に加える。したがって変更後ソースコードでは、外部関数sub(a−1)を外部関数sub(1,a−1)に変更する。識別番号の付与が終了すると、変更前ソースコードでは27行目から、変更後ソースコードでは15行目から検索を開始し、ステップb1に戻る。   In the source code before change, identification number 1 is assigned to the external function sub (a) on the 26th line, and this identification number 1 is added to the first argument. Therefore, in the source code before change, as shown in FIG. 5, the external function sub (a) is changed to the external function sub (1, a). In the changed source code, identification number 1 is assigned to the external function sub (a-1) on the 14th line, and this identification number 1 is added to the first argument. Therefore, in the changed source code, the external function sub (a-1) is changed to the external function sub (1, a-1). When the assignment of the identification number is completed, the search starts from the 27th line in the source code before the change and from the 15th line in the source code after the change, and the process returns to step b1.

ステップb1では、ソースコードの最終行まで検索し、外部関数が検出されない場合、識別番号付加処理を終了する。変更前および変更後ソースコードでは、それぞれ27行目および15行目以降に外部関数が呼び出されていないので、識別番号付加処理が終了し、ステップs2からステップs3へ移行する。   In step b1, the search is made up to the last line of the source code, and if no external function is detected, the identification number addition process is terminated. In the source code before and after the change, the external function is not called on the 27th line and the 15th line and thereafter, the identification number addition process ends, and the process proceeds from step s2 to step s3.

仮にステップb1で他の外部関数が検出されると、識別番号2を外部関数に付与し、第1引数に加える。他の外部関数についても同様に、検出順に識別番号を連番3,4,5,・・・で付与し、第1引数に加える。このとき外部関数および引数が同一であっても、呼び出される場所、つまり外部関数が記述される行が異なる場合、これらの外部関数には、異なる識別番号が付される。具体的には、同一の外部関数について、外部関数sub(1,a),sub(2,a),bus(3,a)・・・という様に異なる識別番号を付し、第1引数に加える。識別番号は、外部関数に連番で付与することに限定されず、互いに異なる番号であればよい。   If another external function is detected in step b1, identification number 2 is assigned to the external function and added to the first argument. Similarly, for other external functions, identification numbers are assigned as sequential numbers 3, 4, 5,... In the order of detection and added to the first argument. At this time, even if the external function and the argument are the same, if the place to be called, that is, the line describing the external function is different, these external functions are assigned different identification numbers. Specifically, different identification numbers such as external functions sub (1, a), sub (2, a), bus (3, a)... Are assigned to the same external function, and the first argument is set. Add. The identification number is not limited to being assigned to the external function with a serial number, and may be any number different from each other.

図6は、分岐条件抽出処理の手順を示すフローチャートである。ステップs3である分岐条件抽出処理工程では、分岐条件抽出処理を開始し、各ソースコードに基づいて、各検証対象モジュールの処理経路を分岐させる分岐点および分岐させる分岐条件を抽出して、記憶させる。分岐条件抽出処理において、動作主体は、分岐条件抽出部9である。以下、分岐条件抽出処理において分岐条件抽出部9が制御主体の場合、その記載を省略する場合がある。   FIG. 6 is a flowchart showing a procedure of branch condition extraction processing. In the branch condition extraction processing step, which is step s3, branch condition extraction processing is started, and branch points for branching the processing path of each verification target module and branch conditions for branching are extracted and stored based on each source code. . In the branch condition extraction process, the operating subject is the branch condition extraction unit 9. Hereinafter, in the branch condition extraction process, when the branch condition extraction unit 9 is a control subject, the description may be omitted.

以下では、分岐条件抽出処理について具体的に説明する。識別番号付加処理工程s2から分岐条件抽出処理工程s3へ移行すると、分岐条件抽出処理が開始し、ステップc1へ移行する。ステップc1では、各検証対象モジュールで最初に実行すべき処理を記述する文を検出する。以下では、実行すべき処理を記述する文を「命令文」と称する場合がある最初の命令文を検出すると、ステップc1からステップc2へ移行する。   Hereinafter, the branch condition extraction process will be specifically described. When the process proceeds from the identification number addition process step s2 to the branch condition extraction process step s3, the branch condition extraction process starts, and the process proceeds to step c1. In step c1, a sentence describing a process to be executed first in each verification target module is detected. In the following, when a statement that describes a process to be executed is detected as the first statement that may be referred to as a “command”, the process proceeds from step c1 to step c2.

ステップc2である分岐数検出工程では、検出された命令文(以下、「検出文」と称する場合がある)を、処理経路を分岐させる分岐数に基づいて分類する。具体的には、分岐条件抽出部9は、変数の型を宣言する文、関数、代入式、return文およびbreak文などの処理経路を分岐させない命令文、ならびに条件を具備するまで処理が繰返させるwhile文やfor文などの繰返し処理を行う命令文を無分岐処理文に分類する。またif文など、条件式の真偽に基づいて処理経路を分岐させる命令文を2分岐処理文に分類する。さらにswitch文など、条件式の値に基づいて処理経路を分岐させる命令文を多分岐処理文に分類する。検出文が無分岐処理文に分類されると、ステップc2からステップc3へ移行する。ステップc3では、各ソースコードについて、さらに他の命令文についての検出を行う。他の命令文が検出されない場合、分岐条件抽出処理が終了する。分岐条件抽出処理が終了すると、ステップs3からステップs4へ移行する。他の命令文を検出すると、ステップc2へ戻り、次に検出された文の分類作業を行う。   In the branch number detection step, which is step c2, the detected command statements (hereinafter sometimes referred to as “detected statements”) are classified based on the number of branches that branch the processing path. Specifically, the branch condition extraction unit 9 repeats the process until a statement that declares the type of a variable, a function, an assignment expression, an instruction statement that does not branch the processing path, such as a return statement and a break statement, and a condition are satisfied. An instruction statement that performs repeated processing such as a while statement and a for statement is classified as a non-branch processing statement. Also, an instruction statement such as an if statement that branches the processing path based on the truth of the conditional expression is classified as a two-branch processing statement. Further, a command statement that branches the processing path based on the value of the conditional expression such as a switch statement is classified as a multi-branch processing statement. When the detected sentence is classified as a non-branch process sentence, the process proceeds from step c2 to step c3. In step c3, for each source code, detection is performed for another command statement. If no other statement is detected, the branch condition extraction process ends. When the branch condition extraction process ends, the process proceeds from step s3 to step s4. When another command sentence is detected, the process returns to step c2, and the next detected sentence is classified.

ステップc2で、検出文が2分岐処理文に分類されると、ステップc4へ移行する。ステップc4である条件抽出工程では、検出文の条件式を抽出し、記憶させる。条件式に論理演算子が含まれる場合、条件式を論理演算子によって複数の式に分割し、各式を記憶させる。たとえばif文の条件式が「a>=100&&a<200」の場合、論理演算子「&&」に基づいて、「a>=100」と「a<200」の2つの条件式に分割して、記憶させる。条件式を記憶させると、ステップc4からステップc3へ移行する。   When the detected sentence is classified into the two-branch process sentence in step c2, the process proceeds to step c4. In the condition extraction step, which is step c4, the conditional expression of the detected sentence is extracted and stored. When the conditional expression includes a logical operator, the conditional expression is divided into a plurality of expressions by the logical operator, and each expression is stored. For example, if the conditional expression of the “if” statement is “a> = 100 && a <200”, the conditional expression is divided into two conditional expressions “a> = 100” and “a <200” based on the logical operator “&&”. Remember. When the conditional expression is stored, the process proceeds from step c4 to step c3.

ステップc2で、検出文が多分岐処理文に分類されると、ステップc5へ移行する。ステップc5である条件抽出工程では、検出文の条件式が場合分けされる値毎に、条件式およびその値を抽出し、記憶させる。たとえばswitch文の条件式「sub(a)」が「1」で第1命令文を実行し、switch文の条件式「sub(a)」が「2」で第2命令文を実行する場合、条件式「sub(a)==1」および「sub(a)==2」を記憶させる。条件式を記憶させると、ステップc5からステップc3へ移行する。   When the detected sentence is classified into the multi-branch process sentence in step c2, the process proceeds to step c5. In the condition extracting step, which is step c5, the conditional expression and its value are extracted and stored for each value for which the conditional expression of the detected sentence is classified. For example, when the switch statement conditional expression “sub (a)” is “1” and the first command statement is executed, and the switch statement conditional expression “sub (a)” is “2” and the second command statement is executed, Conditional expressions “sub (a) == 1” and “sub (a) == 2” are stored. When the conditional expression is stored, the process proceeds from step c5 to step c3.

以下では、この分岐条件抽出処理について、変更前および変更後ソースコードを用いて具体的に説明する。変更前ソースコードでは、ステップc1において、3行目の型宣言文「int c」を検出し、ステップc2へ移行する。ステップc2では、型宣言文「int c」を無分岐処理文に分類し、ステップc3へ移行する。ステップc3では、4行目の型宣言文「int d」を検出する。4行目から10行目までの各型宣言文および式についても、3行目の型宣言文「int c」と同様に、各行でステップc2とステップc3との処理を行う。ステップc2では、これらの検出文が無分岐処理文に分類される。   Hereinafter, this branch condition extraction processing will be specifically described using source code before and after the change. In the pre-change source code, in step c1, the type declaration sentence “int c” on the third line is detected, and the process proceeds to step c2. In step c2, the type declaration statement “int c” is classified as a non-branch processing statement, and the process proceeds to step c3. In step c3, the type declaration sentence “int d” on the fourth line is detected. Similarly to the type declaration statement “int c” on the third line, the processes of step c2 and step c3 are performed for each type declaration statement and expression on the fourth line to the tenth line. In step c2, these detected sentences are classified as non-branch process sentences.

10行目の代入式「a=a−1」の分類後、ステップc3で12行目のif文を検出し、ステップc2へ移行する。ステップc2では、検出されたif文を2分岐処理文に分類し、ステップc4へ移行する。ステップc4では、if文の条件式「a>=100&&a<200」を検出する。さらに前記if文の条件式に論理演算子が含まれるので、if文の条件式を論理演算子によって分割して2つの条件式「a>=100」および「a<200」を抽出し、記憶させる。2つの条件式を記憶させると、ステップc3へ移行する。   After classification of the substitution expression “a = a−1” on the 10th line, the if statement on the 12th line is detected in step c3, and the process proceeds to step c2. In step c2, the detected if sentence is classified into a two-branch process sentence, and the process proceeds to step c4. In step c4, the conditional expression “a> = 100 && a <200” of the if statement is detected. Further, since the conditional expression of the if statement includes a logical operator, the conditional expression of the if statement is divided by the logical operator, and two conditional expressions “a> = 100” and “a <200” are extracted and stored. Let When the two conditional expressions are stored, the process proceeds to step c3.

13行目の代入式「c=5」、15行目のreturn文および18行目のwhile文については、これらの文が無分岐処理文であるので、ステップc3で検出されてステップc2に戻る。ステップc2で無分岐処理文に分類され、ステップc3に移行する。各行でこの処理を行い、18行目のwhile文を分類した後、ステップc3では、19行目のif文を検出する。ステップc2では、検出されたif文を2分岐処理文に分類し、ステップc4へ移行する。ステップc4では、if文の条件式「cnt>=c」を検出する。条件式「cnt>=c」を抽出し、記憶させ、ステップc3へ移行する。   Since the substitution expression “c = 5” on the 13th line, the return statement on the 15th line, and the while statement on the 18th line are non-branch processing statements, they are detected in step c3 and the process returns to step c2. . In step c2, it is classified as a non-branch processing statement, and the process proceeds to step c3. After this process is performed on each line and the while sentence on the 18th line is classified, the if sentence on the 19th line is detected in step c3. In step c2, the detected if sentence is classified into a two-branch process sentence, and the process proceeds to step c4. In step c4, the conditional expression “cnt> = c” of the if statement is detected. Conditional expression “cnt> = c” is extracted and stored, and the process proceeds to step c3.

22行目の代入式「b[cnt]=cnt*10」および23行目の代入式「cnt=cnt+1」については、これらの文が無分岐処理文であるので、ステップc3で検出されてステップc2に戻る。ステップc2で無分岐処理文に分類され、ステップc3に移行する。各行でこの処理を行い、23行目の代入式を分類した後、ステップc3では、26行目のswitch文を検出し、ステップc2へ戻る。ステップc2では、検出されたswitch文を多分岐処理文に分類し、ステップc5へ移行する。ステップc5では、switch文の条件式「sub(a)」とその値「1」および「2」とに基づいて、条件式「sub(a)==1」および「sub(a)==2」を抽出し、記憶させ、ステップc3へ移行する。   The substitution expression “b [cnt] = cnt * 10” on the 22nd line and the substitution expression “cnt = cnt + 1” on the 23rd line are detected in step c3 because these sentences are non-branch processing sentences. Return to c2. In step c2, it is classified as a non-branch processing statement, and the process proceeds to step c3. After performing this process on each line and classifying the substitution expression on the 23rd line, in step c3, the switch statement on the 26th line is detected, and the process returns to step c2. In step c2, the detected switch statement is classified as a multi-branch processing statement, and the process proceeds to step c5. In step c5, based on the conditional expression “sub (a)” of the switch statement and its values “1” and “2”, the conditional expressions “sub (a) == 1” and “sub (a) == 2”. Is extracted and stored, and the process proceeds to step c3.

28行目の代入式「d=30000」、30行目の代入式「d=d+10000」、31行目のbreak文および34行目のreturn文については、これらの文が無分岐処理文であるので、ステップc3で検出されてステップc2に戻る。ステップc2で無分岐処理文に分類され、ステップc3に移行する。各行でこの処理を行い、34行目のreturn文を分類した後、ステップc3では、最終行まで他の文が検出できないので、分岐条件抽出処理が終了する。分岐条件抽出処理が終了すると、ステップs3からステップs4へ移行する。変更前ソースコードにおいて、この分岐条件抽出処理によって抽出される条件式(以下、「分岐条件式」と称する場合がある)を表5に示す。1列目が、分岐条件式が記述される行番号、2列目が、分岐条件式を示す。   For the assignment expression “d = 30000” on the 28th line, the assignment expression “d = d + 10000” on the 30th line, the break statement on the 31st line, and the return statement on the 34th line, these statements are non-branch processing statements. Therefore, it is detected in step c3 and returns to step c2. In step c2, it is classified as a non-branch processing statement, and the process proceeds to step c3. After this process is performed on each line and the return sentence on the 34th line is classified, in step c3, no other sentence can be detected up to the last line, so the branch condition extraction process ends. When the branch condition extraction process ends, the process proceeds from step s3 to step s4. Table 5 shows the conditional expressions (hereinafter sometimes referred to as “branch conditional expressions”) extracted by this branch condition extraction process in the source code before change. The first column shows the row number in which the branching conditional expression is described, and the second column shows the branching conditional expression.

Figure 2007041804
Figure 2007041804

変更後ソースコードでも、変更前ソースコードの場合と同様の分岐条件抽出処理を行い、各検出文毎に分類および抽出する。これによって表6に示される分岐条件式が抽出され、記憶される。1列目が、分岐条件式が記述される行番号、2列目が、分岐条件式を示す。変更前ソースコードの場合と同様に、処理経路抽出処理が終了すると、ステップs3からステップs4へ移行する。   The post-change source code is subjected to the same branch condition extraction process as that of the pre-change source code, and is classified and extracted for each detected sentence. As a result, the branch condition expression shown in Table 6 is extracted and stored. The first column shows the row number in which the branching conditional expression is described, and the second column shows the branching conditional expression. As in the case of the source code before change, when the processing path extraction process is completed, the process proceeds from step s3 to step s4.

Figure 2007041804
Figure 2007041804

図7は、処理経路抽出処理の手順を示すフローチャートである。ステップs4である処理経路抽出処理工程では、処理経路抽出処理を開始し、各ソースコードに基づいて、分岐点によって派生するすべての処理経路を抽出する。処理経路抽出処理において、動作主体は、処理経路抽出部10である。以下、処理経路抽出処理において処理経路抽出部10が制御主体の場合、その記載を省略する場合がある。   FIG. 7 is a flowchart showing the procedure of the processing path extraction process. In the processing route extraction processing step, which is step s4, processing route extraction processing is started, and all processing routes derived from branch points are extracted based on each source code. In the processing path extraction process, the operation subject is the processing path extraction unit 10. Hereinafter, when the processing path extraction unit 10 is a controlling entity in the processing path extraction process, the description may be omitted.

以下では、処理経路抽出処理について具体的に説明する。分岐条件抽出処理工程s3から処理経路抽出処理工程s4に移行すると、処理経路抽出処理が開始し、ステップd1へ移行する。ステップd1である処理ブロック抽出工程では、各ソースコードから処理ブロックを抽出する。以下に、処理ブロックを抽出する処理ブロック抽出方法を説明する。まず制御文の直前、論理演算子の直前、制御文に従って分岐した分岐先のブロックの直前、return文の直前、goto文の直前、およびbreak文の直前に、それぞれ区切りを入れる。制御文に従って分岐した分岐先のブロックの直前とは、たとえばif文においてelse節を含まない場合のように制御文において分岐先が記述されていない場合、制御文の直後のブロックを分岐先のブロックの直前、またはgoto文において、ラベルの直前である。この区切られた各区間内の宣言文、代入式、条件式、およびこれらを組合わせたブロックを処理ブロックとしてそれぞれ抽出し、各処理ブロックに名称をつけて記憶させる。また空文も、処理ブロックとしてそれぞれ抽出し、名称をつけて記憶させる。このように文が含まれていない区間についても、処理ブロックとして抽出することによって、処理経路がいずれの条件式に基づいて、処理されているのかを明確にさせることができる。このような処理ブロック抽出方法によって、処理ブロックが抽出され記憶されると、ステップd1からステップd2へ移行する。   Hereinafter, the processing path extraction process will be specifically described. When the branch condition extraction process step s3 shifts to the process path extraction process step s4, the process path extraction process starts, and the process moves to step d1. In the processing block extraction step, which is step d1, processing blocks are extracted from each source code. A processing block extraction method for extracting processing blocks will be described below. First, delimiters are inserted immediately before the control statement, immediately before the logical operator, immediately before the branch destination block branched according to the control statement, immediately before the return statement, immediately before the goto statement, and immediately before the break statement. The immediately preceding branch destination block branched according to the control statement means that if the branch destination is not described in the control statement, for example, if the else clause is not included in the if statement, the block immediately after the control statement is the branch destination block. Or just before the label in the goto statement. A declaration statement, an assignment expression, a conditional expression, and a block combining these in each section are extracted as processing blocks, and each processing block is given a name and stored. Also, empty sentences are extracted as processing blocks, stored with names. As described above, by extracting a section including no sentence as a processing block, it is possible to clarify which conditional expression is used to process the processing path. When a processing block is extracted and stored by such a processing block extraction method, the process proceeds from step d1 to step d2.

ステップd2である処理経路探索開始工程では、ソースコードの1行目から順に、処理ブロックの検出を開始する。処理ブロックを検出すると、検出された処理ブロック(以下、「検出処理ブロック」と称する場合がある)を、処理経路において最初に実行すべき処理ブロックとして記憶させる。検出処理ブロックを記憶させると、ステップd2からステップd3へ移行する。   In the processing path search start step, which is step d2, detection of processing blocks is started in order from the first line of the source code. When a processing block is detected, the detected processing block (hereinafter sometimes referred to as “detection processing block”) is stored as a processing block to be executed first in the processing path. When the detection processing block is stored, the process proceeds from step d2 to step d3.

ステップd3では、検出処理ブロックの直前の文が、無分岐処理文、2分岐処理文および多分岐処理文のいずれの文であるか否かを判定する。処理ブロックの直前に文がない場合、無分岐処理文であると判定される。無分岐処理文であると判定すると、ステップd3からステップd4へ移行する。   In step d3, it is determined whether the sentence immediately before the detection process block is a non-branch process sentence, a two-branch process sentence, or a multi-branch process sentence. If there is no statement immediately before the processing block, it is determined that the statement is a non-branch processing statement. If it is determined that the statement is a non-branch processing statement, the process proceeds from step d3 to step d4.

またステップd3では、2分岐処理文であると判定すると、ステップd5へ移行する。ステップd5では、処理ブロックの直後に論理演算子が記述されているか否かを判定する。論理演算子が記述されていないと判定すると、ステップd5からステップd6へ移行する。ステップd6では、検出処理ブロックが真および偽になる場合の2つの処理経路を検出する。具体的には、まず2分岐処理文の条件式が真になる場合の分岐先の処理ブロック(以下、「真処理ブロック」と称する場合がある)および前記条件式が偽になる場合の各分岐先の処理ブロック(以下、「偽処理ブロック」と称する場合がある)を検出する。次に検出処理ブロックの次に実行すべき処理ブロックとして、検出された真および偽処理ブロックをそれぞれ追加し、検出処理ブロックが真になる場合および偽になる場合の2つの処理経路を検出する。この2つの処理経路を記憶させ、検出された2つの分岐先の処理ブロックのうち一方の処理ブロックを検出処理ブロックに選出し、ステップd6からステップd3へ移行する。   If it is determined in step d3 that the sentence is a two-branch processing statement, the process proceeds to step d5. In step d5, it is determined whether or not a logical operator is described immediately after the processing block. If it is determined that the logical operator is not described, the process proceeds from step d5 to step d6. In step d6, two processing paths are detected when the detection processing block becomes true and false. Specifically, first, the processing block at the branch destination when the conditional expression of the two-branch processing statement becomes true (hereinafter sometimes referred to as “true processing block”) and each branch when the conditional expression becomes false A previous processing block (hereinafter may be referred to as a “fake processing block”) is detected. Next, detected true and false processing blocks are added as processing blocks to be executed next to the detection processing block, respectively, and two processing paths when the detection processing block becomes true and false are detected. The two processing paths are stored, and one of the detected two branch destination processing blocks is selected as a detection processing block, and the process proceeds from step d6 to step d3.

ステップd5で、論理演算子が記述されていると判定すると、ステップd5からステップd7へ移行する。ステップd7では、検出処理ブロックが真および偽になる場合の2つの処理経路を検出する。具体的には、まず真処理ブロック、偽処理ブロックおよび前記論理演算子の直後の処理ブロックを検出する。次に論理演算子に基づいて、検出処理ブロックの次に実行すべき処理ブロックとして、検出された真処理ブロック、偽処理ブロックおよび論理演算子の直後の処理ブロックをそれぞれ追加し、検出処理ブロックが真になる場合および偽になる場合の2つの処理経路を検出する。たとえば論理演算子が論理積である場合、偽処理ブロックと論理演算子の直後の処理ブロックとを次に実行すべき処理ブロックとして追加し、論理和である場合、真処理ブロックと論理演算子の直後の処理ブロックとを次に実行すべき処理ブロックとして追加する。各場合において、2つの処理経路を記憶させ、検出された論理演算子の直後の処理ブロックを検出処理ブロックとし、ステップd7からステップd5へ戻る。   If it is determined in step d5 that a logical operator is described, the process proceeds from step d5 to step d7. In step d7, two processing paths are detected when the detection processing block becomes true and false. Specifically, first, a true processing block, a false processing block, and a processing block immediately after the logical operator are detected. Next, based on the logical operator, a detected true processing block, a false processing block, and a processing block immediately after the logical operator are added as processing blocks to be executed next to the detection processing block. Two processing paths are detected when it becomes true and when it becomes false. For example, when the logical operator is a logical product, a false processing block and a processing block immediately after the logical operator are added as a processing block to be executed next. The next processing block is added as a processing block to be executed next. In each case, two processing paths are stored, the processing block immediately after the detected logical operator is set as a detection processing block, and the process returns from step d7 to step d5.

ステップd3で、多分岐処理文であると判定すると、ステップd8へ移行する。ステップd8では、多分岐処理文の分岐数の数の処理経路を検出する。具体的には、まず分岐先の処理ブロック(以下、「分岐先処理ブロック」と称する場合がある)をそれぞれ検出する。この分岐先処理ブロックは、分岐数と同数ある。次に検出処理ブロックの次に実行すべき処理ブロックとして、検出された各分岐先処理ブロックをそれぞれ追加し、検出処理ブロックの値によって分岐するすべての処理経路を検出する。これらすべての処理経路を記憶させ、複数の分岐先処理ブロックのうちいずれか1つの分岐先処理ブロックを検証処理ブロックに選出し、ステップd8からステップd3へ移行する。   If it is determined in step d3 that the statement is a multi-branch processing statement, the process proceeds to step d8. In step d8, processing paths corresponding to the number of branches in the multi-branch processing statement are detected. Specifically, first, a branch destination processing block (hereinafter sometimes referred to as a “branch destination processing block”) is detected. The number of branch destination processing blocks is the same as the number of branches. Next, each detected branch destination processing block is added as a processing block to be executed next to the detection processing block, and all processing paths branched according to the value of the detection processing block are detected. All these processing paths are stored, one of the plurality of branch destination processing blocks is selected as a verification processing block, and the process proceeds from step d8 to step d3.

ステップd4では、検出処理ブロックの直後にreturn文が検出されるか否かを判定する。return文が検出されない場合、次の処理ブロックの検出を開始する。次の処理ブロックは、検出処理ブロックに関数が含まれかつ前記関数がモジュール内で定義されている場合、前記関数の最初の処理ブロックである。それ以外の場合は、検証処理ブロックの直後の処理ブロックである。つまり、処理ブロックの検出は、モジュールの処理の順番に沿って行われる。ただしwhile文のようなループ文では、1度の検出されると、ループ処理が完全に終了したものとして、その次の処理ブロックを検出する。   In step d4, it is determined whether or not a return statement is detected immediately after the detection processing block. If no return statement is detected, detection of the next processing block is started. The next processing block is the first processing block of the function if the detection processing block contains a function and the function is defined in the module. In other cases, the processing block is immediately after the verification processing block. That is, the processing block is detected in the order of module processing. However, in a loop statement such as a “while” statement, when it is detected once, the next processing block is detected on the assumption that the loop processing has been completed.

次の処理ブロックが検出されると、この処理ブロックを検出処理ブロックの次に実行すべき処理ブロックとして、処理経路に記憶させる。この次の処理ブロックを検出処理ブロックに選出し、ステップd4からステップd3へ戻る。return文が検出される場合、ステップd4からステップd9へ移行する。ステップd9では、検出処理ブロックを実行すべき処理ブロックとして記憶させる処理経路について検索を終了し、この処理経路について、処理ブロックの実行順を確定する。前記処理経路が確定すると、ステップd9からステップd10へ移行する。   When the next processing block is detected, this processing block is stored in the processing path as a processing block to be executed next to the detected processing block. The next processing block is selected as a detection processing block, and the process returns from step d4 to step d3. When a return statement is detected, the process proceeds from step d4 to step d9. In step d9, the search is terminated for the processing path for storing the detection processing block as the processing block to be executed, and the execution order of the processing blocks is determined for this processing path. When the processing path is determined, the process proceeds from step d9 to step d10.

ステップd10では、すべての処理経路について処理ブロックの実行順が確定したか否かを判定する。具体的には、真処理ブロック、偽処理ブロックおよび複数の分岐先処理ブロックのうち検出処理ブロックに選出されていない処理ブロックを検出する。選出されていない処理ブロックを検出すると、処理ブロックの実行順が確定していない処理経路があると判定し、選出しされていない処理ブロック(複数の処理ブロックが選出しされていない場合、その複数の処理ブロックのうちいずれか1つの処理ブロック)を検出処理ブロックに選出し、ステップd10からステップd3へ戻る。選出しされていない処理ブロックが検出されない場合、すべての処理経路について処理ブロックの実行順が確定していると判定し、処理経路抽出処理が終了する。処理経路抽出処理が終了すると、ステップs4からステップs5へ移行する。   In step d10, it is determined whether or not the execution order of the processing blocks has been determined for all the processing paths. Specifically, a processing block that is not selected as a detection processing block among the true processing block, the false processing block, and the plurality of branch destination processing blocks is detected. When an unselected processing block is detected, it is determined that there is a processing path whose execution order of the processing blocks is not fixed, and an unselected processing block (if multiple processing blocks are not selected, Any one of the processing blocks) is selected as a detection processing block, and the process returns from step d10 to step d3. When a processing block that has not been selected is not detected, it is determined that the execution order of the processing blocks has been determined for all processing paths, and the processing path extraction process ends. When the processing path extraction process ends, the process proceeds from step s4 to step s5.

以下では、この処理経路抽出処理について、変更前および変更後ソースコードを用いて具体的に説明する。本実施の形態の変更前ソースコードでは、ステップd1において、処理ブロック抽出方法に基づいて、処理ブロックを抽出する。まず変更前ソースコードを区切る。具体的には、3行目の「int=c」の直前、12行目のif文の直前、12行目の論理演算子「&&」の直前、13行目の「c=5」の直前、15行目のreturn文直前に2つ、18行目のwhile文の直前、19行目のif文の直前、20行目のbreak文の直前に2つ、22行目の「b「cnt」=cnt*10」の直前、26行目のswitch文の直前、27行目のcase文の直前、29行目のcase文の直前、31行目のbreak文の直前および34行目のreturn文の直前の計16個の区切りを入れる。   Hereinafter, the processing path extraction processing will be specifically described using source code before and after the change. In the pre-change source code of the present embodiment, processing blocks are extracted based on the processing block extraction method in step d1. First, the source code before change is separated. Specifically, immediately before “int = c” on the third line, immediately before the if statement on the 12th line, immediately before the logical operator “&&” on the 12th line, immediately before “c = 5” on the 13th line. , 2 immediately before the return statement on the 15th line, 2 immediately before the while statement on the 18th line, 2 immediately before the if statement on the 19th line, 2 immediately before the break statement on the 20th line, and “b“ cnt ”on the 22nd line. "= Cnt * 10", immediately before the switch statement on the 26th line, immediately before the case statement on the 27th line, immediately before the case statement on the 29th line, immediately before the break statement on the 31st line, and return on the 34th line. Insert a total of 16 breaks immediately before the sentence.

次にこれら区切りに基づいて、この区切りで区切られた区間の型宣言文などを各処理ブロックとして抽出する。具体的には、3行目から10行目の型宣言文および代入式を処理ブロックA1、12行目の「a>=100」を処理ブロックB1、12行目の「a<200」を処理ブロックC1、13行目の「c=5」を処理ブロックD1、15行目のreturn文直前の空文を処理ブロックE1、18行目の「cnt<10」を処理ブロックF1、19行目の「cnt>=c」を処理ブロックG1、20行目のbreak文の直前の空文を処理ブロックH1、22行目から23行目の2つの代入式を処理ブロックI1、26行目の「sub(a)」を処理ブロックJ1、28行目の「d=30000」を処理ブロックK1、30行目の「d=d+10000」を処理ブロックL1、34行目のreturn文直前の空文を処理ブロックM1として抽出する。これら抽出される処理ブロックを用いて記述した変更前ソースコードを表7に示す。このようにして各処理ブロックを抽出すると、ステップd1からステップd2へ移行する。   Next, based on these delimiters, the type declaration sentence of the section delimited by the delimiters is extracted as each processing block. Specifically, the type declaration statements and assignment expressions on the 3rd to 10th lines are processed in the processing block A1, the 12th line "a> = 100" is processed in the processing block B1, and the 12th line "a <200" is processed. Block C1, 13th line “c = 5” is processed block D1, 15th line empty statement immediately before the return statement is processed block E1, 18th line “cnt <10” is processed block F1, 19th line “Cnt> = c” is the processing block G1, the empty sentence immediately before the break statement in the 20th line is the processing block H1, the two substitution expressions from the 22nd line to the 23rd line are the two substitution expressions in the processing block I1, 26th line “sub” (A) "is the processing block J1," d = 30000 "on the 28th line is the processing block K1," d = d + 10000 "on the 30th line is the processing block L1, and the empty sentence immediately before the return statement on the 34th line is a processing block Extract as M1 . Table 7 shows the source code before change described using the extracted processing blocks. When each processing block is extracted in this way, the process proceeds from step d1 to step d2.

Figure 2007041804
Figure 2007041804

ステップd2では、最初に検出される処理ブロックA1を、処理経路において最初に実行すべき処理ブロックとして記憶させる。処理ブロックA1を記憶させると、ステップd2からステップd3へ移行する。ステップd3では、処理ブロックA1の直前の文がないので、無分岐処理文と判定される。これによってステップd3からステップd4へ移行する。ステップd4では、処理ブロックの直後にreturn文が記述されていないので、次の処理ブロックの検出を開始する。次の処理ブロックとして処理ブロックB1が検出されると、処理ブロックA1の次に実行すべき処理ブロックとして、処理経路に追加し記憶させる。これによって処理経路A1−B1が検出される。この処理ブロックB1を検出処理ブロックに選出し、ステップd4からステップd3へ戻る。   In step d2, the processing block A1 detected first is stored as the processing block to be executed first in the processing path. When the processing block A1 is stored, the process proceeds from step d2 to step d3. In step d3, since there is no statement immediately before the processing block A1, it is determined as a non-branch processing statement. As a result, the process proceeds from step d3 to step d4. In step d4, since no return statement is described immediately after the processing block, detection of the next processing block is started. When the processing block B1 is detected as the next processing block, it is added to the processing path and stored as a processing block to be executed next to the processing block A1. As a result, the processing path A1-B1 is detected. This processing block B1 is selected as a detection processing block, and the process returns from step d4 to step d3.

ステップd3では、処理ブロックB1の直前がif文であるので、処理ブロックB1の直前の文が2分岐処理文と判定される。これによってステップd3からステップd5へ移行する。ステップd5では、処理ブロックB1の直後に論理演算子が記述されていると判定する。これによってステップd5からステップd7へ移行する。ステップd7では、処理ブロックB1の論理演算子の直後の処理ブロックである処理ブロックC1と偽処理ブロックである処理ブロックE1とを検出する。各処理ブロックC1,E1を処理経路A1−B1にそれぞれ追加し、処理経路A1−B1−C1およびA1−B1−E1を検出する。処理ブロックC1を検出処理ブロックに選出し、ステップd7からステップd5へ戻る。   In step d3, the statement immediately before the processing block B1 is determined to be a two-branch processing statement because the statement immediately before the processing block B1 is an if statement. As a result, the process proceeds from step d3 to step d5. In step d5, it is determined that a logical operator is described immediately after the processing block B1. As a result, the process proceeds from step d5 to step d7. In step d7, a processing block C1 that is a processing block immediately after the logical operator of the processing block B1 and a processing block E1 that is a false processing block are detected. The processing blocks C1 and E1 are added to the processing path A1-B1, respectively, and the processing paths A1-B1-C1 and A1-B1-E1 are detected. The processing block C1 is selected as a detection processing block, and the process returns from step d7 to step d5.

ステップd5では、処理ブロックC1の直後に論理演算子が記述されていないと判定する。これによってステップd5からステップd6へ移行する。ステップd6では、真処理ブロックである処理ブロックD1および偽処理ブロックである処理ブロックE1を検出する。各処理ブロックD1,E1を処理経路A1−B1−C1にそれぞれ追加し、処理経路A1−B1−C1−D1およびA1−B1−C1−E1を検出する。処理ブロックD1およびE1のうち一方の処理ブロック、本実施の形態では処理ブロックD1を検出処理ブロックに選出し、ステップd7からステップd3へ戻る。   In step d5, it is determined that no logical operator is described immediately after the processing block C1. As a result, the process proceeds from step d5 to step d6. In step d6, a processing block D1 that is a true processing block and a processing block E1 that is a false processing block are detected. The processing blocks D1 and E1 are added to the processing paths A1-B1-C1, respectively, and the processing paths A1-B1-C1-D1 and A1-B1-C1-E1 are detected. One of the processing blocks D1 and E1, that is, the processing block D1 in this embodiment is selected as a detection processing block, and the process returns from step d7 to step d3.

ステップd3では、処理ブロックD1の直前の文が無分岐処理と判定される。これによってステップd3からステップd4へ移行する。ステップd4では、処理ブロックD1の直後にreturn文が記述されていないので、次の処理ブロックの検出を開始する。次の処理ブロックとして処理ブロックF1が検出されると、処理ブロックD1の次に実行すべき処理ブロックとして、処理ブロックF1を処理経路に追加し記憶させる。これによって処理経路A1−B1−C1−D1−F1が検出される。この処理ブロックF1を検出処理ブロックに選出し、ステップd4からステップd3へ戻る。   In step d3, it is determined that the sentence immediately before the processing block D1 is a non-branching process. As a result, the process proceeds from step d3 to step d4. In step d4, since no return statement is described immediately after the processing block D1, detection of the next processing block is started. When the processing block F1 is detected as the next processing block, the processing block F1 is added to the processing path and stored as a processing block to be executed next to the processing block D1. As a result, the processing path A1-B1-C1-D1-F1 is detected. The processing block F1 is selected as a detection processing block, and the process returns from step d4 to step d3.

処理ブロックF1も、その直前の文が無分岐処理であり直後にreturn文がないので、ステップd3からステップd4に移行し、次の処理ブロックとして処理ブロックG1が検出される。処理ブロックG1を処理ブロックF1の次に実行すべき処理ブロックとして、処理経路に記憶され、処理経路A1−B1−C1−D1−F1−G1が検出される。この処理ブロックG1を検出処理ブロックに選出し、ステップd4からステップd3へ戻る。   Also in the processing block F1, since the immediately preceding statement is a non-branching process and there is no return statement immediately after that, the process proceeds from step d3 to step d4, and the processing block G1 is detected as the next processing block. The processing block G1 is stored in the processing path as a processing block to be executed next to the processing block F1, and the processing path A1-B1-C1-D1-F1-G1 is detected. This processing block G1 is selected as a detection processing block, and the process returns from step d4 to step d3.

ステップd3では、処理ブロックG1の直前の文がif文であるので、2分岐処理文と判定される。これによってステップd3からステップd5へ移行する。ステップd5では、処理ブロックの直後に論理演算子が記述されていないと判定する。これによってステップd5からステップd6へ移行する。ステップd6では、真処理ブロックである処理ブロックH1および偽処理ブロックである処理ブロックI1を検出する。各処理ブロックH1,I1を処理経路A1−B1−C1−D1−F1−G1にそれぞれ追加し、処理経路A1−B1−C1−D1−F1−G1−H1およびA1−B1−C1−D1−F1−G1―I1を検出する。処理ブロックD1およびE1のうち一方の処理ブロック、本実施の形態では処理ブロックH1を検出処理ブロックに選出し、ステップd7からステップd3へ戻る。   In step d3, since the sentence immediately before the processing block G1 is an if sentence, it is determined as a two-branch processing sentence. As a result, the process proceeds from step d3 to step d5. In step d5, it is determined that no logical operator is described immediately after the processing block. As a result, the process proceeds from step d5 to step d6. In step d6, a processing block H1 that is a true processing block and a processing block I1 that is a false processing block are detected. The processing blocks H1 and I1 are added to the processing paths A1-B1-C1-D1-F1-G1, respectively, and the processing paths A1-B1-C1-D1-F1-G1-H1 and A1-B1-C1-D1-F1 are added. -G1-I1 is detected. One of the processing blocks D1 and E1, that is, the processing block H1 in this embodiment is selected as a detection processing block, and the process returns from step d7 to step d3.

処理ブロックH1においても、ステップd3からステップd4に移行し、次の処理ブロックとして処理ブロックJ1が検出される。処理ブロックH1の次に実行すべき処理ブロックとして、処理ブロックJ1を処理経路に記憶し、処理経路A1−B1−C1−D1−F1−G1−H1−J1が検出される。この処理ブロックJ1を検出処理ブロックに選出し、ステップd4からステップd3へ戻る。   Also in the processing block H1, the process proceeds from step d3 to step d4, and the processing block J1 is detected as the next processing block. The processing block J1 is stored in the processing path as a processing block to be executed next to the processing block H1, and the processing path A1-B1-C1-D1-F1-G1-H1-J1 is detected. This processing block J1 is selected as a detection processing block, and the process returns from step d4 to step d3.

ステップd3では、処理ブロックJ1の直前の文がswitch文であるので、多分岐処理文と判定される。これによってステップd3からステップd8へ移行する。ステップd8では、2つの分岐先処理ブロックである処理ブロックK1および処理ブロックL1を検出する。各処理ブロックK1,L1を処理経路A1−B1−C1−D1−F1−G1−H1−J1にそれぞれ追加し、処理経路A1−B1−C1−D1−F1−G1−H1−J1−K1およびA1−B1−C1−D1−F1−G1―I1−L1を検出する。処理ブロックK1およびL1のうち一方の処理ブロック、本実施の形態では処理ブロックK1を検出処理ブロックに選出し、ステップd8からステップd3へ戻る。   In step d3, since the statement immediately before the processing block J1 is a switch statement, it is determined as a multi-branch processing statement. As a result, the process proceeds from step d3 to step d8. In step d8, the processing block K1 and the processing block L1, which are two branch destination processing blocks, are detected. The processing blocks K1 and L1 are added to the processing paths A1-B1-C1-D1-F1-G1-H1-J1, respectively, and the processing paths A1-B1-C1-D1-F1-G1-H1-J1-K1 and A1 are added. -B1-C1-D1-F1-G1-I1-L1 is detected. One of the processing blocks K1 and L1, in this embodiment, the processing block K1 is selected as a detection processing block, and the process returns from step d8 to step d3.

処理ブロックK1も、ステップd3からステップd4に移行し、次の処理ブロックとして処理ブロックL1が検出される。処理ブロックL1を処理ブロックK1の次に実行すべき処理ブロックとして、処理経路に記憶され、処理経路A1−B1−C1−D1−F1−G1−H1−J1−K1−L1が検出される。この処理ブロックL1を検出処理ブロックに選出し、ステップd4からステップd3へ戻る。   The processing block K1 also moves from step d3 to step d4, and the processing block L1 is detected as the next processing block. The processing block L1 is stored in the processing path as a processing block to be executed next to the processing block K1, and the processing path A1-B1-C1-D1-F1-G1-H1-J1-K1-L1 is detected. This processing block L1 is selected as a detection processing block, and the process returns from step d4 to step d3.

処理ブロックL1も、ステップd3からステップd4に移行し、次の処理ブロックとして処理ブロックM1が検出される。処理ブロックM1を処理ブロックL1の次に実行すべき処理ブロックとして記憶され、処理経路A1−B1−C1−D1−F1−G1−H1−J1−K1−L1−M1が検出される。この処理ブロックM1を検出処理ブロックに選出し、ステップd4からステップd3へ戻る。   The processing block L1 also moves from step d3 to step d4, and the processing block M1 is detected as the next processing block. The processing block M1 is stored as a processing block to be executed next to the processing block L1, and the processing path A1-B1-C1-D1-F1-G1-H1-J1-K1-L1-M1 is detected. This processing block M1 is selected as a detection processing block, and the process returns from step d4 to step d3.

処理ブロックM1も、ステップd3からステップd4に移行する。処理ブロックM1の直後の文がreturn文であるので、ステップd4からステップd9へ移行する。ステップd9では、この処理経路A1−B1−C1−D1−F1−G1−H1−J1−K1−L1−M1の検索を終了し、処理経路の処理ブロックの実行順を確定する。確定すると、ステップd9からステップd10へ移行する。ステップd10では、確定していない処理経路があるので、選出されていない処理ブロックのうちいずれか1つを選出し、たとえば処理経路A1−B1の処理ブロックB1を検出処理ブロックとして選出する。選出すると、ステップd3へ移行する。   The processing block M1 also moves from step d3 to step d4. Since the statement immediately after the processing block M1 is a return statement, the process proceeds from step d4 to step d9. In step d9, the search for the processing path A1-B1-C1-D1-F1-G1-H1-J1-K1-L1-M1 is terminated, and the execution order of the processing blocks in the processing path is determined. When confirmed, the process proceeds from step d9 to step d10. In step d10, since there is an undefined processing path, one of the unselected processing blocks is selected, for example, the processing block B1 of the processing path A1-B1 is selected as a detection processing block. If selected, the process proceeds to step d3.

同様にして、すべての処理経路が確定するまで、処理経路の検出を実行する。処理経路の検出を実行した結果、検出された処理経路を表8に示す。ステップd10ではすべての処理経路が確定すると、処理経路抽出処理が終了し、ステップs5からステップs6へ移行する。以下では、表8に示す各処理経路について、説明の便宜上、上から順に第1変更前処理経路、第2変更前処理経路というように、序数および「変更前」の文字を付して称する場合がある。表8は、1列目が、処理経路の名称、2列目が、処理経路に含まれる処理ブロックおよびその処理ブロックの処理順を示す。   Similarly, processing path detection is executed until all processing paths are determined. Table 8 shows the processing paths detected as a result of the processing path detection. When all the processing paths are determined in step d10, the processing path extraction process ends, and the process proceeds from step s5 to step s6. In the following, for the convenience of explanation, each processing path shown in Table 8 is referred to with an ordinal number and “before change” characters, such as a first pre-change processing path and a second pre-change processing path, from the top. There is. In Table 8, the first column indicates the name of the processing path, and the second column indicates the processing blocks included in the processing path and the processing order of the processing blocks.

Figure 2007041804
Figure 2007041804

変更前ソースコードの場合と同様に変更後ソースコードに対して処理経路抽出処理を実行すると、14の処理ブロックA2,B2,C2.D2,E2,F2,G2,H2,I2,J2,K2,L2,M2,N2が抽出される。具体的には、3行目の「int d」を処理ブロックA2、6行目の「a<=100」を処理ブロックB2、6行目の「a>200」を処理ブロックC1、7行目のreturn文直前の空文を処理ブロックD2、10行目の代入式および12行目の関数呼び出しを処理ブロックE2、25行目の型宣言文および27行目の代入式を処理ブロックF2、28行目の「cnt<c」を処理ブロックG2、29行目の「cnt>=c」を処理ブロックH2、30行目のbreak文の直前の空文を処理ブロックI2、32行目から33行目の2つの代入式を処理ブロックJ2、14行目の「sub(a−1)==1」を処理ブロックK2、15行目の「d=30000」を処理ブロックL2、17行目の「d=d+10000」を処理ブロックM2、20行目のreturn文直前の空文を処理ブロックN2として抽出する。これら抽出される処理ブロックを用いて記述した変更後ソースコードを表9に示す。各処理ブロックを抽出すると、ステップd1からステップd2へ移行する。   When the processing path extraction process is executed on the post-change source code as in the case of the pre-change source code, 14 processing blocks A2, B2, C2,. D2, E2, F2, G2, H2, I2, J2, K2, L2, M2, and N2 are extracted. Specifically, “int d” in the third line is the processing block A2, “a <= 100” in the sixth line is processing block B2, “a> 200” in the sixth line is processing block C1, and the seventh line. The empty statement immediately before the return statement is processed in block D2, the assignment expression on line 10, the function call on line 12, processing block E2, the type declaration statement on line 25, and the assignment expression on line 27 are processed in blocks F2, 28. “Cnt <c” in the row is the processing block G2, “cnt> = c” in the 29th row is the processing block H2, the empty sentence immediately before the break statement in the 30th row is the processing block I2, and the 32nd to 33rd rows. The second assignment expression of the second is the processing block J2, “sub (a−1) == 1” of the 14th row is the processing block K2, “d = 30000” of the 15th row is the processing block L2, “ d = d + 10000 ”as processing block M Extracts empty statements 20 line return Bunchokuzen as processing blocks N2. Table 9 shows the modified source code described using these extracted processing blocks. When each processing block is extracted, the process proceeds from step d1 to step d2.

Figure 2007041804
Figure 2007041804

変更前ソースコードと同様に、ステップd2〜ステップd10に基づいて、処理経路を検出すると、表10に示される処理経路が検出される。すべての処理経路が確定すると、処理経路抽出処理が終了し、ステップs4からステップs5へ移行する。このようにして変更前および変更後ソースコードのすべての処理経路を検出する。以下では、表10に示す各処理経路について、説明の便宜上、上から順に第1変更後処理経路、第2変更後処理経路というように、序数および「変更後」の文字を付して称する場合がある。表10は、1列目が、処理経路の名称、2列目が、処理経路に含まれる処理ブロックおよびその処理ブロックの処理順を示す。   Similar to the source code before change, when the processing path is detected based on steps d2 to d10, the processing path shown in Table 10 is detected. When all the processing paths are determined, the processing path extraction process ends, and the process proceeds from step s4 to step s5. In this way, all processing paths of the source code before and after the change are detected. In the following, for the convenience of explanation, each processing path shown in Table 10 is referred to with an ordinal number and a “post-change” character, such as a first post-change processing path and a second post-change processing path in order from the top. There is. In Table 10, the first column indicates the name of the processing path, and the second column indicates the processing blocks included in the processing path and the processing order of the processing blocks.

Figure 2007041804
Figure 2007041804

図8は、入力変数検索処理の手順を示すフローチャートである。図9は、分岐条件式の展開方法の手順を示すフローチャートである。ステップs5である入力変数検索処理工程では、入力変数検索処理を開始し、ソースコード、分岐条件式および各処理経路に基づいて、各検証対象モジュールの入力変数、および変数入力値を演算するために必要な条件を検索する。入力変数検索処理において、動作主体は、入力変数検索部11である。以下、入力変数検索処理において入力変数検索部11が制御主体の場合、その記載を省略する場合がある。   FIG. 8 is a flowchart showing the procedure of the input variable search process. FIG. 9 is a flowchart showing the procedure of the branch condition expression expansion method. In the input variable search process step that is step s5, the input variable search process is started to calculate the input variable and variable input value of each verification target module based on the source code, the branch condition expression, and each processing path. Search for the necessary conditions. In the input variable search process, the operation subject is the input variable search unit 11. Hereinafter, when the input variable search unit 11 is a control subject in the input variable search process, the description may be omitted.

以下では、入力変数検索処理について具体的に説明する。処理経路抽出処理工程s4から入力変数検索処理工程s5に移行すると、入力変数検索処理を開始し、ステップe1へ移行する。ステップe1では、複数の分岐条件式のうちいずれか1つの分岐条件式を選出する。分岐条件式を選出すると、ステップe1からステップe2へ移行する。ステップe2では、複数の処理経路のうちいずれか1つの処理経路を選出する。処理経路が選出されると、ステップe2からステップe3移行する。ステップe3では、選出された処理経路のいずれかの処理ブロックに、選出された分岐条件式が含まれているか否かを判定する。選出された分岐条件式が含まれていると判定すると、ステップe3からステップe4へ移行する。   Hereinafter, the input variable search process will be specifically described. When the process path extraction process step s4 is shifted to the input variable search process step s5, the input variable search process is started, and the process shifts to step e1. In step e1, one of the plurality of branch conditional expressions is selected. When a branching conditional expression is selected, the process proceeds from step e1 to step e2. In step e2, one of the plurality of processing paths is selected. When the processing path is selected, the process proceeds from step e2 to step e3. In step e3, it is determined whether or not the selected branch conditional expression is included in any processing block of the selected processing path. If it is determined that the selected branching conditional expression is included, the process proceeds from step e3 to step e4.

ステップe4では、選出された分岐条件式より前に実行すべき命令文に、分岐条件式に含まれる変数に対する値の代入があるか否か、前記変数の参照が取られているかを検出する。換言すると、選出された分岐条件式より前に実行すべき命令文に、選出された分岐条件式に含まれる変数に関する代入式および関数などの変換式が含まれるか否かを検出する。尚、複数の変換式が検出される場合は最後に実行される変換式が検出される。変換式を検出すると、ステップe4からステップe5へ移行する。   In step e4, it is detected whether or not the instruction statement to be executed before the selected branch conditional expression has a value assigned to the variable included in the branch conditional expression and whether the variable is referenced. In other words, it is detected whether a command statement to be executed before the selected branch condition expression includes a conversion expression such as an assignment expression and a function relating to the variable included in the selected branch condition expression. When a plurality of conversion expressions are detected, the conversion expression executed last is detected. When the conversion formula is detected, the process proceeds from step e4 to step e5.

ステップe5では、検出された変換式が3つの特定条件のうち少なくともいずれか1つの特定条件を具備するか否かを判定する。3つの特定条件の1つである第1特定条件S1は、検出された変換式に外部関数を含み、その外部関数の引数において、分岐条件式に含まれる変数が参照渡しされていることである。表11に示すソースコードに基づいて、具体的に説明する。「a==1」が分岐条件式に選出されると、「sub(&a)」が変換式として検出される。選出された分岐条件式の変数aが変換式の外部関数の引数で参照渡しされているので、この変換式は、第1特定条件S1を具備している。   In step e5, it is determined whether or not the detected conversion formula has at least one of the three specific conditions. The first specific condition S1, which is one of the three specific conditions, is that the detected conversion expression includes an external function, and the variable included in the branch condition expression is passed by reference in the argument of the external function. . A specific description will be given based on the source code shown in Table 11. When “a == 1” is selected as the branch condition expression, “sub (& a)” is detected as a conversion expression. Since the selected variable a of the branch condition expression is passed by reference as an argument of the external function of the conversion expression, this conversion expression has the first specific condition S1.

Figure 2007041804
Figure 2007041804

3つの特定条件の1つである第2特定条件S2は、検出された変換式がループ文のブロックに含まれていることである。表12に示すソースコードに基づいて、具体的に説明する。「a==1」が分岐条件式に選出されると、「a=b」が変換式として検出される。検出された変換式がfor文のブロックに含まれているので、この変換式は、第2特定条件S2を具備している。   The second specific condition S2, which is one of the three specific conditions, is that the detected conversion expression is included in the block of the loop sentence. A specific description will be given based on the source code shown in Table 12. When “a == 1” is selected as the branch condition expression, “a = b” is detected as the conversion expression. Since the detected conversion formula is included in the block of the for sentence, this conversion formula has the second specific condition S2.

Figure 2007041804
Figure 2007041804

3つの特定条件の1つである第3特定条件S3は、検出された変換式において、分岐条件式に含まれる変数が参照渡しされていることである。表13に示すソースコードに基づいて、具体的に説明する。「a==1」が分岐条件式に選出されると、「b=&a」が変換式として検出される。検出された変換式で分岐条件式の変数aが参照渡しされているので、この変換式は、第3特定条件S1を具備している。   The third specific condition S3, which is one of the three specific conditions, is that a variable included in the branch condition expression is passed by reference in the detected conversion expression. A specific description will be given based on the source code shown in Table 13. When “a == 1” is selected as the branch condition expression, “b = & a” is detected as the conversion expression. Since the variable a of the branch condition expression is passed by reference in the detected conversion expression, this conversion expression has the third specific condition S1.

Figure 2007041804
Figure 2007041804

これら特定条件を具備する変換式の変数は、その値が外部関数などの影響によって変わる可能性がある。このように特定条件として予め検出することによって、予め検証結果の確実性に影響を及ぼす要因を明確にすることができる。   There is a possibility that the value of the variable of the conversion formula having these specific conditions changes due to the influence of an external function or the like. By detecting in advance as the specific condition in this way, it is possible to clarify factors that affect the certainty of the verification result in advance.

これら3つの特定条件のうちいずれかを具備すると判定すると、ステップe5からステップe6へ移行する、ステップe6では、変換式を3つの特定条件のうちいずれの特定条件を具備するかを分類する。分類された特定条件は、変換式、この変換式が記述される行数などの位置および特定条件を具備する変数と関連づけて記憶される。特定条件を分類し記憶させると、ステップe7へ移行する。   If it is determined that any one of these three specific conditions is satisfied, the process proceeds from step e5 to step e6. In step e6, the conversion formula is classified into which specific condition among the three specific conditions is included. The classified specific conditions are stored in association with variables having the conversion formula, the position such as the number of lines in which the conversion formula is described, and the specific conditions. When the specific conditions are classified and stored, the process proceeds to step e7.

ステップe7では、検出された変換式が特定条件S2を具備する場合、検出された変換式に基づいて、後述するステップe8と同等に分岐条件式を展開する。検出された変換式が特定条件S1,S3を具備する場合、検出された変換式で参照が渡されている変数は、外部関数および当該変数と直接関連の無い処理によって、変数の値が変わる場合がある。特定条件S1,S3を具備する場合、この分岐条件式に関する入力変数検索処理において今後当該変数の展開を行わない分岐条件式、および通常通り当該変数の展開を行う分岐条件式を抽出し、記憶させる。たとえば、この後に、「a=c」という変換式が検出された場合、前者の分岐条件式は「a==1」の形のままで変化しないが、後者は展開して「c==1」と展開される。記憶された各分岐条件式は、互いに別個の分岐条件式として、以降の処理が行われる。このようにして変数を展開しない分岐条件式と、展開した分岐条件式を抽出し記憶させると、ステップe7からステップe9へ移行する。   In step e7, when the detected conversion expression includes the specific condition S2, a branching conditional expression is developed based on the detected conversion expression in the same manner as in step e8 described later. When the detected conversion formula has specific conditions S1 and S3, the value of the variable to which the reference is passed in the detected conversion formula changes due to the external function and processing not directly related to the variable There is. When the specific conditions S1 and S3 are provided, the branch condition expression that will not be expanded in the future in the input variable search process related to this branch condition expression and the branch condition expression that will be expanded as usual are extracted and stored. . For example, when a conversion expression “a = c” is detected after this, the former branching conditional expression remains in the form of “a == 1” and does not change, but the latter is expanded and “c == 1”. Is expanded. The stored branch condition expressions are processed as subsequent branch condition expressions. When the branch conditional expression that does not expand the variable and the expanded branch conditional expression are extracted and stored in this way, the process proceeds from step e7 to step e9.

ステップe5で、3つの特定条件を具備しないと判定すると、ステップe8へ移行する。尚、検出されている変換式は、分岐条件式に含まれる変数に対する値の代入となっているものと、分岐条件式に含まれる変数の参照が取られている場合がある。後者は前記特定条件S1,S3を満たし、ステップe5からステップe6へ移行している。したがってステップe8に移行する場合、検出された変換式は、必ず分岐条件式に含まれる変数に対する値の代入となっている。ステップe8では、分岐条件式が特定の変数について今後展開を行わないものとして記憶されており、且つ検出された変換式が当該変数に対する代入である場合は、何も行わない。展開を行わないものとして記憶されていない場合は、検出された変換式に基づいて、分岐条件式を展開する。展開された分岐条件式は、記憶される。分岐条件式が展開され記憶されると、ステップe8からステップe9へ移行する。   If it is determined in step e5 that the three specific conditions are not satisfied, the process proceeds to step e8. Note that the detected conversion formula may be a substitution of a value for a variable included in the branch condition formula or a reference to a variable included in the branch condition formula. The latter satisfies the specific conditions S1 and S3, and shifts from step e5 to step e6. Therefore, when the process proceeds to step e8, the detected conversion expression is always a value substitution for the variable included in the branch condition expression. In step e8, if the branch conditional expression is stored as not to be expanded in the future for a specific variable, and if the detected conversion expression is an assignment to the variable, nothing is performed. If it is not stored as not expanded, the branch condition expression is expanded based on the detected conversion expression. The expanded branch conditional expression is stored. When the branching conditional expression is expanded and stored, the process proceeds from step e8 to step e9.

ステップe9では、さらに検出された変換式より前に実行すべき命令文に、展開された分岐条件式に含まれる変数に対する値などの代入があるか否かを検出する。換言すると、検出された変換式より前に実行すべき命令文に、展開された分岐条件式に含まれる変数に関する代入式および関数などの変換式が含まれるか否かを検出する。変換式が検出されると、この変換式を検出された変換式とし、ステップe9からステップe5へ戻る。   In step e9, it is detected whether or not there is an assignment of a value or the like to a variable included in the expanded branch condition expression in a command statement to be executed before the detected conversion expression. In other words, it is detected whether or not a conversion expression such as an assignment expression and a function related to a variable included in the expanded branch condition expression is included in an instruction statement to be executed before the detected conversion expression. When the conversion formula is detected, the conversion formula is set as the detected conversion formula, and the process returns from step e9 to step e5.

ステップe5に戻りステップe7またはステップe8に進むと、ステップe7またはステップe8では、ステップe9で検出された変換式に基づいて、記憶された展開された分岐条件式を展開し、さらに展開された分岐条件式を記憶させる。このように展開された分岐条件式をさらに展開し記憶させると、ステップe8からステップe9へ移行し、同様のステップe9で同様の処理を行う。ステップe9で、変換式が検出されないと判定すると、変換式の検出を終了し、ステップe9からステップe10へ移行する。   Returning to step e5 and proceeding to step e7 or step e8, in step e7 or step e8, based on the conversion expression detected in step e9, the stored expanded branch conditional expression is expanded, and further expanded branch Stores conditional expressions. When the branching conditional expression thus expanded is further expanded and stored, the process proceeds from step e8 to step e9, and the same processing is performed in the same step e9. If it is determined in step e9 that the conversion formula is not detected, detection of the conversion formula is terminated, and the process proceeds from step e9 to step e10.

表14に示すソースコードに基づいて、分岐条件式の展開処理について、図9を参照しつつ説明する。説明の便宜上、「b==1」が分岐条件式に選出されているものとし、ステップe4から説明する。   Based on the source code shown in Table 14, branch condition expression expansion processing will be described with reference to FIG. For convenience of explanation, it is assumed that “b == 1” is selected as the branching conditional expression, and the description starts from step e4.

Figure 2007041804
Figure 2007041804

ステップe4では、選出される分岐条件式に変数bを含むので、変換式として「b=a+1」を検出する。これによってステップe4からステップe5へ移行する。ステップe5では、変換式「b=a+1」が3つの特定条件をいずれも具備しないと判定する。これによってステップe5からステップe8へ移行する。ステップe8では、変換式「b=a+1」に基づいて、分岐条件式「b=1」を展開して展開された分岐条件式「a+1=1」を抽出し、記憶させる。これによってステップe8からステップe9へ移行する。ステップe9では、変換式「b=a+1」の前に実行される処理を記述する文であり、展開された分岐条件式の変数aを含むので、変換式として「a=sub(3,x,y)」を検出する。これによってステップe9からステップe5へ移行する。   In step e4, since the variable b is included in the selected branch conditional expression, “b = a + 1” is detected as the conversion expression. As a result, the process proceeds from step e4 to step e5. In step e5, it is determined that the conversion formula “b = a + 1” does not have any of the three specific conditions. As a result, the process proceeds from step e5 to step e8. In step e8, based on the conversion formula “b = a + 1”, the branch conditional expression “b = 1” is expanded and the expanded branch conditional expression “a + 1 = 1” is extracted and stored. As a result, the process proceeds from step e8 to step e9. In step e9, a statement describing the processing to be executed before the conversion expression “b = a + 1”, which includes the variable a of the expanded branch condition expression, the conversion expression “a = sub (3, x, y) "is detected. As a result, the process proceeds from step e9 to step e5.

ステップe5では、変換式「a=sub(3,x,y)」が3つの特定条件をいずれも具備しないと判定する。これによってステップe5からステップe8へ移行する。ステップe8では、変換式「a=sub(3,x,y)」に基づいて、分岐条件式「a+1=1」を展開して展開された分岐条件式「sub(3,x,y)+1=1」を抽出し、記憶させる。本検証において、外部関数は、それがとり得る値が必要となり、どのような変数が引数として用いられるか必要でない。したがって展開された分岐条件式を「sub()+1=1」として、引数を記憶しなくてもよい。以下では、外部関数について引数を記載しない場合がある。これによってステップe8からステップe9へ移行する。ステップe9では、変換式「sub()+1=1」より前に実行される処理を記述する文に、変数sub()を含む代入式または関数が検出できない。これによってステップe9からステップe10へ移行する。   In step e5, it is determined that the conversion formula “a = sub (3, x, y)” does not have any of the three specific conditions. As a result, the process proceeds from step e5 to step e8. In step e8, based on the conversion expression “a = sub (3, x, y)”, the branch conditional expression “a + 1 = 1” is expanded and the branch conditional expression “sub (3, x, y) +1” is expanded. = 1 ”is extracted and stored. In this verification, the external function needs a value that it can take, and does not need to know what variable is used as an argument. Therefore, the expanded branch conditional expression is “sub () + 1 = 1”, and the argument does not have to be stored. In the following, arguments may not be described for external functions. As a result, the process proceeds from step e8 to step e9. In step e9, an assignment expression or function including the variable sub () cannot be detected in a statement describing a process executed before the conversion expression “sub () + 1 = 1”. As a result, the process proceeds from step e9 to step e10.

ステップe10では、変換式の検出の終了処理が、2つの検出終了条件のうちいずれの条件を具備して終了したか分類する。2つの検出終了条件のうち一方の条件である第1検出終了条件T1は、展開された分岐条件式に変数が無い場合である。2つの検出終了条件のうち他方の条件である第2検出終了条件T2は、変換式より前に実行すべき命令文が無い場合である。第1検証終了条件T1を具備して検出を終了したと分類されると、ステップe11へ移行する。   In step e10, it is classified as to which of the two detection end conditions the end of detection of the conversion formula has been completed. The first detection end condition T1, which is one of the two detection end conditions, is a case where there is no variable in the expanded branch conditional expression. The second detection end condition T2, which is the other of the two detection end conditions, is a case where there is no command statement to be executed before the conversion formula. If it is classified that the detection has been completed with the first verification end condition T1, the process proceeds to step e11.

ステップe11では、展開された分岐条件式に外部関数が含まれているか否かを判定する。外部関数が含まれていると判定すると、この展開された分岐条件式を展開済みの分岐条件式として記憶し、ステップe13へ移行する。外部関数が含まれていないと判定すると、何も処理せず、ステップe13へ移行する。   In step e11, it is determined whether or not the expanded branch conditional expression includes an external function. If it is determined that an external function is included, the expanded branch conditional expression is stored as an expanded branch conditional expression, and the process proceeds to step e13. If it is determined that the external function is not included, nothing is processed and the process proceeds to step e13.

ステップe10で、第2終了条件T2を具備して検出を終了したと分類されると、ステップe12へ移行する。ステップe12では、展開された分岐条件式においてローカル変数が含まれているか否か判定する。ローカル変数が含まれていると判定すると、ローカル変数検出情報として値が設定されていないローカル変数を検出したことを記憶させ、ローカル変数に0の値を代入する。前記値が設定されていないローカル変数は、実行時にその値が0に設定される。したがってローカル変数を0に設定することによって、実際の実行される場合と同様の出力値が演算されるからである。前記ローカル変数に0を代入して検出終了条件T1を具備する場合、ステップe11と同様の処理を行い、ステップe13へ移行する。0の値を代入しても検出終了条件T1を具備しない、またはローカル変数が含まれていないと判定すると、ローカル変数検出情報として値が設定されていないローカル変数がないことを記憶させ、変数を含む展開された分岐条件式を展開済み分岐条件式として記憶させる。展開済み分岐条件式を記憶させると、ステップe12からステップe13へ移行する。   If it is determined in step e10 that the second end condition T2 is satisfied and the detection is completed, the process proceeds to step e12. In step e12, it is determined whether or not a local variable is included in the expanded branch conditional expression. If it is determined that a local variable is included, the fact that a local variable having no value is detected is stored as local variable detection information, and a value of 0 is assigned to the local variable. The local variable for which the value is not set is set to 0 at the time of execution. Therefore, by setting the local variable to 0, an output value similar to that when actually executed is calculated. When 0 is substituted into the local variable and the detection end condition T1 is satisfied, the same processing as step e11 is performed, and the process proceeds to step e13. If it is determined that the detection end condition T1 is not satisfied even if a value of 0 is substituted, or that no local variable is included, the fact that there is no local variable that is not set as local variable detection information is stored, The expanded branch conditional expression that is included is stored as the expanded branch conditional expression. When the expanded branch conditional expression is stored, the process proceeds from step e12 to step e13.

ステップe13では、選出された分岐条件式において、すべての処理経路で処理が行われたか否かを判定する。すべての処理経路で処理が行われたと判定すると、ステップe13からステップe14へ移行する。ステップe14では、すべての分岐条件式が選出されたか否かを判定する。すべての分岐条件式が選出されたと判定すると、入力変数検索処理が終了し、ステップs5からステップs6へ移行する。   In step e13, it is determined whether or not processing has been performed on all processing paths in the selected branching conditional expression. If it is determined that the processing has been performed on all the processing paths, the process proceeds from step e13 to step e14. In step e14, it is determined whether all branch conditional expressions have been selected. If it is determined that all branching conditional expressions have been selected, the input variable search process ends, and the process proceeds from step s5 to step s6.

ステップe3で、選出された処理経路のいずれかの処理ブロックに、選出された分岐条件式が含まれていないと判定されると、ステップe3からステップe13へ移行する。ステップe4で、変換式が無いと判定されると、ステップe4からステップe10へ移行する。ステップe13で、少なくともいずれか1つの処理経路が未処理である判定されると、未処理の処理経路のうちいずれか1つの処理経路を選出し、ステップe4へ戻る。ステップe14で、少なくともいずれか1つの分岐条件式が未選出であると判定すると、未選出の分岐条件式のうちいずれか1つの分岐条件式を選出し、ステップe3へ戻る。   If it is determined in step e3 that the selected branch conditional expression is not included in any of the processing blocks of the selected processing path, the process proceeds from step e3 to step e13. If it is determined in step e4 that there is no conversion formula, the process proceeds from step e4 to step e10. If it is determined in step e13 that at least one of the processing paths is unprocessed, one of the unprocessed processing paths is selected, and the process returns to step e4. If it is determined in step e14 that at least one of the branch conditional expressions is not selected, one of the unselected branch conditional expressions is selected, and the process returns to step e3.

以下では、この入力変数検索処理について、変更前および変更後ソースコードを用いて具体的に説明する。本実施の形態の変更前ソースコードでは、ステップe1において、表5に示される5つの分岐条件式のうち、変更前ソースコードの12行目に記載される分岐条件式「a>=100」を選出する。これによってステップe1からステップe2へ移行する。ステップe2では、第1変更前処理経路を選出する。これによってステップe2からステップe3へ移行する。ステップe3では、選出された分岐条件式が処理ブロックB1に含まれるので、選出された分岐条件式が含まれると判定する。これによってステップe3からステップe4へ移行する。   Hereinafter, the input variable search process will be described in detail using pre-change and post-change source code. In the pre-change source code of the present embodiment, in step e1, among the five branch conditional expressions shown in Table 5, the branch conditional expression “a> = 100” described in the 12th line of the pre-change source code is changed. elect. This shifts from step e1 to step e2. In step e2, the first change pre-processing path is selected. As a result, the process proceeds from step e2 to step e3. In step e3, since the selected branch conditional expression is included in the processing block B1, it is determined that the selected branch conditional expression is included. As a result, the process proceeds from step e3 to step e4.

ステップe4では、変更前ソースコードの10行目に記載される「a=a−1」を変換式として検出する。変換式が検出されたので、ステップe4からステップe5へ移行する。ステップe5では、検出された変換式が3つの特定条件S1,S2,S3のいずれも具備しないので、ステップe8へ移行する。ステップe8では、検出された変換式に基づいて、選出された分岐条件式を展開し、展開された分岐条件式「a−1>=100」を抽出し、記憶させる。展開された分岐条件式を記憶させると、ステップe8からステップe9へ移行する。   In step e4, “a = a−1” described in the 10th line of the source code before change is detected as a conversion formula. Since the conversion formula is detected, the process proceeds from step e4 to step e5. In step e5, since the detected conversion formula does not have any of the three specific conditions S1, S2, and S3, the process proceeds to step e8. In step e8, the selected branch conditional expression is expanded based on the detected conversion expression, and the expanded branch conditional expression “a-1> = 100” is extracted and stored. When the expanded branch conditional expression is stored, the process proceeds from step e8 to step e9.

ステップe9では、変数aを含む変換式が検出できないと判定される。これによってステップe9からステップe10へ移行する。ステップe10では、変数aを含む変換式が検出できないとして検出が終了しているので、検出終了条件T2を具備すると判定する。これによってステップe10からステップe12へ移行する。ステップe12では、展開された分岐条件式にローカル変数が含まれていないので、この展開された分岐条件式「a−1>=100」を展開済みの分岐条件式として、記憶させる。これによってステップe12からステップe13へ移行する。   In step e9, it is determined that a conversion expression including the variable a cannot be detected. As a result, the process proceeds from step e9 to step e10. In step e10, the detection ends because it is impossible to detect the conversion expression including the variable a, and therefore it is determined that the detection end condition T2 is satisfied. As a result, the process proceeds from step e10 to step e12. In step e12, since no local variable is included in the expanded branch conditional expression, the expanded branch conditional expression “a-1> = 100” is stored as the expanded branch conditional expression. As a result, the process proceeds from step e12 to step e13.

ステップe13では、選出された分岐条件式において、第1変更前処理経路以外の処理経路が未処理であるので、未処理の処理経路のうちいずれか1つの処理経路、たとえば第2変更前処理経路を選出し、ステップe3へ戻る。第1変更前処理経路の場合と同様にして、第2変更前処理経路〜第8変更前処理経路について処理すると、ステップe13で、選出された分岐条件式において、すべての処理経路で処理が行われたと判定し、ステップe14へ移行する。   In step e13, in the selected branching conditional expression, the processing paths other than the first pre-change processing path are unprocessed, so any one of the unprocessed processing paths, for example, the second pre-change processing path. And returns to step e3. When processing is performed for the second pre-change processing route to the eighth pre-change processing route in the same manner as in the case of the first pre-change processing route, in step e13, processing is performed on all the processing routes in the selected branch conditional expression. It is determined that it has been broken, and the process proceeds to step e14.

ステップe14では、分岐条件式「a>=100」以外の分岐条件式が選出されていないので、未選出の分岐条件式のうちいずれか1つの分岐条件式、たとえば変更前ソースコードの12行目の分岐条件式「a<200」を選出し、ステップe2へ戻る。分岐条件式「a>=100」の場合と同様にして、すべての分岐条件式に基づいて、展開済みの分岐条件式を抽出し、記憶させると、ステップe14で、すべての分岐条件式について選出されたと判定し、変更前ソースコードについての入力変数検索処理が終了する。この入力変数検索処理によって、各処理経路で抽出し記憶された展開済みの分岐条件式を表15に示す。表15は、縦軸が処理経路を示し、横軸が分岐条件式を示す。また「−」は、展開済み分岐条件式が記憶されていないことを示す。   In step e14, since no branch conditional expression other than the branch conditional expression “a> = 100” is selected, any one of the unselected branch conditional expressions, for example, the 12th line of the source code before change is selected. Branch condition expression “a <200” is selected, and the process returns to step e2. In the same manner as in the case of the branch conditional expression “a> = 100”, the extracted branch conditional expressions are extracted and stored based on all the branch conditional expressions, and in step e14, all branch conditional expressions are selected. The input variable search process for the source code before change ends. Table 15 shows expanded branching conditional expressions extracted and stored in each processing path by this input variable search processing. In Table 15, the vertical axis indicates the processing path, and the horizontal axis indicates the branching conditional expression. “-” Indicates that the expanded branch conditional expression is not stored.

Figure 2007041804
Figure 2007041804

本実施の形態の変更後ソースコードでも、変更前ソースコードと同様にして、入力変数検索処理を行うと、表6に示される分岐条件式に基づいて、展開済みの分岐条件式が表10に示す各処理経路で抽出され記憶され、入力変数検索処理が終了する。各処理経路で抽出し記憶された展開済みの分岐条件式を表16に示す。表16は、縦軸が処理経路を示し、横軸が分岐条件式を示す。また表16の「−」は、展開済み分岐条件式が記憶されていないことを示す。変更前および変更後ソースコードの両方の入力変数検索処理が終了すると、ステップs5からステップs6へ移行する。   Even in the modified source code of the present embodiment, when the input variable search process is performed in the same manner as the unmodified source code, the expanded branch conditional expression is shown in Table 10 based on the branch conditional expression shown in Table 6. Each of the processing paths shown is extracted and stored, and the input variable search process ends. Table 16 shows expanded branch conditional expressions extracted and stored in each processing path. In Table 16, the vertical axis represents the processing path, and the horizontal axis represents the branching conditional expression. In addition, “-” in Table 16 indicates that the expanded branch conditional expression is not stored. When the input variable search process for both the pre-change source code and the post-change source code is completed, the process proceeds from step s5 to step s6.

Figure 2007041804
Figure 2007041804

図10は、入力値生成処理の手順を示すフローチャートである。図11は、入力値決定処理の手順を示すフローチャートである。ステップs6であるテスト入力値生成処理工程では、テスト入力値生成処理を開始し、テスト入力値生成部12によって、展開済み分岐条件式に基づいて、変数入力値を演算する。テスト入力値生成処理において、動作主体は、テスト入力値生成部12である。以下、テスト入力値生成処理においてテスト入力値生成部12が制御主体の場合、その記載を省略する場合がある。   FIG. 10 is a flowchart showing the procedure of the input value generation process. FIG. 11 is a flowchart showing the procedure of the input value determination process. In the test input value generation process step which is step s6, the test input value generation process is started, and the variable input value is calculated by the test input value generation unit 12 based on the expanded branch conditional expression. In the test input value generation processing, the operation subject is the test input value generation unit 12. Hereinafter, in the test input value generation process, when the test input value generation unit 12 is a control subject, the description may be omitted.

以下では、テスト入力値生成処理について具体的に説明する。入力変数検索処理工程s5からテスト入力値生成処理工程s6に移行すると、テスト入力値生成処理を開始し、ステップf1へ移行する。ステップf1では、各検証対象モジュールにおいて、記憶されている展開済みの分岐条件式のうち、同一内容の展開済みの分岐条件式を検出する。同一内容の展開済みの分岐条件式を検出すると、これらのうち1つの展開済みの分岐条件式を残して残りを削除する。削除すると、ステップf1からステップf2へ移行する。   Hereinafter, the test input value generation process will be specifically described. When the process proceeds from the input variable search process step s5 to the test input value generation process step s6, the test input value generation process is started, and the process proceeds to step f1. In step f1, in each verification target module, a developed branch conditional expression having the same content is detected among the stored developed branch conditional expressions. When an expanded branch conditional expression having the same contents is detected, one of the expanded branch conditional expressions is left and the rest is deleted. When deleted, the process proceeds from step f1 to step f2.

ステップf2である入力値決定処理工程では、入力値決定処理を開始し、入力値を決定する。以下では、入力決定処理について、図11のフローチャートを参照して、具体的に説明する。ステップf1からステップf2へ移行すると、入力値決定処理が開始し、ステップg1へ移行する。ステップg1では、入力変数を1つだけ含む展開済みの分岐条件式、すなわち1変数の展開済みの分岐条件式を検出する。検出すると、ステップg1からステップg2へ移行する。ステップg2では、1変数の展開済みの分岐条件式を定数分離し、入力変数に対する解を演算する。入力変数の解を演算すると、ステップg2からステップg3へ移行する。   In the input value determination processing step which is step f2, the input value determination processing is started and the input value is determined. Hereinafter, the input determination process will be specifically described with reference to the flowchart of FIG. When the process proceeds from step f1 to step f2, the input value determination process starts and the process proceeds to step g1. In step g1, a developed branch conditional expression including only one input variable, that is, a developed branch conditional expression of one variable is detected. If detected, the process proceeds from step g1 to step g2. In step g2, a branching conditional expression for one variable is subjected to constant separation, and a solution for the input variable is calculated. When the solution of the input variable is calculated, the process proceeds from step g2 to step g3.

ステップg3では、1変数の展開済みの分岐条件式の関係演算子に等号が含まれるか否かを判定する。換言すると、関係演算子が「<=」、「==」または「>=」であるか否かを判定する。関係演算子に等号が含まれると判定すると、ステップg3からステップg4へ移行する。   In step g3, it is determined whether or not an equal sign is included in the relational operator of the expanded branch conditional expression of one variable. In other words, it is determined whether the relational operator is “<=”, “==”, or “> =”. When it is determined that an equal sign is included in the relational operator, the process proceeds from step g3 to step g4.

ステップg4では、入力変数の解を、分岐条件式が真になる入力値である真入力値として検出する。真入力値を検出すると、ステップg4からステップg5へ移行する。ステップg5では、関係演算子が「<=」、「==」および「>=」のいずれであるかを判定する。関係演算子が「==」または「<=」であると判定すると、ステップg5からステップg6へ移行する。関係演算子が「>=」であると判定すると、ステップg5からステップg7へ移行する。   In step g4, the solution of the input variable is detected as a true input value that is an input value for which the branch condition expression is true. When a true input value is detected, the process proceeds from step g4 to step g5. In step g5, it is determined whether the relational operator is “<=”, “==”, or “> =”. If it is determined that the relational operator is “==” or “<=”, the process proceeds from step g5 to step g6. If it is determined that the relational operator is “> =”, the process proceeds from step g5 to step g7.

ステップg6では、入力変数の解に1を加算した値を、分岐条件式が偽になる入力値である偽入力値として検出する。この検出された真および偽入力値を記憶させる。真および偽入力値を記憶させると、ステップg6からステップg8へ移行する。ステップg7では、入力変数の解から1を減算した値を、偽入力値として検出する。この検出された真および偽入力値を記憶させる。真および偽入力値を記憶させると、ステップg7からステップg8へ移行する。   In step g6, a value obtained by adding 1 to the solution of the input variable is detected as a false input value that is an input value for which the branch condition expression is false. The detected true and false input values are stored. When the true and false input values are stored, the process proceeds from step g6 to step g8. In step g7, a value obtained by subtracting 1 from the solution of the input variable is detected as a false input value. The detected true and false input values are stored. When the true and false input values are stored, the process proceeds from step g7 to step g8.

ステップg3で、関係演算子に等号が含まれないと判定すると、ステップg3からステップg9へ移行する。ステップg9では、入力変数の解を偽入力値として検出する。偽入力値を検出すると、ステップg9からステップg10へ移行する。ステップg10では、関係演算子が「<」、「!=」および「>」のいずれであるかを判定する。関係演算子が「!=」または「>」であると判定すると、ステップg10からステップg11へ移行する。関係演算子が「<」であると判定すると、ステップg10からステップg12へ移行する。   If it is determined in step g3 that the relational operator does not include an equal sign, the process proceeds from step g3 to step g9. In step g9, the solution of the input variable is detected as a false input value. When a false input value is detected, the process proceeds from step g9 to step g10. In step g10, it is determined whether the relational operator is “<”, “! =”, Or “>”. If it is determined that the relational operator is “! =” Or “>”, the process proceeds from step g10 to step g11. If it is determined that the relational operator is “<”, the process proceeds from step g10 to step g12.

ステップg11では、入力変数の解に1を加算した値を、真入力値として検出する。この検出された真および偽入力値を記憶させる。真および偽入力値を記憶させると、ステップg11からステップg8へ移行する。ステップg12では、入力変数の解から1を減算した値を、真入力値として検出する。この検出された真および偽入力値を記憶させる。真および偽入力値を記憶させると、ステップg12からステップg8へ移行する。   In step g11, a value obtained by adding 1 to the solution of the input variable is detected as a true input value. The detected true and false input values are stored. When the true and false input values are stored, the process proceeds from step g11 to step g8. In step g12, a value obtained by subtracting 1 from the solution of the input variable is detected as a true input value. The detected true and false input values are stored. When the true and false input values are stored, the process proceeds from step g12 to step g8.

ステップg8では、すべての1変数の展開済みの分岐条件式について、真および偽入力値が決定したか否かを判定する。演算されていないと判定すると、真および偽入力値が演算されていない1変数の展開済み分岐条件式を検出し、ステップg8からステップg2へ戻る。決定していると判定すると、入力値決定処理が終了し、ステップf2からステップf3へ移行する。   In step g8, it is determined whether true and false input values have been determined for all expanded branch conditional expressions of one variable. If it is determined that it has not been calculated, the expanded branch conditional expression of one variable for which the true and false input values are not calculated is detected, and the process returns from step g8 to step g2. If it is determined that the input value has been determined, the input value determination process ends, and the process proceeds from step f2 to step f3.

ステップf3では、真および偽入力値が決定していない入力変数があるか否かを判定する。決定していない入力変数があると判定すると、ステップf3からステップf4へ移行する。   In step f3, it is determined whether or not there is an input variable whose true and false input values are not determined. If it is determined that there is an input variable that has not been determined, the process proceeds from step f3 to step f4.

ステップf4では、真および偽入力値が未決定の入力変数(以下、「未決定の入力変数」と称する場合がある)を含む展開済みの分岐条件式において、未決定の入力変数の個数を判定する。たとえば、3つの入力変数を含む展開済みの分岐条件式において、ステップf2で、2つの変数入力の真および偽入力値が決定している場合、未決定の入力変数は、1つであると判定する。またステップf2で、1つの変数入力の真および偽入力値が決定している場合、未決定の入力変数は、2つであると判定する。このようにして未決定の入力変数の個数を判定する。未決定の入力変数の個数が1つの展開済みの分岐条件式があると判定すると、ステップf5へ移行する。   In step f4, the number of undetermined input variables is determined in a developed branch conditional expression including input variables whose true and false input values are undetermined (hereinafter may be referred to as “undetermined input variables”). To do. For example, in the expanded branch conditional expression including three input variables, if the true and false input values of two variable inputs are determined in step f2, it is determined that there is one undecided input variable. To do. If the true and false input values of one variable input are determined in step f2, it is determined that there are two undecided input variables. In this way, the number of undetermined input variables is determined. If it is determined that there is an expanded branch conditional expression in which the number of undetermined input variables is one, the process proceeds to step f5.

ステップf5では、未決定の入力変数の入力値を決定する。具体的には、まず未決定の入力変数を変数とし、真および偽入力値が検出している入力変数を定数とみなして、展開済みの分岐条件式を定数分離する。次に真および偽入力値が検出している入力変数に、真および偽入力値をそれぞれ代入する。代入すると、代入によって未決定の入力変数だけの1変数の展開済みの分岐条件式になり、ステップf5からステップf2へ戻る。ステップf2に戻ると、未定数の入力変数の解を演算し、未決定の入力変数の真入力値および偽入力値を検出する。   In step f5, an input value of an undetermined input variable is determined. Specifically, first, an undecided input variable is used as a variable, an input variable detected by true and false input values is regarded as a constant, and a developed branch conditional expression is separated into constants. Next, the true and false input values are assigned to the input variables detected by the true and false input values, respectively. Substitution results in a one-variable expanded branch conditional expression of only undecided input variables, and returns from step f5 to step f2. Returning to step f2, the solution of the undetermined input variable is calculated, and the true input value and false input value of the undetermined input variable are detected.

以下では、ステップf4からステップf5へ移行し、ステップf2へ戻る一連の流れについて、展開済みの分岐条件式が「a+b+c=0」であり、入力変数a,bの入力値の組合わせが(a,b)=(0,2),(0,3)、入力変数cが未決定の入力変数である場合を例に挙げて説明する。まず、ステップf4で、未決定の入力変数の個数が1として、ステップf5へ移行する。ステップf5では、入力変数cについて定数分離し、式「c=−a−b」を演算する。次に、入力変数a,bを組合わせ毎に代入し、2つの式「c=−2」および「c=−3」を得る。代入すると、入力変数cのステップf5からステップf2へ移行し、入力変数cの真入力値および偽入力値を検出する。検出された真および偽入力値および入力変数a,bとの組合わせは、変数cが真になる場合、(a,b,c)=(0,2,−2),(0,3,−3)であり、偽になる組合わせは、(a,b,c)=(0,2,−1),(0,3,−2)である。このようにして演算された真および偽入力値を、入力変数cの真および偽入力値に決定する。   In the following, for a series of flows from step f4 to step f5 and returning to step f2, the expanded branch conditional expression is “a + b + c = 0”, and the combination of input values of the input variables a and b is (a , B) = (0, 2), (0, 3), and the case where the input variable c is an undetermined input variable will be described as an example. First, in step f4, the number of undetermined input variables is set to 1, and the process proceeds to step f5. In step f5, constant separation is performed for the input variable c, and the expression “c = −a−b” is calculated. Next, the input variables a and b are substituted for each combination to obtain two expressions “c = −2” and “c = −3”. When substituted, the process proceeds from step f5 to step f2 of the input variable c, and the true input value and false input value of the input variable c are detected. The combination of the detected true and false input values and the input variables a and b is (a, b, c) = (0, 2, -2), (0, 3, 2) when the variable c becomes true. -3), and the combinations that are false are (a, b, c) = (0, 2, −1), (0, 3, −2). The true and false input values calculated in this way are determined as the true and false input values of the input variable c.

ステップf4で、未決定の入力変数が1つの展開済みの分岐条件式がない場合、ステップf6へ移行する。ステップf6では、複数の未決定の入力変数のうちいずれか1つの入力変数を選出し、この入力変数の入力値を1に決定する。その選出方法は、たとえば検出された展開済みの分岐条件式に最も使用されていない入力変数を選出する。このようにして未決定の入力変数の入力値を1に決定すると、ステップf6からステップf4へ戻る。   If it is determined in step f4 that there is no unfolded branch conditional expression having an undetermined input variable, the process proceeds to step f6. In step f6, one of the plurality of undecided input variables is selected, and the input value of this input variable is determined to be 1. As the selection method, for example, an input variable that is least used in the detected branching conditional expression is selected. When the input value of the undetermined input variable is determined to be 1 in this way, the process returns from step f6 to step f4.

ステップf3で、未決定の入力変数がないと判定すると、ステップf3からステップf7へ移行する。ステップf7では、各入力変数の偽入力値を変数入力値として記憶させる。検出された変数入力値のうち、すべての展開済みの分岐条件式に対し真および偽の結果が同一の変数入力値は、1つの変数入力値を除き他のすべての変数入力値を削除する。さらに各入力変数に対する変数入力値の組合わせ(以下、単に「組合わせ」と称する場合がある)を検出する。このようにして変数入力値を生成する。変数入力値を生成すると、入力値生成処理工程が終了し、ステップs6からステップs7へ移行する。   If it is determined in step f3 that there are no undetermined input variables, the process proceeds from step f3 to step f7. In step f7, the false input value of each input variable is stored as a variable input value. Among the detected variable input values, variable input values having the same true and false results for all expanded branch conditional expressions delete all other variable input values except for one variable input value. Further, a combination of variable input values for each input variable (hereinafter sometimes simply referred to as “combination”) is detected. In this way, a variable input value is generated. When the variable input value is generated, the input value generation processing step ends, and the process proceeds from step s6 to step s7.

このテスト入力値生成処理では、変更前および変更後ソースコードにおいて、変数名が変更されている入力変数を同一の入力変数とみなし、変数入力値を検出する。検出された変数入力値は、前記同一とみなされた各入力変数の変数入力値として記憶される。具体的に説明すると、たとえば同一関数において、変更前ソースコードおよび変更後ソースコードの引数の変数名が異なる場合、テスト入力値生成処理では、これら入力変数が同一の入力変数であるとみなし、これらの変数入力値を各入力変数に相互に入力すべき入力値であるとみなす。   In this test input value generation processing, the input variable whose variable name is changed is regarded as the same input variable in the source code before and after the change, and the variable input value is detected. The detected variable input value is stored as the variable input value of each input variable considered to be the same. Specifically, for example, in the same function, when the variable names of the source code before the change and the source code after the change are different, the test input value generation process considers these input variables to be the same input variable, and these Are assumed to be input values to be input to each input variable.

以下では、この入力変数検索処理について、変更前および変更後ソースコードを用いて、表15および16の展開済みの分岐条件式を参照しつつ具体的に説明する。ステップf1において、変更前および変更後ソースコードから得られる展開済みの分岐条件式に基づいて、6つの展開済みの分岐条件式が取得される。6つの展開済みの分岐条件式は、「a<=100」、「a>=101」、「a>200」、「a<201」、「sub(1)=1」、「sub(1)=2」である。ここで「sub(1)」の1は、識別番号である。この6つの展開済みの分岐条件式を取得すると、ステップf1からステップf2へ移行する。   Hereinafter, the input variable search process will be described in detail with reference to the expanded branch conditional expressions in Tables 15 and 16 using the source code before and after the change. In step f1, six expanded branch conditional expressions are acquired based on the expanded branch conditional expressions obtained from the source code before and after the change. The six expanded branching conditional expressions are “a <= 100”, “a> = 101”, “a> 200”, “a <201”, “sub (1) = 1”, “sub (1)”. = 2 ". Here, 1 in “sub (1)” is an identification number. When these six expanded branch conditional expressions are acquired, the process proceeds from step f1 to step f2.

ステップf2へ移行すると、テスト入力値生成処理が開始する。ステップg1では、1変数の展開済みの分岐条件式「a<=100」を検出する。検出すると、ステップg1からステップg2へ移行する。ステップg2では、「a<=100」の関係演算子に等号が含まれると判定する。これによってステップg2からステップg3へ移行する。ステップg3では、入力変数aの真入力値として、「a<=100」の定数である100を記憶させる。これによってステップg5へ移行する。   When the process proceeds to step f2, the test input value generation process starts. In step g1, a branch conditional expression “a <= 100” of one variable is detected. If detected, the process proceeds from step g1 to step g2. In step g2, it is determined that an equal sign is included in the relational operator “a <= 100”. As a result, the process proceeds from step g2 to step g3. In step g3, 100, which is a constant of “a <= 100”, is stored as the true input value of the input variable a. As a result, the process proceeds to step g5.

ステップg5では、「a<=100」の関係演算子が「<=」であると判定する。これによってステップg5からステップg6へ移行する。ステップg6では、入力変数aの偽入力値として、「a<=100」の定数である100に1を加えた101を記憶させる。これによってステップg6からステップg8へ移行する。ステップg8では、真および偽入力値が検出されていない1変数の展開済みの分岐条件式があるので、ステップg8からステップg1へ戻る。   In step g5, it is determined that the relational operator of “a <= 100” is “<=”. As a result, the process proceeds from step g5 to step g6. In step g6, 101, which is a value obtained by adding 1 to 100, which is a constant of “a <= 100”, is stored as a false input value of the input variable a. As a result, the process proceeds from step g6 to step g8. In step g8, since there is a developed branch conditional expression of one variable for which true and false input values are not detected, the process returns from step g8 to step g1.

ステップg1へ戻り、次の1変数の展開済みの分岐条件式「a>=100」を検出し、この分岐条件式に基づいて入力変数aの真および偽入力値を検出する。他の4つの展開済みの分岐条件式も、1変数の展開済みの分岐条件式であるので、同様にして、ステップg1で検出され、各入力変数の真および偽入力値が検出され記憶される。各展開済みの分岐条件式に基づいて検出された各入力変数の真および偽入力値を表17に示す。すべての1変数の展開済みの分岐条件式を検出すると、テスト入力値生成処理が終了し、ステップf2からステップf3へ移行する。   Returning to step g1, the expanded branch conditional expression “a> = 100” of the next one variable is detected, and the true and false input values of the input variable a are detected based on this branch conditional expression. Since the other four expanded branch conditional expressions are also one variable expanded branch conditional expressions, they are similarly detected in step g1, and the true and false input values of each input variable are detected and stored. . Table 17 shows the true and false input values of each input variable detected based on each expanded branch conditional expression. When the expanded branching conditional expressions for all the one variables are detected, the test input value generation process ends, and the process proceeds from step f2 to step f3.

Figure 2007041804
Figure 2007041804

ステップf3では、変数入力値が決定していない入力変数がないと判定する。これによってステップf3からステップf8へ移行する。ステップf8では、表17に示す各入力変数の真および偽入力値に基づいて、表18に示す変数入力値が検出される。このとき、すべての展開済みの分岐条件式の真偽の結果が同一となる、変数入力値「a=101」および「a=200」のうち「a=200」が削除される。表18に示される変数入力値のそれぞれの組合わせを検出する。検出された組合わせを表19に示す。このようにして変数入力値を生成すると、ステップs6からステップs7へ移行する。   In step f3, it is determined that there is no input variable whose variable input value has not been determined. As a result, the process proceeds from step f3 to step f8. In step f8, variable input values shown in Table 18 are detected based on the true and false input values of the input variables shown in Table 17. At this time, “a = 200” is deleted from the variable input values “a = 101” and “a = 200” in which the true / false results of all the expanded branch conditional expressions are the same. Each combination of variable input values shown in Table 18 is detected. The detected combinations are shown in Table 19. When the variable input value is generated in this way, the process proceeds from step s6 to step s7.

Figure 2007041804
Figure 2007041804

Figure 2007041804
Figure 2007041804

表19は、縦の行に入力変数、横の行に各組合わせの組合わせ番号を示す。たとえば(a,sub(1))=(100,1)の組合わせ番号は、P1である。   In Table 19, the input variable is shown in the vertical line, and the combination number of each combination is shown in the horizontal line. For example, the combination number of (a, sub (1)) = (100, 1) is P1.

図12は、生成されたテストプログラムのフローチャートである。ステップs7であるテスト生成工程では、テスト生成部13によって、変更前および変更後ソースコード、モジュール情報、識別番号、入力変数ならびに変数入力値の組合わせに基づいて、テストプログラムを生成する。テストプログラムのフローについて、図12を参照して説明する。   FIG. 12 is a flowchart of the generated test program. In the test generation process which is step s7, the test generation unit 13 generates a test program based on a combination of the source code before and after the change, module information, identification number, input variable, and variable input value. The test program flow will be described with reference to FIG.

まずステップh1では、テスト入力値生成処理工程で生成された、変数入力値の組合わせを選出し、各入力変数にその変数入力値を代入する。選出し代入すると、ステップh1からステップh2へ移行する。ステップh2では、検証対象モジュールを呼び出し、代入された各変数入力値に基づく出力値を演算させる。演算すると、ステップh2からステップh3へ移行する。ステップh3では、代入された各変数入力値と演算された出力値とを関連付けて出力させる。出力させると、ステップh3からステップh4へ移行する。   First, in step h1, a combination of variable input values generated in the test input value generation processing step is selected, and the variable input value is substituted for each input variable. After selection and substitution, the process proceeds from step h1 to step h2. In step h2, the verification target module is called and an output value based on each substituted variable input value is calculated. When calculated, the process proceeds from step h2 to step h3. In step h3, each substituted variable input value and the calculated output value are output in association with each other. When output is performed, the process proceeds from step h3 to step h4.

ステップh4では、すべての組合わせが選出されたか否かを判定する。すべての組合わせが選出されたと判定すると、テストプログラムのフローが終了する。ステップh4で、すべての組合わせが選出されていないと判定すると、ステップh1へ戻り、選出されていない組合わせを選出し、各入力変数にその変数入力値を代入する。   In step h4, it is determined whether all combinations have been selected. If it is determined that all combinations have been selected, the test program flow ends. If it is determined in step h4 that all combinations have not been selected, the process returns to step h1, a combination not selected is selected, and the variable input value is substituted for each input variable.

このようなステップh1からステップh4へ移行し、ステップh1へ戻るサイクルを、テストサイクルと称する。このテストサイクルを繰返すことによって、全ての組合わせの変数入力値に対する出力値が出力させる。   Such a cycle that shifts from step h1 to step h4 and returns to step h1 is referred to as a test cycle. By repeating this test cycle, output values for the variable input values of all combinations are output.

テストプログラムには、さらに同一の識別番号が付与された外部関数の呼び出し回数を演算し、各呼び出しに対して異なる外部関数の変数入力値を代入させる。外部関数が同一の変数入力値であることによって、検証が不充分な場合がある。たとえばfor文などのループ文内に外部関数が記述され、その外部関数の値に基づいてループ文を終了させる場合がある。この場合、外部関数の値が変化しなければ、無限ループに嵌り、検証が終了しない場合がある。呼び出し毎に、外部関数の入力変数値を変えることによって、検証が終了しないことを未然に防止し、前記モジュールによって、不充分な検証になることを防止できる。ただし、必ずしもこのモジュールを必要とするわけではなく、変更前および変更後ソースコードのようにループ文が無い場合、このような命令文を省略してもよい。また一定回数の呼び出しがあった場合、ループ文から抜け出すようにしてもよい。   The test program further calculates the number of calls of the external function to which the same identification number is assigned, and assigns a variable input value of a different external function to each call. The verification may be insufficient due to the external function having the same variable input value. For example, an external function may be described in a loop statement such as a for statement, and the loop statement may be terminated based on the value of the external function. In this case, if the value of the external function does not change, it may fit into an infinite loop and verification may not end. By changing the input variable value of the external function for each call, it is possible to prevent the verification from being completed, and the module can prevent insufficient verification. However, this module is not necessarily required, and when there is no loop statement like the source code before and after the change, such a statement may be omitted. Further, when a certain number of calls are made, the loop sentence may be escaped.

このようなテスト生成工程で、テスト生成部13によって生成されたテストプログラムを表20に示す。以下では、本実施の形態で生成されたテストプログラムのソースコード(以下、「テストソースコード」と称する場合がある)について、説明する。   Table 20 shows test programs generated by the test generation unit 13 in such a test generation process. Hereinafter, the source code of the test program generated in the present embodiment (hereinafter sometimes referred to as “test source code”) will be described.

Figure 2007041804
Figure 2007041804

テストソースコードでは、まず入力変数aおよび外部関数sub()の変数入力値の各配列に入力させる(1行目から13行目)。入力変数aのすべての変数入力値が配列va[aNum]に入力され、外部関数のすべての変数入力値が配列vsub[subNum]に入力されている。   In the test source code, first, input is made to each array of the input variable a and the variable input value of the external function sub () (from the first line to the 13th line). All variable input values of the input variable a are input to the array va [aNum], and all variable input values of the external function are input to the array vsub [subNum].

14行目から53行目には、テストサイクルのフローのソースコード、つまりテストプログラムにおいてメインとなる関数が記述されている。メインとなる関数は、変更前および変更後ソースコードに含まれる関数名(func(),sub()など)と重複しない関数名(本実施の形態では、test)を、テスト生成部13によって付されている。これによって、関数名が同一のため検証が行えないことを防止する。   The 14th to 53rd lines describe the source code of the test cycle flow, that is, the main function in the test program. The main function is assigned a function name (test in this embodiment) that does not overlap with a function name (func (), sub (), etc.) included in the source code before and after the change by the test generation unit 13. Has been. As a result, it is possible to prevent verification because the function names are the same.

16行目から20行目では、各ローカル変数の型宣言をしている。22行目から50行目では、各組合わせ(P1〜P9の組合わせ)を選出し、選出された組合わせに基づいて関数funcの出力値を演算させる(40行目)。選出された組合わせおよび前記出力値などを関連付けて出力させる。すべての変数入力値の組合わせについて、組合わせおよび出力値などを関連付けて出力させる。具体的には、入力変数aと外部関数sub()との組合わせ、出力値である関数funcおよび関数を演算前後の配列b[10]が関連付けて出力される。すべての組合わせについて、この出力結果を取得する。   Lines 16 to 20 declare the type of each local variable. In the 22nd to 50th lines, each combination (combination of P1 to P9) is selected, and the output value of the function func is calculated based on the selected combination (40th line). The selected combination and the output value are associated with each other and output. All combinations of variable input values are output in association with the combination and output value. Specifically, the combination of the input variable a and the external function sub (), the function func that is the output value, and the function are output in association with the array b [10] before and after the operation. Get this output for all combinations.

55行目から75行目では、同一の識別番号の外部関数が呼び出される度に、その外部関数の変数入力値を変更させている。具体的には、変数入力値「sub(1)=1」が選出された場合、最初に外部関数「sub(1)」に値の入力を要求されている際、この外部関数「sub(1)」に1を入力する。次に外部関数「sub(1)」の入力が要求されると、他の変数入力値「sub(1)=2」を入力する。さらに次に外部関数「sub(1)」の入力が要求されると、他の変数入力値「sub(1)=3」を入力する。検出された変数入力値が「sub(1)=1,2,3」である場合、変数入力値「sub(1)=3」を入力した後、さらに外部関数「sub(1)」の入力が要求されると、再度、変数入力値「sub(1)=1」を入力する。このようなサイクルを繰り返し、無限ループなどに起因する不充分な検証を防止する。また入力させる値として2が選出されている場合、2を起点として「2」、「3」、「1」の順で、入力される。   From the 55th line to the 75th line, every time an external function having the same identification number is called, the variable input value of the external function is changed. Specifically, when the variable input value “sub (1) = 1” is selected, when the external function “sub (1)” is first requested to input a value, the external function “sub (1)” is selected. ) "Is entered. Next, when input of the external function “sub (1)” is requested, another variable input value “sub (1) = 2” is input. Next, when input of the external function “sub (1)” is requested, another variable input value “sub (1) = 3” is input. When the detected variable input value is “sub (1) = 1, 2, 3”, the variable input value “sub (1) = 3” is input and then the external function “sub (1)” is input. Is requested, the variable input value “sub (1) = 1” is input again. Such a cycle is repeated to prevent insufficient verification due to an infinite loop or the like. When 2 is selected as the value to be input, the values are input in the order of “2”, “3”, and “1” starting from 2.

テスト生成部13によって、このようなテストソースコードが生成されると、ステップs7からステップs8へ移行する。   When such a test source code is generated by the test generation unit 13, the process proceeds from step s7 to step s8.

ステップs8であるテスト実行工程では、テスト生成工程s7で生成されたテストプログラムを実行する。テストプログラムが実行されると、すべての組合わせについて、各組合わせ毎に前記出力結果を演算させる。テスト実行部14は、これらの出力結果を記憶させる。出力結果が記憶されると、ステップs8からステップs9へ移行する。変更前ソースコードに基づいて、テストプログラムを実行して演算された出力結果を表21に示す。   In the test execution process which is step s8, the test program generated in the test generation process s7 is executed. When the test program is executed, the output result is calculated for each combination for all combinations. The test execution unit 14 stores these output results. When the output result is stored, the process proceeds from step s8 to step s9. Table 21 shows the output result calculated by executing the test program based on the pre-change source code.

各組合わせ毎に出力結果が示されている。たとえば「a=100,sub()=1」の組合わせP1の出力結果が、「Pattern1」として1行目から6行目に示されている。7行目から57行目まで、同様に、組合わせP2〜P9の出力結果が「Pattern2」〜「Pattern9」として示されている。   Output results are shown for each combination. For example, the output result of the combination P1 of “a = 100, sub () = 1” is shown in the first to sixth lines as “Pattern1”. Similarly, from the seventh line to the 57th line, output results of the combinations P2 to P9 are shown as “Pattern2” to “Pattern9”.

組合わせP4〜P6では、出力結果として「call sub(100)」が示されている。これは、前記組合わせP4〜P6において、外部関数「sub()」が引数を「a=100」として呼び出されたことを示している。このようにして、各組合わせP1〜P9に基づく出力値および外部関数の呼び出しの有無について出力される。   In the combinations P4 to P6, “call sub (100)” is shown as an output result. This indicates that in the combinations P4 to P6, the external function “sub ()” is called with the argument “a = 100”. In this way, the output value based on each combination P1 to P9 and whether or not an external function is called are output.

変更後ソースコードに基づいて、テストプログラムを実行して得られた出力結果を表22に示す。変更後ソースコードでも、変更前ソースコードの場合と同様に、各組合わせP1〜P9に基づく出力値および外部関数の呼び出しの有無について出力される。   Table 22 shows an output result obtained by executing the test program based on the changed source code. Similarly to the case of the source code before change, the post-change source code is output regarding the output value based on each combination P1 to P9 and whether or not the external function is called.

Figure 2007041804
Figure 2007041804

Figure 2007041804
Figure 2007041804

図13は、出力値比較検証処理の手順を示すフローチャートである。ステップs9である出力比較検証処理工程では、出力比較検証処理を開始し、出力値比較検証部15によって、各検証対象モジュールに基づいて出力された出力結果を相互に比較し、検証対象モジュールの入力値に対する出力値の同一性を検証する。比較検証処理において、動作主体は、出力値比較検証部15である。以下、比較検証処理において出力値比較検証部15が制御主体の場合、その記載を省略する場合がある。   FIG. 13 is a flowchart showing the procedure of the output value comparison verification process. In the output comparison verification process step that is step s9, the output comparison verification process is started, and the output value comparison verification unit 15 compares the output results output based on each verification target module with each other, and inputs the verification target module. Verifies the identity of the output value to the value. In the comparison verification process, the operation subject is the output value comparison verification unit 15. Hereinafter, in the comparison verification process, when the output value comparison verification unit 15 is a control subject, the description may be omitted.

以下では、比較検証処理について具体的に説明する。テスト実行工程s8から比較検証処理工程s9に移行すると、比較検証処理が開始し、ステップj1へ移行する。ステップj1では、変更前および変更後ソースコードの出力結果を、組合わせ毎に比較する。比較をすると、ステップj1からステップj2へ移行する。   Hereinafter, the comparison verification process will be specifically described. When the process proceeds from the test execution process s8 to the comparison verification process process s9, the comparison verification process starts and the process proceeds to step j1. In step j1, the output results of the source code before and after the change are compared for each combination. When the comparison is made, the process proceeds from step j1 to step j2.

ステップj2では、変更前および変更後ソースコードの出力結果において、変数入力値が同一の組合わせであって、異なる出力値が出力がされる組合わせを検出する。組合わせが検出できないと判定すると、出力値比較検証処理が終了し、ステップs9からステップs10へ移行する。組合わせが検出されたと判定すると、ステップj2からステップj3へ移行する。ステップj3では、検出された組合わせおよび変更前および変更後ソースコード出力値を記憶させ、検証結果として出力する。検証結果が出力されると、ステップj3からステップj4へ移行する。   In step j2, in the output results of the source code before and after the change, combinations in which the variable input values are the same and different output values are output are detected. If it is determined that the combination cannot be detected, the output value comparison verification process ends, and the process proceeds from step s9 to step s10. If it is determined that a combination is detected, the process proceeds from step j2 to step j3. In step j3, the detected combination and the pre-change and post-change source code output values are stored and output as verification results. When the verification result is output, the process proceeds from step j3 to step j4.

ステップj4では、モジュール情報、特定条件S1,S2,S3およびローカル変数検出情報に基づいて、4つの不充分条件のうちいずれか1つに該当するか否かを判定する。4つの不充分条件は、(1)各検証対象モジュールのモジュール情報が異なる(配列要素だけが異なる場合も含む)、(2)特定条件S1およびS3を具備すること、(3)特定条件S2を具備する、ことおよび(4)値の設定されていないローカル変数を検出したローカル変数検出情報が記憶されていることである。これら4つの不充分条件のいずれかに該当すると、検証が不充分である可能性がある。4つの不充分条件のいずれかに該当すると判定する、該当する不充分条件を記憶させ、検証結果として出力し、出力値比較検証処理が終了する。4つの不充分条件のいずれにも該当しないと判定すると、出力値比較検証処理が終了する。出力値比較検証処理が終了すると、出力値比較検証処理工程が終了し、ステップs9からステップs10へ移行する。   In step j4, based on the module information, the specific conditions S1, S2, S3 and the local variable detection information, it is determined whether any one of the four insufficient conditions is met. The four inadequate conditions are (1) module information of each verification target module is different (including a case where only array elements are different), (2) having specific conditions S1 and S3, and (3) specifying condition S2. And (4) local variable detection information for detecting a local variable for which no value is set is stored. If any of these four inadequate conditions is met, verification may be inadequate. The corresponding insufficiency condition, which is determined to correspond to any of the four insufficiency conditions, is stored and output as a verification result, and the output value comparison verification process ends. If it is determined that none of the four inadequate conditions is met, the output value comparison verification process is terminated. When the output value comparison verification process ends, the output value comparison verification process step ends, and the process proceeds from step s9 to step s10.

ステップs10である検証結果報知工程では、テスト実行処理工程の出力結果および出力値比較検証処理工程の検証結果を、出力部5によって、利用者に報知する。報知すると、プログラム検証処理が終了する。   In the verification result notifying step, which is step s10, the output unit 5 notifies the user of the output result of the test execution processing step and the verification result of the output value comparison verification processing step. When notified, the program verification process ends.

以下には、検証結果報知工程で、変更前および変更後ソースコードの出力結果を比較して検証した検証結果を表23に示す。検証結果では、P4およびP6の組合わせにおいて出力値が異なることが検出されている。   Table 23 shows the verification results verified by comparing the output results of the source code before and after the change in the verification result notification step. In the verification result, it is detected that the output values are different in the combination of P4 and P6.

Figure 2007041804
Figure 2007041804

利用者は、検証結果に基づいて、ソースコードのバグの修正を行う。検証結果に基づいて、バグの修正がされた変更後ソースコードを表24に示す。検証結果に基づいて修正された部分は、修正後のソースコードの15行目から22行目であり、顕著な変更部分は、19行目のif文を追加したことである。このようにして検証結果に基づいて修正することによって、正常にリファクタリングされたソースコードを得ることができる。   The user corrects a bug in the source code based on the verification result. Table 24 shows the changed source code in which the bug is corrected based on the verification result. The part corrected based on the verification result is the 15th to 22nd lines of the corrected source code, and the remarkable change part is that the if sentence on the 19th line is added. Correcting based on the verification result in this way makes it possible to obtain a normally refactored source code.

装置本体2は、検証プログラムを実行することによって、プログラム検証処理を行っている。   The apparatus body 2 performs a program verification process by executing a verification program.

Figure 2007041804
Figure 2007041804

以下では、このようなプログラム検証装置1が奏する効果について説明する。本実施の形態のプログラム検証装置1によれば、入力値演算手段16によって、真入力値および偽入力値を演算する。テスト生成部13は、真および偽入力値に基づく出力値を出力させるテストプログラムを生成する。テストプログラムを実行することによって、真および偽入力値に基づいて出力される出力値を演算できる。変更前および変更後モジュールについて、同様にテストプログラムを生成し実行することによって、変更前および変更後モジュールの真および偽入力値ならびにこれらの入力値に基づく出力値を演算できる。演算された出力値を比較することによって、変更前および変更後モジュールの真および偽入力値に基づく出力値が相互に同一であるか否かを容易に検証できる。このように出力値の同一性を容易に検証できるので、たとえば変更後モジュールおよび変更前モジュールの入力値に対する出力値の同一性を検証できる。すべての条件式の真および偽入力値を演算することによって、変更前および変更後モジュールで辿り得るすべての処理経路について検証することができ、また出力し得るすべての出力値を検証できる。これによって漏れのない検証を実現できる。このような漏れのない検証結果に基づいて、利用者は、変更後モジュールに含まれるバグを漏れなく検出し、バグを容易に修正できる。   Below, the effect which such a program verification apparatus 1 show | plays is demonstrated. According to the program verification apparatus 1 of the present embodiment, the input value calculation means 16 calculates a true input value and a false input value. The test generation unit 13 generates a test program that outputs an output value based on true and false input values. By executing the test program, the output value output based on the true and false input values can be calculated. By generating and executing test programs in the same way for the modules before and after the change, the true and false input values of the modules before and after the change and the output values based on these input values can be calculated. By comparing the calculated output values, it is possible to easily verify whether the output values based on the true and false input values of the pre-change module and the post-change module are the same. Thus, since the identity of the output value can be easily verified, for example, the identity of the output value with respect to the input value of the module after change and the module before change can be verified. By calculating the true and false input values of all conditional expressions, it is possible to verify all processing paths that can be traced by the module before and after the change, and it is possible to verify all output values that can be output. This makes it possible to realize a leak-free verification. Based on such a complete verification result, the user can detect the bug included in the module after the change without omission and easily correct the bug.

本実施の形態のプログラム検証装置1によれば、入力値演算手段16によって、真入力値および偽入力値を演算する。プログラム実行手段17は、真および偽入力値に基づいて、これら入力値が演算された変更前および変更後モジュールを実行し、真および偽入力値に基づく出力値を出力する。出力値比較検証部15は、プログラム実行手段17によって出力された変更前および変更後モジュールの出力値を相互に比較する。出力値比較検証部15は、比較結果に基づいて、変更前および変更後モジュールの真および偽入力値に基づく出力値が相互に同一であるか否かを検証する。真および偽入力値に基づく出力値が同一であるか否かを検証することによって、たとえば変更後モジュールおよび変更前モジュールの入力値に対する出力値の同一性を利用者が検証する手間を省くことができる。検証について人の手が介在しないので、利用者の検証漏れを防ぐことができる。またすべての条件式の真および偽入力値を演算することによって、各検証対象プログラムで辿り得るすべての処理経路(フロー)について検証することができ、また出力し得るすべての出力値を検証できる。これによって漏れのない検証を実現できる。このような漏れのない検証結果に基づいて、変更後のプログラムに含まれるバグを漏れなく検出し、利用者が漏れなくバグを修正することを促進できる。   According to the program verification apparatus 1 of the present embodiment, the input value calculation means 16 calculates a true input value and a false input value. Based on the true and false input values, the program execution means 17 executes the pre-change and post-change modules in which these input values are calculated, and outputs an output value based on the true and false input values. The output value comparison / verification unit 15 compares the output values of the pre-change module and the post-change module output by the program execution means 17 with each other. The output value comparison / verification unit 15 verifies whether the output values based on the true and false input values of the pre-change module and the post-change module are the same based on the comparison result. By verifying whether the output values based on the true and false input values are the same, for example, it is possible to save the user from verifying the identity of the output values with respect to the input values of the post-change module and the pre-change module. it can. Since there is no human intervention for verification, it is possible to prevent a user from omission of verification. Further, by calculating the true and false input values of all the conditional expressions, it is possible to verify all the processing paths (flows) that can be traced by each verification target program, and it is possible to verify all the output values that can be output. This makes it possible to realize a leak-free verification. It is possible to detect bugs included in the program after the change without omission based on such omission-free verification results and to promote the user to correct the bug without omission.

本実施の形態の検証プログラムによれば、各検証対象プログラムの真および偽入力値に基づく出力値が相互に同一であるか否かを容易に検証できる装置を実現できる。   According to the verification program of the present embodiment, it is possible to realize an apparatus that can easily verify whether or not the output values based on the true and false input values of each verification target program are the same.

本実施の形態のプログラム検証装置1によれば、4つの不充分条件に該当するか否かを出力する。これによって充分な検証に基づいて検証結果が出力されているか否かを、利用者が容易に判断できる。また検証結果が不充分である場合、不充分条件に該当する部分にバグが含まれている可能性があることを利用者に報知できる。報知することによって、利用者に不充分条件に該当する部分を検討させることになり、バグ発見の補助的な役割も担う。   According to the program verification apparatus 1 of the present embodiment, whether or not four insufficient conditions are met is output. Accordingly, the user can easily determine whether or not the verification result is output based on sufficient verification. Further, when the verification result is insufficient, it is possible to notify the user that there is a possibility that a bug is included in a portion corresponding to the insufficient condition. By informing the user, the user is allowed to examine a portion corresponding to the insufficient condition, and also plays an auxiliary role in bug detection.

本実施の形態のプログラム検証装置1によれば、テスト入力値生成部12は、すべての展開済みの分岐条件式に対して真偽の結果が同じ、変数入力値の組合わせを削除している。これによってテスト実行部14で演算すべき変数入力値の組合わせを低減することができ、検証速度を速めることができる。   According to the program verification apparatus 1 of the present embodiment, the test input value generation unit 12 deletes a combination of variable input values that have the same true / false result for all expanded branch conditional expressions. . As a result, combinations of variable input values to be calculated by the test execution unit 14 can be reduced, and the verification speed can be increased.

本発明の形態のプログラム検証装置1によれば、未決定の入力変数の入力値を1に設定する。これによって未決定の入力変数の入力値があっても、ソースコードの検証を続けられることができ、検証が実行不能になることが防止される。また未決定の入力変数の入力値を1に設定することによって、初等関数などにおいて演算が不可能になる場合が少なく、条件式および変換式において演算が不可能な場合の発生を少なくできる。これによってソースコードの検証を最後まで実行できる。また全分岐条件式に基づいて、未決定の入力変数の入力値の解を演算する場合、前記入力値の解が演算不可能な場合が多く、予め1に設定することによって、これらの演算を行うことなく、検証を実行させることができる。   According to the program verification apparatus 1 of the embodiment of the present invention, the input value of an undetermined input variable is set to 1. As a result, even if there is an input value of an undetermined input variable, it is possible to continue the verification of the source code and to prevent the verification from becoming impossible. In addition, by setting the input value of an undetermined input variable to 1, there are few cases where computation is impossible in an elementary function or the like, and the occurrence of cases where computation is impossible in conditional expressions and conversion formulas can be reduced. As a result, the source code can be verified to the end. In addition, when calculating the solution of the input value of the undecided input variable based on the all-branch conditional expression, it is often impossible to calculate the solution of the input value. Verification can be performed without doing it.

本実施の形態では、処理経路抽出処理は前述のような手順で処理を行っているけれども、特開2001−109644に記載される方法で処理経路を抽出してもよい。   In the present embodiment, the processing route extraction processing is performed according to the procedure described above, but the processing route may be extracted by a method described in Japanese Patent Laid-Open No. 2001-109644.

本実施の形態では、処理経路抽出処理において、ループ文を検出すると、そのループ文内の処理ブロックを次の処理ブロックとして抽出している。しかしながらループ文の条件式によって、ループ文内の処理ブロックを次の処理ブロックとしない場合を含め、任意の回数だけループ文内の処理ブロックを連続して処理することがあるので、ループ文内の処理ブロックを次の処理ブロックとしない処理経路や、複数回処理する経路も生成することが好ましい。   In the present embodiment, when a loop statement is detected in the processing path extraction process, the processing block in the loop statement is extracted as the next processing block. However, depending on the conditional expression of the loop statement, the processing block in the loop statement may be processed continuously any number of times, including the case where the processing block in the loop statement is not the next processing block. It is also preferable to generate a processing path that does not set the processing block as the next processing block or a path that performs processing a plurality of times.

本実施の形態では、テスト生成部13で、同一の展開済みの分岐条件式および同一の真偽の結果となる真および偽入力値は、1つの分岐条件式および入力値を残して削除されるけれども、必ずしも削除する必要は無い。これは、プログラム検証装置1のプログラム検証処理の処理を早くするためであり、削除しなくてもよい。   In the present embodiment, the test generation unit 13 deletes the same expanded branch conditional expression and true and false input values that result in the same true / false result, leaving one branch conditional expression and the input value. However, it is not always necessary to delete. This is for speeding up the program verification processing of the program verification apparatus 1 and does not have to be deleted.

本実施の形態では、入力値決定処理で真および偽入力値を決定する際、真または偽入力値に1を加減しているけれども、必ずしも加減する値が1に限定されない。正の整数であればよい。また本実施の形態のソースコードでは、入力変数が整数型であるので、加減する値が1であるけれども、実数型の入力変数であれば、その加減する値が正の実数であってもよい。この場合、1を加減すると、宣言されて型の制約上、入力変数のとり得る値を超える場合に有効となる。   In the present embodiment, when the true and false input values are determined by the input value determination process, 1 is added to or subtracted from the true or false input value, but the value to be added or subtracted is not necessarily limited to 1. Any positive integer may be used. In the source code of the present embodiment, since the input variable is an integer type, the value to be added or subtracted is 1. However, if the input variable is a real type input variable, the value to be added or subtracted may be a positive real number. . In this case, adding or subtracting 1 is effective when the value is declared and exceeds the possible value of the input variable due to type restrictions.

また変数入力値は、真および偽入力値だけであるけれども、必ずしもこれだけに限定されない。たとえば宣言された型の制約上、入力変数がとり得る最大値(16ビットのint型の場合、32767)および最小値(16ビットのint型の場合、−32768)を変数入力値として用いてもよい。また0も同様に変数入力値として用いてもよい。これらの値は、プログラムを実行する上で、不具合を生じやすい値であり、これらの検証も同時に行うことが好ましい。   The variable input values are only true and false input values, but are not necessarily limited thereto. For example, the maximum value (32767 in the case of 16-bit int type) and the minimum value (-32768 in the case of 16-bit int type) that can be taken by the input variable may be used as the variable input value due to restrictions of the declared type. Good. Similarly, 0 may be used as a variable input value. These values are values that tend to cause problems when the program is executed, and it is preferable that these verifications are also performed at the same time.

さらに列挙型(enum型)の入力変数の場合、これら列挙されるすべて入力値を変数入力値としてもよい。   Further, in the case of enumerated type (enum type) input variables, all of the enumerated input values may be used as variable input values.

本実施の形態では、出力部5によって、出力結果および検証結果を報知しているけれども、このような結果だけを報知することに限定されない。たとえばモジュール情報を報知してもよく、これを報知すると、検証対象モジュールが外部モジュールに与える影響を利用者が知ることができる。   In the present embodiment, the output unit 5 notifies the output result and the verification result, but is not limited to notifying only such a result. For example, the module information may be notified, and if this is notified, the user can know the influence of the verification target module on the external module.

本実施の形態では、2つの検証対象モジュールの同一性について検証しているけれども、2つの検証対象モジュールに限定されない。検証対象モジュールが3つ以上であってもよい。この場合、出力値比較検証部15は、いずれの検証対象モジュールが異なる出力結果を演算したのかを出力する機能を有すれば、いずれの検証対象モジュールの出力結果が異なるのかが明確になる。   In the present embodiment, the identity of two verification target modules is verified, but the present invention is not limited to two verification target modules. There may be three or more verification target modules. In this case, if the output value comparison / verification unit 15 has a function of outputting which verification target module calculates a different output result, it becomes clear which output result of the verification target module is different.

また本発明では、制御文、たとえばif文の条件式を各分岐条件式で区切っているけれども、必ずしもこのような区切り方に限定されず、条件式毎に区切ってもよい。この場合、処理経路抽出処理では、各条件式について真偽をそれぞれ判定し、この条件式を検出処理ブロックとして処理経路に追加する。これによって条件式が複雑であっても、プログラムの処理経路を容易に検索できる。   In the present invention, the conditional expression of the control statement, for example, the “if” statement is delimited by each branch conditional expression, but is not necessarily limited to such a delimiter, and may be delimited for each conditional expression. In this case, in the processing route extraction processing, each conditional expression is determined to be true or false, and this conditional expression is added to the processing route as a detection processing block. As a result, even if the conditional expression is complicated, the processing path of the program can be easily searched.

さらに本発明では、分岐条件式に対応する数式が1つの数式であるけれども、分岐条件式が複数の式および論理演算子を含むものであってもよい。たとえば、表25に記載されるように、if文の条件式が「((a==1||b==1)&&c==1)」の場合、(a==1&&b==1)を1つの処理ブロックとし、c==1を1つの処理ブロックとする。これによって、表25のように分岐条件式に分岐条件が含まれるような場合であっても、分岐条件式に複数の数式と論理演算子とを含む処理ブロックに区切り、処理経路を検出することできる。   Furthermore, in the present invention, although the mathematical expression corresponding to the branch condition expression is one mathematical expression, the branch condition expression may include a plurality of expressions and logical operators. For example, as shown in Table 25, when the conditional expression of the if statement is “((a == 1 || b == 1) && c == 1)”, (a == 1 && b == 1) One processing block is assumed, and c == 1 is one processing block. Thus, even when the branch condition expression includes a branch condition as shown in Table 25, the processing condition is detected by dividing the branch condition expression into processing blocks including a plurality of mathematical expressions and logical operators. it can.

Figure 2007041804
Figure 2007041804

本実施の形態のプログラム検証装置1の機能をブロック毎に分けて示すブロック図である。It is a block diagram which divides and shows the function of the program verification apparatus 1 of this Embodiment for every block. プログラム検証処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of a program verification process. 出力抽出処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of an output extraction process. 識別番号付加処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of an identification number addition process. 外部関数に識別番号を付与する前および付与した後のソースコードの一部を示す図である。It is a figure which shows a part of source code before giving an identification number to an external function, and after giving. 分岐条件抽出処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of a branch condition extraction process. 処理経路抽出処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of a process path | route extraction process. 入力変数検索処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of an input variable search process. 分岐条件式の展開方法の手順を示すフローチャートである。It is a flowchart which shows the procedure of the expansion | deployment method of a branch conditional expression. 入力値生成処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of an input value production | generation process. 入力値検出処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of an input value detection process. 生成されたテストプログラムのフローチャートである。It is a flowchart of the generated test program. 出力値比較検証処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of an output value comparison verification process.

符号の説明Explanation of symbols

1 プログラム検証装置
2 装置本体
13 テスト生成部
15 出力値比較検証部
16 入力値演算手段
17 プログラム実行手段
DESCRIPTION OF SYMBOLS 1 Program verification apparatus 2 Apparatus main body 13 Test production | generation part 15 Output value comparison verification part 16 Input value calculation means 17 Program execution means

Claims (3)

入力される入力値に基づいて出力値を出力させる検証対象プログラムのソースコードに含まれる条件式であって、その条件式の真偽によって処理が分岐する条件式が真および偽になる入力値を演算する入力値演算手段と、
検証対象プログラムを用いて、入力値演算手段によって演算される入力値に基づく出力値を出力させるテストプログラムを生成するプログラム生成手段とを含むことを特徴とするプログラム生成装置。
A conditional expression included in the source code of the verification target program that outputs an output value based on the input value that is input, and an input value that makes the conditional expression true and false that branches depending on whether the conditional expression is true or false Input value calculating means for calculating;
A program generation apparatus comprising: a program generation unit that generates a test program that outputs an output value based on an input value calculated by an input value calculation unit using a verification target program.
入力される入力値に基づいて、出力値を出力させる複数の検証対象プログラムの入力値に対する出力値が同一であるか否かを検証するプログラム検証装置であって、
各検証対象プログラムのソースコードに含まれる条件式であって、その条件式の真偽によって処理が分岐する条件式が真および偽になる入力値を、検証対象プログラム毎に演算する入力値演算手段と、
入力値演算手段によって演算された入力値に基づいて、この入力値の演算に用いられた各検証対象プログラムを実行し、出力値を出力するプログラム実行手段と、
プログラム実行手段によって出力される各検証対象プログラムの出力値をそれぞれ比較する出力値比較手段と、
前記出力比較手段の比較結果に基づいて、各検証対象プログラムの出力値が同一であるか否かを検証する検証手段とを含むことを特徴とするプログラム検証装置。
A program verification device that verifies whether or not output values for input values of a plurality of verification target programs that output an output value are the same based on an input value that is input,
An input value calculation means for calculating, for each verification target program, an input value that is a conditional expression included in the source code of each verification target program and whose conditional expression is true or false depending on whether the conditional expression is true or false When,
Based on the input value calculated by the input value calculation means, program execution means for executing each verification target program used for calculation of the input value and outputting an output value;
Output value comparison means for comparing the output values of each verification target program output by the program execution means;
A program verification apparatus comprising: verification means for verifying whether or not the output values of the respective verification target programs are the same based on the comparison result of the output comparison means.
請求項2記載のプログラム検証装置を制御するための検証プログラム。   A verification program for controlling the program verification device according to claim 2.
JP2005224601A 2005-08-02 2005-08-02 Program generation device, program verification device, and verification program Pending JP2007041804A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005224601A JP2007041804A (en) 2005-08-02 2005-08-02 Program generation device, program verification device, and verification program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005224601A JP2007041804A (en) 2005-08-02 2005-08-02 Program generation device, program verification device, and verification program

Publications (1)

Publication Number Publication Date
JP2007041804A true JP2007041804A (en) 2007-02-15

Family

ID=37799730

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005224601A Pending JP2007041804A (en) 2005-08-02 2005-08-02 Program generation device, program verification device, and verification program

Country Status (1)

Country Link
JP (1) JP2007041804A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012208830A (en) * 2011-03-30 2012-10-25 Nec Corp Program test device, program test method and program
JP2014021686A (en) * 2012-07-18 2014-02-03 Fujitsu Ltd Test data generation device, program and method
JP2014044678A (en) * 2012-08-28 2014-03-13 Toshiba Corp Compiler evaluation device, method, and program
US10489149B2 (en) 2013-03-22 2019-11-26 International Business Machines Corporation Information processing apparatus, information processing method and program
JP2020144842A (en) * 2019-03-08 2020-09-10 富士通株式会社 Generating inputs for computer-readable program testing
KR20210046363A (en) * 2019-10-18 2021-04-28 한전케이디엔주식회사 Apparatus and method for verifying suitability of code algorithm implementation in real time operating system

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012208830A (en) * 2011-03-30 2012-10-25 Nec Corp Program test device, program test method and program
JP2014021686A (en) * 2012-07-18 2014-02-03 Fujitsu Ltd Test data generation device, program and method
JP2014044678A (en) * 2012-08-28 2014-03-13 Toshiba Corp Compiler evaluation device, method, and program
US10489149B2 (en) 2013-03-22 2019-11-26 International Business Machines Corporation Information processing apparatus, information processing method and program
JP2020144842A (en) * 2019-03-08 2020-09-10 富士通株式会社 Generating inputs for computer-readable program testing
JP7318516B2 (en) 2019-03-08 2023-08-01 富士通株式会社 Generating input for computer readable program inspection
KR20210046363A (en) * 2019-10-18 2021-04-28 한전케이디엔주식회사 Apparatus and method for verifying suitability of code algorithm implementation in real time operating system
KR102269335B1 (en) 2019-10-18 2021-06-24 한전케이디엔주식회사 Apparatus and method for verifying suitability of code algorithm implementation in real time operating system

Similar Documents

Publication Publication Date Title
JP5775829B2 (en) Software structure visualization program and system
CN111104335B (en) C language defect detection method and device based on multi-level analysis
JP6419953B2 (en) Source code equivalence verification apparatus and source code equivalence verification method
JP2007041804A (en) Program generation device, program verification device, and verification program
JP6659955B2 (en) Program analysis method, program analysis device, and analysis program
JP5440287B2 (en) Symbolic execution support program, method and apparatus
JP6559376B2 (en) Test case selection device and test case selection program
JP2009104252A (en) Debugging support device and debugging support method
Van Eijk et al. Detection of equivalent state variables in finite state machine verification
JP6169302B2 (en) Specification configuration apparatus and method
JP2011170749A (en) Simulation device and simulation method
JP2008102831A (en) Information providing device, program and information providing method
JP2006259820A (en) Failure detection improving device, failure detection improving program, and failure detection improving method
JPWO2020194455A1 (en) Test case generator, test case generator, and test case generator
JP5163172B2 (en) Software test item editing support apparatus and software test item editing support method
JP4496006B2 (en) Failure candidate identification system and failure candidate identification method
JP4831375B2 (en) Verification device, verification method, and program
JP6369177B2 (en) Development support program, development support method, and development support apparatus
JPH11224211A (en) Software inspection support device
JP2017041085A (en) Program specification estimation device, estimation method and estimation program
CN102411534A (en) Breakpoint debugging method and debugger
JP2013206310A (en) Model inspection device, model inspection method, and program
JP2007257397A (en) Contention state detection process additional program, contention state detection process adding apparatus and contention state detection process adding method
JP5169322B2 (en) Variable optimization apparatus, variable optimization program, compiler, variable optimization method, and compilation method
US20090235223A1 (en) Program generation apparatus and program generation method