JP2018124654A - Determination program and determination method - Google Patents

Determination program and determination method Download PDF

Info

Publication number
JP2018124654A
JP2018124654A JP2017014504A JP2017014504A JP2018124654A JP 2018124654 A JP2018124654 A JP 2018124654A JP 2017014504 A JP2017014504 A JP 2017014504A JP 2017014504 A JP2017014504 A JP 2017014504A JP 2018124654 A JP2018124654 A JP 2018124654A
Authority
JP
Japan
Prior art keywords
combination
variable
conditional expression
unit
source code
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
JP2017014504A
Other languages
Japanese (ja)
Inventor
田中 大介
Daisuke Tanaka
大介 田中
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.)
Denso Ten Ltd
Original Assignee
Denso Ten Ltd
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 Denso Ten Ltd filed Critical Denso Ten Ltd
Priority to JP2017014504A priority Critical patent/JP2018124654A/en
Publication of JP2018124654A publication Critical patent/JP2018124654A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a determination program and a determination method which can reduce an amount of work of a user.SOLUTION: A determination program reads a source code as an object of a unit test S1, extracts conditional branching contained in the source code S2, determines a setting value of a variable substituted when the unit test is performed, based on a combination of a value that can be taken by a variable contained in a conditional expression of the conditional branching, and a result of determination of the conditional expression S3, and outputs the determined setting value S4.SELECTED DRAWING: Figure 1

Description

本発明は、決定プログラムおよび決定方法に関する。   The present invention relates to a determination program and a determination method.

従来、作成したソースコードが正しく動作するか否かを検査する方法として、ソースコードのユニットごとに検査する単体検査が知られている。単体検査では、例えばテストデータを用いて検査対象であるソースコードをテスト項目ごとに実行することで、ソースコードの欠陥を検査する。   Conventionally, as a method for inspecting whether or not a created source code operates correctly, single unit inspection for inspecting each unit of source code is known. In the unit inspection, for example, the source code to be inspected is executed for each test item using the test data to inspect the source code for defects.

例えば、ソースコードで行うテスト項目を抽出する方法として、当該ソースコードの条件分岐を抽出し、抽出した条件分岐の正否両条件をプログラム入力変数のみで表した式に分解する方法が知られている。   For example, as a method for extracting test items to be performed in source code, a method is known in which a conditional branch of the source code is extracted, and both correct and incorrect conditions of the extracted conditional branch are decomposed into expressions representing only program input variables. .

特開平5−210537号公報JP-A-5-210537

しかしながら、従来の方法では条件分岐の正否両条件をプログラム入力変数で表しているため、プログラム入力変数に代入する値をユーザが設定する必要がある。例えばソースコードの規模が大きくなり、ユーザが設定すべき変数の数が増えるほど、ユーザの作業量が増えてしまう。   However, in the conventional method, both right and wrong conditions of the conditional branch are represented by program input variables, and therefore the user needs to set a value to be substituted for the program input variable. For example, as the size of the source code increases and the number of variables to be set by the user increases, the amount of work for the user increases.

本発明は、上記に鑑みてなされたものであって、ユーザの作業量を削減することができる決定プログラムおよび決定方法を提供することを目的とする。   The present invention has been made in view of the above, and an object of the present invention is to provide a determination program and a determination method that can reduce the amount of work of a user.

上述した課題を解決し、目的を達成するために、本発明に係る決定プログラムは、単体検査の対象であるソースコードを読み込む手順をコンピュータに実行させる。更に決定プログラムは、ソースコードに含まれる条件分岐を抽出する手順をコンピュータに実行させる。更に決定プログラムは、条件分岐の条件式に含まれる変数の取り得る値と、条件式の判定結果と、の組み合わせに基づき、単体検査を行う場合に代入する変数の設定値を決定する手順をコンピュータに実行させる。更に決定プログラムは、決定した設定値を出力する手順をコンピュータに実行させる。   In order to solve the above-described problems and achieve the object, the determination program according to the present invention causes a computer to execute a procedure for reading a source code that is an object of a unit inspection. Further, the determination program causes the computer to execute a procedure for extracting a conditional branch included in the source code. Further, the determination program uses a computer to determine a setting value of a variable to be substituted when performing a single inspection based on a combination of a possible value of a variable included in the conditional expression of the conditional branch and a determination result of the conditional expression. To run. Further, the determination program causes the computer to execute a procedure for outputting the determined setting value.

本発明によれば、ユーザの作業量を削減することができる。   According to the present invention, it is possible to reduce a user's workload.

図1は、実施形態に係る決定方法を説明する図である。FIG. 1 is a diagram illustrating a determination method according to the embodiment. 図2は、実施形態に係る検査装置の構成を示すブロック図である。FIG. 2 is a block diagram illustrating a configuration of the inspection apparatus according to the embodiment. 図3は、実施形態に係るソースコードの一例を示す図である。FIG. 3 is a diagram illustrating an example of source code according to the embodiment. 図4は、実施形態に係る変数情報を説明する図である。FIG. 4 is a diagram illustrating variable information according to the embodiment. 図5Aは、実施形態に係る組み合わせ生成部が生成する組み合わせテーブルの一例を示す図である。FIG. 5A is a diagram illustrating an example of a combination table generated by the combination generation unit according to the embodiment. 図5Bは、実施形態に係る重複除去部が生成する設定値テーブルを示す図である。FIG. 5B is a diagram illustrating a setting value table generated by the deduplication unit according to the embodiment. 図6は、実施形態に係る組み合わせ生成部が生成する組み合わせテーブルの一例を示す図である。FIG. 6 is a diagram illustrating an example of a combination table generated by the combination generation unit according to the embodiment. 図7Aは、実施形態に係る組み合わせ生成部が生成する組み合わせテーブルの一例を示す図である。FIG. 7A is a diagram illustrating an example of a combination table generated by the combination generation unit according to the embodiment. 図7Bは、実施形態に係る重複除去部が生成する設定値テーブルの一例を示す図である。FIG. 7B is a diagram illustrating an example of a setting value table generated by the duplication removal unit according to the embodiment. 図8Aは、実施形態に係るソースコードの一例を示す図である。FIG. 8A is a diagram illustrating an example of source code according to the embodiment. 図8Bは、実施形態に係る組み合わせ生成部が生成する組み合わせテーブルの一例を示す図である。FIG. 8B is a diagram illustrating an example of a combination table generated by the combination generation unit according to the embodiment. 図9は、実施形態に係るソースコードの一例を示す図である。FIG. 9 is a diagram illustrating an example of source code according to the embodiment. 図10は、実施形態に係るソースコードの一例を示す図である。FIG. 10 is a diagram illustrating an example of source code according to the embodiment. 図11Aは、実施形態に係るソースコードの一例を示す図である。FIG. 11A is a diagram illustrating an example of source code according to the embodiment. 図11Bは、実施形態に係る組み合わせ生成部が生成する組み合わせテーブルの一例を示す図である。FIG. 11B is a diagram illustrating an example of a combination table generated by the combination generation unit according to the embodiment. 図11Cは、実施形態に係る重複除去部が生成するテーブルの一例を示す図である。FIG. 11C is a diagram illustrating an example of a table generated by the deduplication unit according to the embodiment. 図11Dは、実施形態に係る重複除去部が生成するテーブルの一例を示す図である。FIG. 11D is a diagram illustrating an example of a table generated by the deduplication unit according to the embodiment. 図11Eは、実施形態に係る重複除去部が生成する設定値テーブルの一例を示す図である。FIG. 11E is a diagram illustrating an example of a setting value table generated by the duplication removal unit according to the embodiment. 図12は、実施形態に係る検査装置が実行する決定処理の処理手順を示すフローチャートである。FIG. 12 is a flowchart illustrating a processing procedure of determination processing executed by the inspection apparatus according to the embodiment. 図13は、実施形態の変形例に係る組み合わせ生成部が生成する組み合わせテーブルの一例を示す図である。FIG. 13 is a diagram illustrating an example of a combination table generated by the combination generation unit according to the modification of the embodiment.

以下、添付図面を参照して、本願の開示する決定プログラムおよび決定方法の実施形態を詳細に説明する。なお、この実施形態により本発明が限定されるものではない。   Hereinafter, embodiments of a determination program and a determination method disclosed in the present application will be described in detail with reference to the accompanying drawings. In addition, this invention is not limited by this embodiment.

(1.決定方法)
図1を用いて、実施形態に係る決定方法について説明する。図1は、実施形態に係る決定方法を説明する図である。実施形態に係る決定方法は、ソースコードの単体検査を行う場合にソースコードに含まれる変数に代入(設定)する設定値を決定する方法であり、例えば単体検査を行う検査装置で実行されるものとする。
(1. Determination method)
The determination method according to the embodiment will be described with reference to FIG. FIG. 1 is a diagram illustrating a determination method according to the embodiment. The determination method according to the embodiment is a method for determining a setting value to be assigned (set) to a variable included in the source code when performing a single inspection of the source code. And

ここで、ソースコードの単体検査とは、テストデータを用いてモジュールごとにソースコードを実行することで、ソースコードに不備がないか確認する検査のことである。単体検査には、例えば条件分岐で正しく処理が分岐するか否かを確認する検査が含まれる。かかる検査では、条件分岐の条件式に含まれる変数に取り得る値を設定することで、正しく条件分岐が行われるか否かが検査される。   Here, the single inspection of the source code is an inspection for checking whether the source code is incomplete by executing the source code for each module using the test data. The single inspection includes, for example, an inspection for confirming whether or not the process branches correctly in the conditional branch. In such a check, it is checked whether or not the conditional branch is correctly performed by setting a possible value for the variable included in the conditional expression of the conditional branch.

したがって、テストデータには、例えば条件式に含まれる変数の設定値が含まれる。変数が複数の設定値を取り得る場合、取り得る全ての設定値に対して単体検査が行われるように、テストデータを生成する。   Therefore, the test data includes, for example, set values of variables included in the conditional expression. When a variable can take a plurality of setting values, test data is generated so that a single inspection is performed for all possible setting values.

このとき、条件式に複数の変数が含まれる場合は、複数の変数の取り得る値を組み合わせてテストデータを生成する。したがって、例えば、ソースコードの規模が大きくなり、ソースコードに含まれる変数の数が増加すると、複数の変数の設定値の組み合わせ数が増加する。そのため、検査を行う人間(ユーザ)がテストデータを生成すると、作業量が増加するとともに、かかる組み合わせに漏れが発生してしまう可能性がある。   At this time, when a plurality of variables are included in the conditional expression, test data is generated by combining possible values of the plurality of variables. Therefore, for example, when the size of the source code increases and the number of variables included in the source code increases, the number of combinations of setting values of a plurality of variables increases. For this reason, when a person (user) who performs inspection generates test data, the amount of work increases and there is a possibility that such a combination may be leaked.

そこで、実施形態に係る決定方法では、ソースコード中の条件分岐の条件式に含まれる変数を抽出し、抽出した変数の取り得る値の組み合わせに基づいて、テストデータを生成するようにした。   Therefore, in the determination method according to the embodiment, variables included in the conditional expression of the conditional branch in the source code are extracted, and test data is generated based on combinations of values that can be taken by the extracted variables.

これにより、検査装置が自動でテストデータを生成することができ、ユーザの作業量を削減することができるとともに、単体検査の漏れを抑制することができる。   As a result, the inspection apparatus can automatically generate test data, the amount of work for the user can be reduced, and leakage of a single inspection can be suppressed.

以下、図1を用いて、テストデータとして変数の設定値を決定する決定方法について具体的に説明する。   Hereinafter, a determination method for determining a set value of a variable as test data will be specifically described with reference to FIG.

図1に示すように、検査装置は、まず検査対象であるC言語で記載されたソースコードを読み込む(ステップS1)。図1では、プリプロセッサ指令の条件分岐を示す「#if」を含むソースコード31を読み込むものとする。   As shown in FIG. 1, the inspection apparatus first reads a source code written in C language to be inspected (step S1). In FIG. 1, it is assumed that a source code 31 including “#if” indicating a conditional branch of a preprocessor command is read.

次に、検査装置は、ソースコード31に含まれる条件分岐を抽出する(ステップS2)。図1の例では、「#if (A==USE)&&(B==USE)」を抽出する。   Next, the inspection device extracts a conditional branch included in the source code 31 (step S2). In the example of FIG. 1, “#if (A == USE) && (B == USE)” is extracted.

検査装置は、抽出した条件分岐の条件式の取り得る値と条件式の判定結果との組み合わせに基づいて条件式に含まれる変数の設定値を決定する(ステップS3)。   The inspection apparatus determines the set value of the variable included in the conditional expression based on the combination of the possible value of the extracted conditional expression of the conditional branch and the determination result of the conditional expression (step S3).

図1に示す条件分岐の条件式「(A==USE)&&(B==USE)」は、2つの条件式の論理積で表されている。ここで、条件分岐の条件式を条件式cと記載する。また、条件式cの論理演算子「&&」の左辺の条件式「A==USE」を条件式a、右辺の条件式「B==USE」を条件式bと記載する。また、条件式aには変数Aが含まれており、条件式bには変数Bが含まれている。なお、ここでは、変数A、Bの取り得る値が「USE」、「NOT」、「OTHER」の3つであるとして説明する。   The conditional expression “(A == USE) && (B == USE)” of the conditional branch shown in FIG. 1 is expressed by a logical product of two conditional expressions. Here, the conditional expression for conditional branching is referred to as conditional expression c. Also, the conditional expression “A == USE” on the left side of the logical operator “&&” of the conditional expression c is referred to as a conditional expression a, and the conditional expression “B == USE” on the right side is referred to as a conditional expression b. The conditional expression a includes a variable A, and the conditional expression b includes a variable B. Here, description will be made assuming that there are three possible values of the variables A and B: “USE”, “NOT”, and “OTHER”.

検査装置は、条件式cに含まれる変数A、Bの設定値を決定するために、まず変数A、Bの取り得る値および各条件式a〜cの判定結果の組み合わせテーブル33aを生成する。例えば、変数Aが「USE」、変数Bが「USE」である場合、条件式a(A==USE)の判定結果はTRUE(図1では「T」と記載)になり、条件式b(B==USE)の判定結果もTRUEになる。したがって、条件式a、bの論理積である条件式cの判定結果はTRUEになる。   In order to determine the set values of the variables A and B included in the conditional expression c, the inspection apparatus first generates a combination table 33a of values that the variables A and B can take and the determination results of the conditional expressions a to c. For example, when the variable A is “USE” and the variable B is “USE”, the determination result of the conditional expression a (A == USE) is TRUE (described as “T” in FIG. 1), and the conditional expression b ( The determination result of B == USE) is also TRUE. Therefore, the determination result of conditional expression c, which is the logical product of conditional expressions a and b, is TRUE.

検査装置は、変数A、Bの取り得る値の組み合わせを変えながら各条件式a〜cの判定を行い、変数A、Bの取り得る値と、各条件式a〜cの判定結果との組み合わせテーブル33aを生成する。変数A、Bはともに3つの設定値を取り得るため、組み合わせ数は3×3=9通りとなる。   The inspection apparatus determines the conditional expressions a to c while changing combinations of values that the variables A and B can take, and combines the values that the variables A and B can take and the determination results of the conditional expressions a to c. A table 33a is generated. Since both variables A and B can take three set values, the number of combinations is 3 × 3 = 9.

検査装置は、生成した組み合わせテーブル33aに基づき、単体検査を行う場合に設定する設定値の組み合わせを決定する。   Based on the generated combination table 33a, the inspection apparatus determines a combination of setting values to be set when performing a single inspection.

ここで、変数A、Bの取り得る値の組み合わせ全てについて単体検査を行うとすると、組み合わせ数が多くなり、検査に時間がかかってしまう場合がある。例えば、変数の数が多い場合や、変数の取り得る値の数が多い場合、検査数が多くなり検査にかかる時間が長くなる。   Here, if the unit inspection is performed for all combinations of values that the variables A and B can take, the number of combinations increases, and the inspection may take time. For example, when the number of variables is large or the number of values that the variable can take is large, the number of inspections increases and the time required for the inspections increases.

そこで、検査装置は、例えば組み合わせテーブル33aの中から検査不要な組み合わせを除外して、検査時に設定する設定値の組み合わせを決定し設定値テーブル33を生成する。   Therefore, for example, the inspection apparatus excludes combinations that do not require inspection from the combination table 33a, determines a combination of setting values to be set at the time of inspection, and generates the setting value table 33.

例えば、変数A、Bの取り得る値の組み合わせには、検査対象のソースコードでは組み合わせられない組み合わせが含まれる。具体的には、例えば、ある変数Cが車両の種類を表し、別の変数Dがトランスミッションの種類を表しているものとする。このとき、ある車種Sのトランスミッションがオートマチックトランスミッション(AT)のみであり、マニュアルトランスミッション(MT)がないとする。この場合、変数C==S、変数D==MTの組み合わせは、車種Sの車両で実行されるソースコードでは組み合わせられない組み合わせとなる。このように、変数の取り得る値によっては、実際には組み合わせられない場合がある。実際にはソースコード上で組み合わせることがない組み合わせについて単体検査を行うと、検査数が無駄に増加し、検査時間が長くなってしまう。   For example, combinations of values that the variables A and B can take include combinations that cannot be combined in the source code to be inspected. Specifically, for example, it is assumed that a certain variable C represents the type of vehicle and another variable D represents the type of transmission. At this time, it is assumed that the transmission of a certain vehicle type S is only an automatic transmission (AT) and no manual transmission (MT). In this case, the combination of the variable C == S and the variable D == MT is a combination that cannot be combined in the source code executed on the vehicle of the vehicle type S. In this way, depending on the values that the variables can take, they may not actually be combined. If a single inspection is performed on combinations that are not actually combined on the source code, the number of inspections increases unnecessarily, and the inspection time becomes longer.

そこで、検査装置は、組み合わせられない変数の設定値の組み合わせでは単体検査を行わないとして、かかる組み合わせを除外する。例えば、変数Aが「NOT」であり、変数Bが「OTHER」である組み合わせが、ソースコード上で許容されない組み合わせであるとする。すなわち、図1に示す組み合わせテーブル33aの9行目の組み合わせが許容されない場合、検査装置はかかる9行目の組み合わせを単体検査時の設定値の組み合わせから除外する。   Therefore, the inspection apparatus excludes such combinations by assuming that a single inspection is not performed for combinations of set values of variables that cannot be combined. For example, a combination in which the variable A is “NOT” and the variable B is “OTHER” is a combination that is not allowed in the source code. That is, when the combination of the ninth line in the combination table 33a shown in FIG. 1 is not allowed, the inspection apparatus excludes the combination of the ninth line from the set value combinations during the single inspection.

また、検査装置は、条件式cの判定後の処理が重複する変数A、Bの組み合わせを除外する。これは、組み合わせテーブル33aの中には、変数の設定値にかかわらず同じ処理を行う組み合わせが含まれることがあるためである。   In addition, the inspection apparatus excludes the combination of variables A and B in which the processing after the determination of conditional expression c is duplicated. This is because the combination table 33a may include combinations that perform the same processing regardless of the set value of the variable.

例えば条件式cに2つの条件式a、bが含まれる場合、左の条件式aから順に条件判定を行う。そのため、条件式aが不成立(FALSE、図1では「F」と記載)の場合、条件式bの判定結果にかかわらず条件式cは不成立となりソースコード31の処理P1は実行されない。なお、例えば、図1の組み合わせテーブル33aでは、2、3、5、6、8、9行目の組み合わせで、変数Bの値にかかわらず、いずれも条件式cがFとなっている。   For example, when the conditional expression c includes two conditional expressions a and b, the condition determination is performed in order from the left conditional expression a. Therefore, when the conditional expression a is not satisfied (FALSE, described as “F” in FIG. 1), the conditional expression c is not satisfied regardless of the determination result of the conditional expression b, and the process P1 of the source code 31 is not executed. For example, in the combination table 33a of FIG. 1, the conditional expression c is F regardless of the value of the variable B in the combinations of the second, third, fifth, sixth, eighth, and ninth rows.

このように、条件式aがF(不成立)となった場合、条件式bの正否、すなわち変数Bの値は、条件式cの判定結果に影響を与えない。したがって、例えば条件式aがFとなる検査を少なくとも一度行えば、その他の条件式aがFとなる検査を省略しても単体検査の精度に影響を与えない。   Thus, when the conditional expression a is F (not established), whether the conditional expression b is right or wrong, that is, the value of the variable B does not affect the determination result of the conditional expression c. Therefore, for example, if the inspection in which the conditional expression a is F is performed at least once, even if the inspection in which the other conditional expression a is F is omitted, the accuracy of the single inspection is not affected.

そこで、検査装置は、図1の組み合わせテーブル33aの中から、5、6、8および9行目の組み合わせを除外して設定値の組み合わせを決定する。なお、検査装置は、変数A、Bの取り得る値が、それぞれ少なくとも1回は設定されるように設定値を決定する。したがって、検査装置は、変数Aが「OTHER」である場合の単体検査を行うために、図1の組み合わせテーブル33aの3行目の組み合わせは除外しない。このように、検査装置は、図1の設定値テーブル33に示すように5つの組み合わせを、単体検査を行う場合の変数A、Bの設定値の組み合わせに決定する。   Therefore, the inspection apparatus determines a combination of setting values by excluding the combinations of the fifth, sixth, eighth, and ninth lines from the combination table 33a of FIG. Note that the inspection apparatus determines the setting values so that the values that the variables A and B can take are each set at least once. Therefore, the inspection apparatus does not exclude the combination in the third row of the combination table 33a in FIG. 1 in order to perform a single inspection when the variable A is “OTHER”. As described above, the inspection apparatus determines the five combinations as the combination of the setting values of the variables A and B when performing the single inspection as shown in the setting value table 33 of FIG.

検査装置は、決定した設定値の組み合わせを例えば図示しない記憶部に出力する(ステップS4)。   The inspection apparatus outputs the determined set value combination to, for example, a storage unit (not shown) (step S4).

このように、検査装置が実施形態に係る決定方法を実行することで、ソースコードに含まれる変数の設定値を自動で決定することができ、ユーザの作業量を削減することができる。また、ユーザが設定値を設定する場合に比べて、設定漏れを抑制することができる。   As described above, when the inspection apparatus executes the determination method according to the embodiment, the setting value of the variable included in the source code can be automatically determined, and the amount of work of the user can be reduced. Further, setting omission can be suppressed as compared with the case where the user sets the set value.

さらに、検査装置は、検査対象のソースコードでは組み合わせられない組み合わせや、条件式cの判定結果に影響しない変数Bの値を含む組み合わせを除外して、設定値の組み合わせを決定する。   Further, the inspection apparatus determines combinations of set values by excluding combinations that cannot be combined in the source code to be inspected and combinations that include the value of the variable B that does not affect the determination result of the conditional expression c.

これにより、検査装置は、単体検査の検査数を低減することができる。例えば図1では、変数A、Bの取り得る値の組み合わせ全てで検査を行う場合、9通りの検査を行わなければならないが、検査装置が所定の組み合わせを除外して、設定値の組み合わせ数を5つに減らすことで、検査数を5に削減することができる。   Thereby, the inspection apparatus can reduce the number of inspections of the single inspection. For example, in FIG. 1, when inspection is performed with all possible combinations of values of variables A and B, nine inspections must be performed. However, the inspection apparatus excludes predetermined combinations and sets the number of combinations of set values. By reducing the number to five, the number of inspections can be reduced to five.

(2.検査装置)
以下、検査装置1の構成例について、図2〜図12を参照して説明する。図2は、実施形態に係る検査装置1の構成を示すブロック図である。なお、図2では、実施形態の特徴を説明するために必要な構成要素のみを機能ブロックで表しており、一般的な構成要素についての記載を省略している。
(2. Inspection device)
Hereinafter, a configuration example of the inspection apparatus 1 will be described with reference to FIGS. FIG. 2 is a block diagram illustrating a configuration of the inspection apparatus 1 according to the embodiment. In FIG. 2, only constituent elements necessary for describing the features of the embodiment are represented by functional blocks, and descriptions of general constituent elements are omitted.

換言すれば、図2に図示される各構成要素は機能概念的なものであり、必ずしも物理的に図示の如く構成されていることを要しない。例えば、各機能ブロックの分散・統合の具体的形態は図示のものに限られず、その全部または一部を、各種の負荷や使用状況などに応じて、任意の単位で機能的または物理的に分散・統合して構成することが可能である。   In other words, each component illustrated in FIG. 2 is functionally conceptual and does not necessarily need to be physically configured as illustrated. For example, the specific form of distribution / integration of each functional block is not limited to the one shown in the figure, and all or a part thereof is functionally or physically distributed in arbitrary units according to various loads or usage conditions.・ It can be integrated and configured.

実施形態に係る検査装置1は、決定部10と、検査部20と、記憶部30とを備える。決定部10は、読込部110と、抽出部120と、設定値決定部130と、出力部140と、を備える。記憶部30は、ソースコード31、変数情報32、設定値テーブル33を記憶する。   The inspection device 1 according to the embodiment includes a determination unit 10, an inspection unit 20, and a storage unit 30. The determination unit 10 includes a reading unit 110, an extraction unit 120, a set value determination unit 130, and an output unit 140. The storage unit 30 stores a source code 31, variable information 32, and a setting value table 33.

ここで、検査装置1は、例えば、CPU(Central Processing Unit)、ROM(Read Only Memory)、RAM(Random Access Memory)、HDD(Hard Disk Drive)、入出力ポートなどを有するコンピュータや各種の回路を含む。   Here, the inspection apparatus 1 includes, for example, a computer having a central processing unit (CPU), a read only memory (ROM), a random access memory (RAM), a hard disk drive (HDD), an input / output port, and various circuits. Including.

コンピュータのCPUは、例えば、ROMに記憶された決定プログラムを読み出して実行することによって、決定部10の読込部110、抽出部120、設定値決定部130および出力部140として機能する。また、コンピュータのCPUは、例えばROMに記憶された検査プログラムを読み出して実行することによって、検査部20として機能する。   The CPU of the computer functions as the reading unit 110, the extracting unit 120, the setting value determining unit 130, and the output unit 140 of the determining unit 10, for example, by reading and executing the determining program stored in the ROM. The CPU of the computer functions as the inspection unit 20 by reading and executing an inspection program stored in the ROM, for example.

また、記憶部30は、たとえば、RAMやHDDに対応する。RAMやHDDは、ソースコード31、変数情報32、設定値テーブル33、決定プログラムや検査プログラム等の各種プログラムに関する情報等を記憶することができる。なお、検査装置1は、有線や無線のネットワークで接続された他のコンピュータや可搬型記録媒体を介して上記したプログラムや各種情報を取得することとしてもよい。   The storage unit 30 corresponds to, for example, a RAM or an HDD. The RAM and HDD can store source code 31, variable information 32, setting value table 33, information on various programs such as a determination program and an inspection program, and the like. Note that the inspection apparatus 1 may acquire the above-described program and various types of information via another computer or a portable recording medium connected via a wired or wireless network.

(2.1.決定部)
決定部10は、単体検査を行う場合に条件分岐の条件式に含まれる変数に設定する設定値の組み合わせを決定する。決定部10は、上述したように、読込部110と、抽出部120と、設定値決定部130と、出力部140と、を備える。
(2.1. Deciding part)
The determination unit 10 determines a combination of setting values to be set in variables included in the conditional expression of the conditional branch when performing a single inspection. As described above, the determination unit 10 includes the reading unit 110, the extraction unit 120, the setting value determination unit 130, and the output unit 140.

なお、ここでは、決定部10がC言語で記載されたソースコード31の変数の設定値を決定する場合について説明するがソースコード31に用いられるプログラミング言語はC言語に限定されない。例えばソースコード31がFORTRAN等の他のプログラミング言語で記載されていてもよい。   Here, the case where the determination unit 10 determines the setting value of the variable of the source code 31 written in the C language will be described, but the programming language used for the source code 31 is not limited to the C language. For example, the source code 31 may be described in another programming language such as FORTRAN.

また、ここでは、ソースコード31のプリプロセス実行時に決定部10がソースコード31に含まれるプリプロセッサ指令の条件分岐を抽出するものとするが、これに限定されない。例えば、決定部10が抽出する条件分岐はプリプロセッサ指令以外の条件分岐であってもよい。また、プリプロセス実行時以外であっても、決定部10が設定値を決定するために条件分岐を抽出するようにしてもよい。   Here, it is assumed that the determination unit 10 extracts the conditional branch of the preprocessor command included in the source code 31 when the source code 31 is preprocessed. However, the present invention is not limited to this. For example, the conditional branch extracted by the determination unit 10 may be a conditional branch other than the preprocessor command. Even when the preprocess is not performed, the determination unit 10 may extract a conditional branch in order to determine the set value.

(2.1.1.読込部)
読込部110は、記憶部30から検査対象であるソースコード31および変数情報32を読み出す。読込部110は読み出したソースコード31を抽出部120に出力する。また、読込部110は読み出した変数情報32を設定値決定部130に出力する。
(2.1.1. Reading part)
The reading unit 110 reads the source code 31 and variable information 32 to be inspected from the storage unit 30. The reading unit 110 outputs the read source code 31 to the extraction unit 120. Further, the reading unit 110 outputs the read variable information 32 to the set value determining unit 130.

(2.1.2.抽出部)
抽出部120は、読込部110からソースコード31を受け取ると、ソースコード31から条件分岐の条件式や変数等、後段の設定値決定部130で変数の値を設定するために必要な情報を抽出する。抽出部120は、分岐抽出部121と、変数抽出部122と、定義抽出部123と、を備える。
(2.1.2. Extraction unit)
When the extraction unit 120 receives the source code 31 from the reading unit 110, the extraction unit 120 extracts information necessary for setting the value of the variable by the setting value determination unit 130 in the subsequent stage, such as a conditional expression or a variable of the conditional branch from the source code 31. To do. The extraction unit 120 includes a branch extraction unit 121, a variable extraction unit 122, and a definition extraction unit 123.

(2.1.2.1.分岐抽出部)
分岐抽出部121は、ソースコード31から条件分岐を抽出する。例えば、読込部110が図3に示すソースコード31を読み込んだ場合、分岐抽出部121は、条件分岐「#if(A==USE)||(B==USE)」を抽出する。このように、分岐抽出部121は、ソースコード31に含まれる条件分岐に関する指令「#if」や「#else」、「#elif」等を検出することで、ソースコード31に含まれる条件分岐を抽出する。なお、図3は、実施形態に係るソースコード31の一例を示す図である。
(2.1.2.1. Branch extraction unit)
The branch extraction unit 121 extracts a conditional branch from the source code 31. For example, when the reading unit 110 reads the source code 31 shown in FIG. 3, the branch extraction unit 121 extracts a conditional branch “#if (A == USE) || (B == USE)”. In this way, the branch extraction unit 121 detects the conditional branch included in the source code 31 by detecting the commands “#if”, “#else”, “#elif”, etc. relating to the conditional branch included in the source code 31. Extract. FIG. 3 is a diagram illustrating an example of the source code 31 according to the embodiment.

分岐抽出部121は、抽出した条件分岐を変数抽出部122に出力する。   The branch extraction unit 121 outputs the extracted conditional branch to the variable extraction unit 122.

なお、ここでは、分岐抽出部121が条件分岐を1つ抽出する例について説明したが、分岐抽出部121が抽出する条件分岐の数は1つに限定されない。分岐抽出部121は、例えばソースコード31に含まれる条件分岐を全て抽出する。ソースコード31に複数の条件分岐が含まれる場合、分岐抽出部121は、複数の条件分岐を抽出する。   Here, an example in which the branch extraction unit 121 extracts one conditional branch has been described, but the number of conditional branches extracted by the branch extraction unit 121 is not limited to one. For example, the branch extraction unit 121 extracts all conditional branches included in the source code 31. When the source code 31 includes a plurality of conditional branches, the branch extraction unit 121 extracts a plurality of conditional branches.

(2.1.2.2.変数抽出部)
変数抽出部122は、分岐抽出部121が抽出した条件分岐の条件式に含まれる変数を抽出する。変数抽出部122は、条件式に含まれる関係演算子の左辺のオペランドを変数として抽出する。例えば図3のソースコード31の場合、変数抽出部122は、変数A、Bを抽出する。
(2.1.2.2. Variable extraction unit)
The variable extraction unit 122 extracts variables included in the conditional expression of the conditional branch extracted by the branch extraction unit 121. The variable extraction unit 122 extracts the left operand of the relational operator included in the conditional expression as a variable. For example, in the case of the source code 31 in FIG. 3, the variable extraction unit 122 extracts variables A and B.

変数抽出部122は、抽出した変数A、Bを定義抽出部123に出力する。   The variable extraction unit 122 outputs the extracted variables A and B to the definition extraction unit 123.

(2.1.2.3.定義抽出部)
定義抽出部123は、変数抽出部122が抽出した変数A、Bの定義をソースコード31から抽出する。定義抽出部123は、例えば変数A、Bの取り得る値を抽出する。ここでは、定義抽出部123は、変数A、Bの取り得る値として「USE」、「NOT」、「OTHER」の3つを抽出するものとする。
(2.1.2.3. Definition Extraction Unit)
The definition extraction unit 123 extracts the definitions of the variables A and B extracted by the variable extraction unit 122 from the source code 31. The definition extraction unit 123 extracts possible values of the variables A and B, for example. Here, it is assumed that the definition extraction unit 123 extracts three values “USE”, “NOT”, and “OTHER” as possible values of the variables A and B.

定義抽出部123は、変数A、Bおよびかかる変数A、Bの取り得る値を設定値決定部130に出力する。   The definition extraction unit 123 outputs the variables A and B and the possible values of the variables A and B to the set value determination unit 130.

なお、ここでは変数A、Bの取り得る値を文字列としているが、これに限定されない。例えば変数A、Bが「0」、「1」、「2」などの整数であってもよい。また、ここでは、定義抽出部123がソースコード31から変数A、Bの取り得る値を抽出するとしたが、これに限定されない。定義抽出部123が、例えば変数A、Bごとに取り得る値を予め定義した定義情報に基づいて変数A、Bの取り得る値を抽出してもよい。なお、定義情報は例えば記憶部30に記憶される。   In addition, although the value which the variable A and B can take here is made into the character string here, it is not limited to this. For example, the variables A and B may be integers such as “0”, “1”, and “2”. Here, the definition extraction unit 123 extracts the possible values of the variables A and B from the source code 31, but the present invention is not limited to this. The definition extraction unit 123 may extract the possible values of the variables A and B based on the definition information in which the possible values for each of the variables A and B are defined in advance. The definition information is stored in the storage unit 30, for example.

また、ここでは、分岐抽出部121および変数抽出部122が条件分岐および変数A、Bを抽出してから変数A、Bの取り得る値を抽出するとしたが、これに限定されない。例えば、分岐抽出部121が条件分岐を抽出する前に、定義抽出部123がソースコード31に含まれる変数の定義情報を抽出するようにしてもよい。この場合、定義抽出部123は、抽出した定義情報に基づき、変数抽出部122が抽出した変数A、Bの取り得る値を決定するものとする。   Here, the branch extraction unit 121 and the variable extraction unit 122 extract the conditional branch and the variables A and B, and then extract the possible values of the variables A and B. However, the present invention is not limited to this. For example, the definition extraction unit 123 may extract variable definition information included in the source code 31 before the branch extraction unit 121 extracts a conditional branch. In this case, the definition extraction unit 123 determines possible values of the variables A and B extracted by the variable extraction unit 122 based on the extracted definition information.

(2.1.3.設定値決定部)
設定値決定部130は、抽出部120が抽出した変数(図3の例では変数A、B)の取り得る値および条件式の判定結果の組み合わせに基づき、単体検査を行う場合に変数に設定する値(設定値)を決定する。設定値決定部130は、組み合わせ生成部131と、禁止除去部132と、重複除去部133とを備える。
(2.1.3. Setting value determination unit)
The set value determination unit 130 sets a variable when performing a unit test based on a combination of the values extracted by the extraction unit 120 (variables A and B in the example of FIG. 3) and the determination result of the conditional expression. Determine the value (setting value). The set value determination unit 130 includes a combination generation unit 131, a prohibition removal unit 132, and a duplication removal unit 133.

(2.1.3.1.組み合わせ生成部)
組み合わせ生成部131は、抽出部120が抽出した変数の取り得る値および条件分岐の条件式の判定結果の組み合わせを含む組み合わせテーブルを生成する。組み合わせ生成部131は、生成した組み合わせを禁止除去部132に出力する。なお、組み合わせ生成部131による組み合わせの生成例については、図5A、図6等を用いて後述する。
(2.1.3.1. Combination generation unit)
The combination generation unit 131 generates a combination table including combinations of possible values of variables extracted by the extraction unit 120 and determination results of conditional expressions for conditional branches. The combination generation unit 131 outputs the generated combination to the prohibition removal unit 132. An example of generating a combination by the combination generation unit 131 will be described later with reference to FIGS. 5A and 6.

(2.1.3.2.禁止除去部)
禁止除去部132は、組み合わせ生成部131が生成した変数の取り得る値の組み合わせのうち、ソースコード31を実行する場合に組み合わせられない、すなわち組み合わせが禁止されている組み合わせを除外する。
(2.1.3.2. Prohibited removal part)
The prohibition removing unit 132 excludes combinations that are not combined when the source code 31 is executed, that is, combinations that are prohibited from being combined, among combinations of values that the variable generated by the combination generation unit 131 can take.

禁止除去部132は、読込部110が読み込んだ変数情報32に基づいて禁止されている組み合わせを除外する。図4に示すように、変数情報32は、変数A、Bの組み合わせの可否を示すテーブルである。なお、図4は、実施形態に係る変数情報32を説明する図である。図4では、ソースコード31を実行する場合に組み合わせられる変数A、Bの組を「○」で表し、組み合わせられない変数A、Bの組を「×」で表している。   The prohibition removing unit 132 excludes combinations that are prohibited based on the variable information 32 read by the reading unit 110. As shown in FIG. 4, the variable information 32 is a table indicating whether or not a combination of variables A and B is possible. FIG. 4 is a diagram illustrating the variable information 32 according to the embodiment. In FIG. 4, a combination of variables A and B that are combined when executing the source code 31 is represented by “◯”, and a combination of variables A and B that cannot be combined is represented by “×”.

例えば、図4では、変数Aが「OTHER」であり、変数Bが「OTHER」である組み合わせが「×」になっている。この場合、禁止除去部132は、変数Aが「OTHER」であり、変数Bが「OTHER」である組み合わせを、組み合わせ生成部131が生成した組み合わせテーブルから除去する。   For example, in FIG. 4, the combination where the variable A is “OTHER” and the variable B is “OTHER” is “x”. In this case, the prohibition removal unit 132 removes the combination in which the variable A is “OTHER” and the variable B is “OTHER” from the combination table generated by the combination generation unit 131.

なお、ここでは、禁止除去部132が、組み合わせ生成部131が生成した組み合わせテーブルから組み合わせが禁止されている組み合わせを除去するとしたが、これに限定されない。例えば、組み合わせ生成部131が、変数情報32を参照して禁止されている組み合わせを除いて組み合わせテーブルを生成するようにしてもよい。これにより、禁止除去部132が行う処理を省略することができる。   In this example, the prohibition removal unit 132 removes the combination for which the combination is prohibited from the combination table generated by the combination generation unit 131. However, the present invention is not limited to this. For example, the combination generation unit 131 may generate a combination table by excluding combinations that are prohibited by referring to the variable information 32. Thereby, the process which the prohibition removal part 132 performs can be abbreviate | omitted.

また、ここでは、禁止除去部132が記憶部30に記憶される変数情報32に基づいて除去する組み合わせを決定するとしたが、これに限定されない。例えばソースコード31に組み合わせを禁止する記載がある場合、禁止除去部132がかかる記載に基づいて組み合わせテーブルから除去するようにしてもよい。例えば、変数Aが「OTHER」であり、かつ、変数Bが「OTHER」である場合にエラーとなる記載がソースコード31に含まれている場合、禁止除去部132が、変数Aが「OTHER」であり、変数Bが「OTHER」である組み合わせを除去するようにしてもよい。   Here, the prohibition removal unit 132 determines the combination to be removed based on the variable information 32 stored in the storage unit 30, but is not limited thereto. For example, if the source code 31 includes a description prohibiting the combination, the prohibition removing unit 132 may remove the combination from the combination table based on the description. For example, when the variable A is “OTHER” and the source code 31 includes a description that causes an error when the variable B is “OTHER”, the prohibition removing unit 132 determines that the variable A is “OTHER”. And combinations where the variable B is “OTHER” may be removed.

(2.1.3.3.重複除去部)
重複除去部133は、条件式の判定後の処理が重複する変数の組み合わせを、組み合わせ生成部131が生成した組み合わせテーブルから除去し、単体検査に用いる変数の設定値を決定する。重複除去部133は、決定した設定値を含む設定値テーブル33を出力部140に出力する。
(2.1.2.3. Deduplication unit)
The duplicate removal unit 133 removes the combination of variables that are duplicated in the processing after the conditional expression determination from the combination table generated by the combination generation unit 131, and determines the setting value of the variable used for the unit test. The duplicate removal unit 133 outputs the setting value table 33 including the determined setting value to the output unit 140.

以下、図5A〜図11Eを用いて、組み合わせ生成部131が生成する組み合わせテーブルおよび重複除去部133が除去する変数の組み合わせについて条件式の演算子ごとに説明する。なお、説明を簡略化するために、禁止除去部132による組み合わせの除去は行われない、すなわち禁止される組み合わせはないものとして説明する。   Hereinafter, the combination of the combination table generated by the combination generation unit 131 and the variable removed by the duplication removal unit 133 will be described for each operator of the conditional expression with reference to FIGS. 5A to 11E. In order to simplify the description, it is assumed that the combination removal by the prohibition removal unit 132 is not performed, that is, there is no prohibited combination.

(a.#if文)
まず、図5A〜図8Bを用いて、条件分岐に含まれるプリプロセッサ指令が「#if」である場合について説明する。
(A. #If statement)
First, the case where the preprocessor instruction included in the conditional branch is “#if” will be described with reference to FIGS. 5A to 8B.

(a−1.比較演算子:等号)
図5Aおよび図5Bを用いて、条件分岐(#if)の条件式に含まれる演算子が等号(==)である場合について説明する。図5Aは、実施形態に係る組み合わせ生成部131が生成する組み合わせテーブル33a_1の一例を示す図である。また、図5Bは、実施形態に係る重複除去部133が生成する設定値テーブル33_1を示す図である。
(A-1. Comparison operator: equal sign)
A case where the operator included in the conditional expression of the conditional branch (#if) is an equal sign (==) will be described with reference to FIGS. 5A and 5B. FIG. 5A is a diagram illustrating an example of the combination table 33a_1 generated by the combination generation unit 131 according to the embodiment. FIG. 5B is a diagram illustrating a setting value table 33_1 generated by the duplication removal unit 133 according to the embodiment.

分岐抽出部121が抽出した条件分岐が「#if A==USE」であったとする。以下、条件分岐に含まれる「A==USE」を条件式ce1と記載する。この場合、組み合わせ生成部131は、図5Aに示すように、変数Aの取り得る値と条件式ce1の判定結果との組み合わせを含む組み合わせテーブル33a_1を生成する。   Assume that the conditional branch extracted by the branch extraction unit 121 is “#if A == USE”. Hereinafter, “A == USE” included in the conditional branch is referred to as a conditional expression ce1. In this case, the combination generation unit 131 generates a combination table 33a_1 including combinations of possible values of the variable A and the determination result of the conditional expression ce1, as illustrated in FIG. 5A.

図5Aに示すように、変数Aの取り得る値は「USE」、「NOT」、「OTHER」である。この場合、条件式ce1の対応する判定結果はそれぞれ「T」(TRUE)、「F」(FALSE)、「F」となる。   As shown in FIG. 5A, possible values of the variable A are “USE”, “NOT”, and “OTHER”. In this case, the determination results corresponding to the conditional expression ce1 are “T” (TRUE), “F” (FALSE), and “F”, respectively.

ここで、条件式ce1に含まれる変数Aの取り得る全ての値は、必ず1回は検査される必要がある。そのため、図5Aに示すように、変数Aが「NOT」であっても「OTHER」であっても判定結果は「F」となり判定後の処理は変わらないが、重複除去部133は、変数Aの取り得る値を除去せずに、取り得る値全てを検査時に設定する値とする。これにより、重複除去部133は、例えば図5Bに示すように、「USE」、「NOT」、「OTHER」を設定値とする設定値テーブル33_1を生成する。   Here, all possible values of the variable A included in the conditional expression ce1 must be inspected once. Therefore, as shown in FIG. 5A, the determination result is “F” regardless of whether the variable A is “NOT” or “OTHER”, and the processing after the determination does not change. All possible values are set as values to be set at the time of inspection without removing possible values. As a result, the duplication removal unit 133 generates a set value table 33_1 having “USE”, “NOT”, and “OTHER” as set values, for example, as illustrated in FIG. 5B.

(a−2.比較演算子:等号否定)
次に、図6を用いて、条件式の演算子が等号否定(!=)である場合について説明する。図6は、実施形態に係る組み合わせ生成部131が生成する組み合わせテーブル33a_2の一例を示す図である。
(A-2. Comparison operator: negation of equal sign)
Next, a case where the operator of the conditional expression is equal sign negation (! =) Will be described with reference to FIG. FIG. 6 is a diagram illustrating an example of the combination table 33a_2 generated by the combination generation unit 131 according to the embodiment.

分岐抽出部121が抽出した条件分岐が「#if A!=USE」であったとする。以下、条件分岐に含まれる「A!=USE」を条件式ce2と記載する。この場合、組み合わせ生成部131は、図6に示すように、変数Aの取り得る値と条件式ce2の判定結果との組み合わせを含む組み合わせテーブル33a_2を生成する。   Assume that the conditional branch extracted by the branch extracting unit 121 is “#if A! = USE”. Hereinafter, “A! = USE” included in the conditional branch is referred to as a conditional expression ce2. In this case, the combination generation unit 131 generates a combination table 33a_2 including combinations of possible values of the variable A and the determination result of the conditional expression ce2, as illustrated in FIG.

図6に示すように、変数Aの取り得る値は「USE」、「NOT」、「OTHER」である。この場合、条件式ce2の対応する判定結果はそれぞれ「F」、「T」、「T」となる。   As shown in FIG. 6, possible values of the variable A are “USE”, “NOT”, and “OTHER”. In this case, the determination results corresponding to the conditional expression ce2 are “F”, “T”, and “T”, respectively.

重複除去部133は、条件式ce1の場合と同様に変数Aの取り得る値を除去せずに、取り得る値全てを検査時に設定する値とする。これにより、重複除去部133は、例えば図5Bと同様に、「USE」、「NOT」、「OTHER」を設定値とする設定値テーブル33_1を生成する。   The duplication removal unit 133 does not remove the possible values of the variable A as in the case of the conditional expression ce1, and sets all the possible values as values to be set at the time of inspection. Thereby, the duplication removal part 133 produces | generates the setting value table 33_1 which sets "USE", "NOT", and "OTHER" as a setting value similarly to FIG. 5B, for example.

(a−3.論理演算子:論理和)
図7Aおよび図7Bを用いて、条件式に論理和(||、OR条件)が含まれる場合について説明する。図7Aは、実施形態に係る組み合わせ生成部131が生成する組み合わせテーブル33a_3の一例を示す図である。図7Bは、実施形態に係る重複除去部133が生成する設定値テーブル33_3の一例を示す図である。
(A-3. Logical operator: logical sum)
A case where a logical sum (||, OR condition) is included in the conditional expression will be described with reference to FIGS. 7A and 7B. FIG. 7A is a diagram illustrating an example of the combination table 33a_3 generated by the combination generation unit 131 according to the embodiment. FIG. 7B is a diagram illustrating an example of the setting value table 33_3 generated by the duplication removal unit 133 according to the embodiment.

分岐抽出部121が、図3に示すソースコード31から条件分岐「#if (A==USE) || (B==USE)」を抽出したとする。以下、条件分岐の条件式「(A==USE)||(B==USE)」を条件式ce3と記載する。また、条件式ce3に含まれる論理和の左辺の条件式「A==USE」を条件式ceL、右辺の条件式「B==USE」を条件式ceRと記載する。   Assume that the branch extraction unit 121 extracts the conditional branch “#if (A == USE) || (B == USE)” from the source code 31 shown in FIG. Hereinafter, the conditional expression “(A == USE) || (B == USE)” of the conditional branch is referred to as a conditional expression ce3. Also, the conditional expression “A == USE” on the left side of the logical sum included in the conditional expression ce3 is described as a conditional expression ceL, and the conditional expression “B == USE” on the right side is described as a conditional expression ceR.

この場合、組み合わせ生成部131は、図7Aに示すように変数A、Bの取り得る値と条件式ceL、ceR、ce3の判定結果との組み合わせを含む組み合わせテーブル33a_3を生成する。   In this case, the combination generation unit 131 generates a combination table 33a_3 including combinations of possible values of the variables A and B and the determination results of the conditional expressions ceL, ceR, and ce3 as illustrated in FIG. 7A.

図7Aの組み合わせテーブル33a_3の5行目に示すように、組み合わせ生成部131は、例えば変数Aを「USE」、変数Bを「USE」とする組み合わせを生成する。この場合、条件式ceLの判定結果は「T」、条件式ceRの判定結果は「T」となる。また、条件式ce3の判定結果は「T」となる。   As shown in the fifth row of the combination table 33a_3 in FIG. 7A, the combination generation unit 131 generates, for example, a combination in which the variable A is “USE” and the variable B is “USE”. In this case, the determination result of the conditional expression ceL is “T”, and the determination result of the conditional expression ceR is “T”. In addition, the determination result of the conditional expression ce3 is “T”.

組み合わせ生成部131は、変数A、Bの取り得る値を「USE」、「NOT」、「OTHER」と変更させながら、各条件式ceL、ceR、ce3を判定し、判定結果を組み合わせテーブル33a_3に書き込む。   The combination generation unit 131 determines the conditional expressions ceL, ceR, and ce3 while changing the possible values of the variables A and B to “USE”, “NOT”, and “OTHER”, and the determination result is stored in the combination table 33a_3. Write.

組み合わせ生成部131は、変数A、Bの取り得る値全ての組み合わせに対して条件式ceL、ceR、ce3の判定結果を算出することで、図7Aの組み合わせテーブル33a_3に示すように9通りの組み合わせを生成する。   The combination generation unit 131 calculates the determination results of the conditional expressions ceL, ceR, and ce3 for all combinations of the values that the variables A and B can take, so that there are nine combinations as shown in the combination table 33a_3 in FIG. 7A. Is generated.

次に、重複除去部133は、組み合わせ生成部131が生成した9通りの組み合わせの中から、判定結果に影響を与えない変数の値を含む組み合わせを除去する。   Next, the duplicate removal unit 133 removes combinations including variable values that do not affect the determination result from the nine combinations generated by the combination generation unit 131.

例えば、C言語において論理和は左側から順に演算される。したがって、条件式ceLが成立した場合、条件式ceRの判定結果にかかわらず条件式ce3の判定結果は「成立(T)」となる。すなわち、変数Aが「USE」の場合、変数Bの値は条件式ce3の判定結果に影響を与えない。   For example, in the C language, the logical sum is calculated sequentially from the left side. Therefore, when the conditional expression ceL is satisfied, the determination result of the conditional expression ce3 is “Established (T)” regardless of the determination result of the conditional expression ceR. That is, when the variable A is “USE”, the value of the variable B does not affect the determination result of the conditional expression ce3.

したがって、変数Aが「USE」である組み合わせ、すなわち図7Aに示す組み合わせテーブル33a_3の2、5、8行目の組み合わせを少なくとも1回実行すると、条件式ce3が「T」である検査を少なくとも1回は実行することができる。換言すると、組み合わせテーブル33a_3の2、5、8行目の組み合わせで行う検査は、処理が重複する検査であると言える。   Therefore, when the combination in which the variable A is “USE”, that is, the combination in the second, fifth, and eighth rows of the combination table 33a_3 illustrated in FIG. 7A is executed at least once, at least one test in which the conditional expression ce3 is “T” Times can be performed. In other words, it can be said that the inspection performed by the combination of the second, fifth, and eighth rows of the combination table 33a_3 is an inspection in which processing is duplicated.

そこで、本実施形態では、重複除去部133が、処理が重複する組み合わせ(図7Aでは2、5、8行目の組み合わせ)の少なくとも1つを除去することで、検査数を削減することとした。ただし、このとき、重複除去部133は、変数A、Bの各取り得る値が少なくとも1回は検査されるように、削除する組み合わせを決定する。   Therefore, in the present embodiment, the duplication removal unit 133 reduces the number of inspections by removing at least one of the combinations with overlapping processes (the combinations of the second, fifth, and eighth rows in FIG. 7A). . However, at this time, the duplicate removal unit 133 determines a combination to be deleted so that each possible value of the variables A and B is examined at least once.

また、重複除去部133は、変数A、Bの各取り得る値と、条件式ce3の判定結果との異なる組み合わせが少なくとも1回は検査されるように、削除する組み合わせを決定する。例えば、変数Bが「NOT」の場合、条件式ce3の判定結果が「T」である組み合わせと、判定結果が「F」である組み合わせとが1回は検査されるように、重複除去部133は、変数A、Bの設定値を決定する。   In addition, the duplication removal unit 133 determines a combination to be deleted so that a different combination of each possible value of the variables A and B and the determination result of the conditional expression ce3 is examined at least once. For example, when the variable B is “NOT”, the duplicate removal unit 133 is so checked that the combination in which the determination result of the conditional expression ce3 is “T” and the combination in which the determination result is “F” are checked once. Determines the set values of variables A and B.

なお、変数Bが「USE」の場合、条件式ce3は必ず「T」になるため、条件式ce3が「F」の組み合わせは存在しない。このように、変数A、Bの取り得る値によっては条件式ce3の判定結果が異なる組み合わせが存在しない場合もある。   When the variable B is “USE”, the conditional expression ce3 is always “T”, so there is no combination of the conditional expression ce3 “F”. Thus, depending on the possible values of the variables A and B, there may be no combination in which the determination result of the conditional expression ce3 is different.

重複除去部133は、例えば図7Aの組み合わせテーブル33a_3の場合、5行目の組み合わせは除去するが、8行目の組み合わせは除去しない。これは、5行目の組み合わせの変数Bが「USE」、条件式ce3が「T」であり、この組み合わせは4、6行目の組み合わせと同じであるためである。また、8行目の組み合わせは、変数Bが「OTHER」であり、条件式ce3が「T」であるが、この組み合わせは他の組み合わせに含まれないためである。   For example, in the case of the combination table 33a_3 in FIG. 7A, the duplicate removal unit 133 removes the combination in the fifth row, but does not remove the combination in the eighth row. This is because the variable B of the combination on the fifth line is “USE” and the conditional expression ce3 is “T”, and this combination is the same as the combination on the fourth and sixth lines. The combination on the eighth line is because the variable B is “OTHER” and the conditional expression ce3 is “T”, but this combination is not included in other combinations.

重複除去部133は、組み合わせテーブル33a_3の5行目の組み合わせを除外し、1〜4、6〜9行目に含まれる変数A、Bの組み合わせを設定値の組み合わせに決定し、図7Bに示す設定値テーブル33_3を生成する。   The duplicate removal unit 133 excludes the combination of the fifth row of the combination table 33a_3, determines the combination of variables A and B included in the first to fourth and sixth to ninth rows as a combination of set values, and is illustrated in FIG. 7B. A setting value table 33_3 is generated.

なお、論理積(&&、AND条件)については、図1を用いて上述したため、ここでの説明を省略する。   Note that the logical product (&&, AND condition) has been described above with reference to FIG.

(b.ネスト条件)
次に、図8Aおよび図8Bを用いて、分岐抽出部121が、#if文が入れ子になったネスト条件を抽出した場合について説明する。図8Aは、実施形態に係るソースコード31bの一例を示す図である。図8Bは、実施形態に係る組み合わせ生成部131が生成する組み合わせテーブル33a_4の一例を示す図である。
(B. Nest condition)
Next, a case where the branch extraction unit 121 extracts a nested condition in which a #if statement is nested will be described with reference to FIGS. 8A and 8B. FIG. 8A is a diagram illustrating an example of the source code 31b according to the embodiment. FIG. 8B is a diagram illustrating an example of the combination table 33a_4 generated by the combination generation unit 131 according to the embodiment.

図8Aに示すように、ソースコード31bにネスト条件が含まれると、例えば条件分岐「#if A==USE」が成立する場合に、条件分岐「#if B==USE」を含む処理P1が実行される。   As shown in FIG. 8A, when the nest condition is included in the source code 31b, for example, when the conditional branch “#if A == USE” is established, the process P1 including the conditional branch “#if B == USE” is performed. Executed.

このようにソースコード31bにネスト条件が含まれる場合、分岐抽出部121は、親となる条件分岐「#if A==USE」および子となる条件分岐「#if B==USE」をそれぞれ抽出する。   Thus, when the nesting condition is included in the source code 31b, the branch extraction unit 121 extracts the conditional branch “#if A == USE” as a parent and the conditional branch “#if B == USE” as a child, respectively. To do.

まず、組み合わせ生成部131は、親となる条件分岐「#if A==USE」に含まれる条件式「A==USE」の変数Aと判定結果との組み合わせテーブルを生成する。かかる組み合わせテーブルは、図5Aに示す組み合わせテーブル33a_1と同じであるため図示を省略する。   First, the combination generation unit 131 generates a combination table of the variable A of the conditional expression “A == USE” included in the parent conditional branch “#if A == USE” and the determination result. Such a combination table is the same as the combination table 33a_1 shown in FIG.

次に、組み合わせ生成部131は、子となる条件分岐「#if B==USE」の組み合わせテーブル33a_4を生成する。この場合、組み合わせ生成部131は、親となる条件分岐「#if A==USE」を考慮して組み合わせテーブル33a_4を生成する。すなわち、組み合わせ生成部131は、変数A、Bと条件式「A==USE」、「B==USE」の判定結果との組み合わせテーブル33a_4を生成する。   Next, the combination generation unit 131 generates a combination table 33a_4 of a conditional branch “#if B == USE” as a child. In this case, the combination generation unit 131 generates the combination table 33a_4 in consideration of the conditional branch “#if A == USE” as a parent. That is, the combination generation unit 131 generates a combination table 33a_4 of the variables A and B and the determination results of the conditional expressions “A == USE” and “B == USE”.

重複除去部133は、子となる条件分岐に基づいて生成された組み合わせテーブル33a_4に含まれる組み合わせから、検査で行う処理が重複する組み合わせを削除する。例えば、図8Aに示すソースコード31bでは、親となる条件分岐が不成立(F)の場合、子となる条件分岐は処理されない。すなわち、変数Aが「USE」でなければ、変数Bの値にかかわらず処理P1は実行されない。   The duplicate removal unit 133 deletes a combination in which the process performed in the inspection is duplicated from the combinations included in the combination table 33a_4 generated based on the conditional branch as a child. For example, in the source code 31b shown in FIG. 8A, when the conditional branch serving as a parent is not established (F), the conditional branch serving as a child is not processed. That is, unless the variable A is “USE”, the process P1 is not executed regardless of the value of the variable B.

そこで、重複除去部133は、図8Bに示す組み合わせテーブル33a_4のうち、3、5、8、9行目の組み合わせを除外して、変数A、Bの設定値を決定する。なお、組み合わせを除外する方法は、図1を用いて説明した演算子に論理積が含まれる場合と同じであるため、説明を省略する。   Therefore, the duplication removal unit 133 determines the setting values of the variables A and B by excluding the combinations in the third, fifth, eighth, and ninth rows from the combination table 33a_4 illustrated in FIG. 8B. The method of excluding combinations is the same as the case where the operator described with reference to FIG.

(c.#else文)
図9を用いて、分岐抽出部121が条件分岐として#else文を抽出した場合について説明する。図9は、実施形態に係るソースコード31cの一例を示す図である。
(C. # Else statement)
The case where the branch extraction unit 121 extracts an #else sentence as a conditional branch will be described with reference to FIG. FIG. 9 is a diagram illustrating an example of the source code 31c according to the embodiment.

図9に示すように、分岐抽出部121が条件分岐「#if (A==USE)&&(B==USE)」および条件分岐「#else」を抽出したものとする。   As illustrated in FIG. 9, it is assumed that the branch extraction unit 121 extracts the conditional branch “#if (A == USE) && (B == USE)” and the conditional branch “#else”.

この場合、分岐抽出部121は、条件分岐「#else」の条件式として条件分岐「#if (A==USE)&&(B==USE)」の否定である条件式を抽出する。換言すると、分岐抽出部121は、図9に示すように、条件分岐「#else」を「#if (A!=USE)||(B!=USE)」に置き換える。図9では置き換えたソースコードをソースコード31c_1として示している。   In this case, the branch extraction unit 121 extracts a conditional expression that is the negative of the conditional branch “#if (A == USE) && (B == USE)” as the conditional expression of the conditional branch “#else”. In other words, the branch extraction unit 121 replaces the conditional branch “#else” with “#if (A! = USE) || (B! = USE)” as shown in FIG. In FIG. 9, the replaced source code is shown as source code 31c_1.

組み合わせ生成部131は、分岐抽出部121が抽出した条件分岐「#if (A==USE)&&(B==USE)」および「#if (A!=USE)||(B!=USE)」についてそれぞれ組み合わせテーブルを生成する。また、重複除去部133は、各組み合わせテーブルから処理が重複する組み合わせを除外して、条件分岐ごとに設定値テーブルを生成する。   The combination generation unit 131 extracts the conditional branches “#if (A == USE) && (B == USE)” and “#if (A! = USE) || (B! = USE) extracted by the branch extraction unit 121. ”For each. In addition, the duplicate removal unit 133 excludes combinations whose processes are duplicated from each combination table, and generates a setting value table for each conditional branch.

(d.#elif文)
図10を用いて、分岐抽出部121が条件分岐として#elif文を抽出した場合について説明する。図10は、実施形態に係るソースコード31dの一例を示す図である。
(D. # Elif statement)
The case where the branch extraction unit 121 extracts a #elif sentence as a conditional branch will be described with reference to FIG. FIG. 10 is a diagram illustrating an example of the source code 31d according to the embodiment.

図10に示すように、分岐抽出部121が条件分岐「#if (A==USE)&&(B==USE)」および条件分岐「#elif (C==USE)」を抽出したものとする。   As illustrated in FIG. 10, it is assumed that the branch extraction unit 121 has extracted the conditional branch “#if (A == USE) && (B == USE)” and the conditional branch “#elif (C == USE)”. .

この場合、分岐抽出部121は、条件分岐「#elif (C==USE)」の条件式として「(A==USE)&&(B==USE)」の否定である条件式と「C==USE」との論理積を抽出する。換言すると、分岐抽出部121は、図10に示すように、条件分岐「「#elif (C==USE)」を「#if ((A!=USE)||(B!=USE))&&(C==USE)」に置き換える。図10では置き換えたソースコードをソースコード31d_1として示している。   In this case, the branch extraction unit 121 uses a conditional expression that is a negative of “(A == USE) && (B == USE)” as a conditional expression of the conditional branch “#elif (C == USE)” and “C = AND with “= USE” is extracted. In other words, as shown in FIG. 10, the branch extraction unit 121 converts the conditional branch ““ #elif (C == USE) ”to“ #if ((A! = USE) || (B! = USE)) && (C == USE) ”. In FIG. 10, the replaced source code is shown as source code 31d_1.

組み合わせ生成部131は、分岐抽出部121が抽出した条件分岐「#if (A==USE)&&(B==USE)」および「#if ((A!=USE)||(B!=USE))&&(C==USE)」についてそれぞれ組み合わせテーブルを生成する。また、重複除去部133は、各組み合わせテーブルから処理が重複する組み合わせを除外して、条件分岐ごとに設定値テーブルを生成する。なお、条件分岐に含まれるCは変数であり、変数A、Bと同様に「USE」、「NOT」、「OTHER」の3つの値を取り得るものとする。   The combination generation unit 131 extracts the conditional branches “#if (A == USE) && (B == USE)” and “#if ((A! = USE)) || (B! = USE) extracted by the branch extraction unit 121. )) && (C == USE) "is generated for each combination table. In addition, the duplicate removal unit 133 excludes combinations whose processes are duplicated from each combination table, and generates a setting value table for each conditional branch. Note that C included in the conditional branch is a variable, and can assume three values “USE”, “NOT”, and “OTHER” in the same manner as the variables A and B.

ここで、図11A〜図11Eを用いて条件分岐「#if ((A!=USE)||(B!=USE))&&(C==USE)」(図10参照)のように、条件式に複数の論理演算子が含まれる場合に、組み合わせ生成部131が生成する組み合わせテーブルについて説明する。   Here, a conditional branch “#if ((A! = USE) || (B! = USE)) && (C == USE)” (see FIG. 10) is used as shown in FIG. A combination table generated by the combination generation unit 131 when the formula includes a plurality of logical operators will be described.

図11Aは、実施形態に係るソースコード31eの一例を示す図である。また、図11Bは、実施形態に係る組み合わせ生成部131が生成する組み合わせテーブル33a_5の一例を示す図である。図11Cおよび図11Dは、実施形態にかかる重複除去部133が生成するテーブル33a_6、33a_8の一例を示す図である。図11Eは、実施形態にかかる重複除去部133が生成する設定値テーブル33_9の一例を示す図である。   FIG. 11A is a diagram illustrating an example of the source code 31e according to the embodiment. FIG. 11B is a diagram illustrating an example of the combination table 33a_5 generated by the combination generation unit 131 according to the embodiment. 11C and 11D are diagrams illustrating an example of the tables 33a_6 and 33a_8 generated by the duplication removal unit 133 according to the embodiment. FIG. 11E is a diagram illustrating an example of the setting value table 33_9 generated by the duplication removal unit 133 according to the embodiment.

なお、以下、図11Aに示すように、条件式に複数の論理演算子が複数含まれる条件分岐として、「#if((A==USE)&&(B==USE))||((C==USE)||(D==USE))」を例にとって説明する。ここで、条件式に含まれるC、Dは変数であり、変数A、Bと同様に、「USE」、「NOT」、「OTHER」の3つの値を取り得るものとする。   Hereinafter, as shown in FIG. 11A, as a conditional branch in which a plurality of logical operators are included in a conditional expression, “#if ((A == USE) && (B == USE)) || ((C == USE) || (D == USE)) ". Here, C and D included in the conditional expression are variables, and, like the variables A and B, three values “USE”, “NOT”, and “OTHER” can be taken.

また、ここでは、「(A==USE)&&(B==USE)」を条件式ce5と記載し、「(C==USE)||(D==USE)」を条件式ce6と記載する。また、条件式ce5と条件式ce6の論理和、すなわち条件分岐の条件式「((A==USE)&&(B==USE))||((C==USE)||(D==USE))」を条件式ce7と記載する。   Here, “(A == USE) && (B == USE)” is described as conditional expression ce5, and “(C == USE) || (D == USE)” is described as conditional expression ce6. To do. Further, the logical sum of the conditional expression ce5 and the conditional expression ce6, that is, the conditional expression “((A == USE) && (B == USE)) || ((C == USE) || (D == USE)) ”is written as conditional expression ce7.

まず、組み合わせ生成部131は、図11Bに示すように、条件式ce5〜ce7の判定結果の組み合わせテーブル33a_5を生成する。   First, the combination generation unit 131 generates a combination table 33a_5 of determination results of the conditional expressions ce5 to ce7 as illustrated in FIG. 11B.

次に、組み合わせ生成部131は、条件式ce5について変数A、Bおよび条件式ce5の判定結果の組み合わせテーブル33a(図1参照)を生成する。   Next, the combination generation unit 131 generates a combination table 33a (see FIG. 1) of the determination results of the variables A and B and the conditional expression ce5 for the conditional expression ce5.

重複除去部133は、図11Cに示すように、組み合わせテーブル33aから重複する組み合わせ(図1の組み合わせテーブル33aの5、6、8および9行目の組み合わせ)を除去したテーブル33a_6を生成する。   As illustrated in FIG. 11C, the duplicate removal unit 133 generates a table 33a_6 from which the duplicate combination (the combination of the fifth, sixth, eighth, and ninth rows of the combination table 33a in FIG. 1) is removed from the combination table 33a.

組み合わせ生成部131は、条件式ce6について変数C、Dおよび条件式ce6の判定結果の組み合わせテーブル33a_7を生成する。なお、組み合わせテーブル33a_7は、図7Aに示す組み合わせテーブル33a_3の変数A、Bを変数C、Dに置き換えたものであるため、図示を省略する。   The combination generation unit 131 generates a combination table 33a_7 of the determination results of the variables C and D and the conditional expression ce6 for the conditional expression ce6. Since the combination table 33a_7 is obtained by replacing the variables A and B of the combination table 33a_3 illustrated in FIG. 7A with variables C and D, illustration thereof is omitted.

また、重複除去部133は、組み合わせ生成部131が生成した組み合わせテーブル33a_7から重複する組み合わせ(図7Aの組み合わせテーブル33a_3の5行目の組み合わせ)を除去したテーブル33a_8を生成する。   In addition, the duplication removal unit 133 generates a table 33a_8 in which the duplicate combination (the combination in the fifth row of the combination table 33a_3 in FIG. 7A) is removed from the combination table 33a_7 generated by the combination generation unit 131.

重複除去部133は、生成したテーブル33a_6、33a_8を、組み合わせテーブル33a_5を用いて統合することで図11Eに示す設定値テーブル33_9を生成する。   The deduplication unit 133 generates the setting value table 33_9 illustrated in FIG. 11E by integrating the generated tables 33a_6 and 33a_8 using the combination table 33a_5.

例えば、図11Bに示す組み合わせテーブル33a_5の1行目は、条件式ce5の判定結果が「F」であり、条件式ce6が「F」である。そのため、重複除去部133は、テーブル33a_6の判定結果が「F」となる組み合わせ(図11Cのテーブル33a_6の2〜5行目の組み合わせ)とテーブル33a_8の判定結果が「F」となる組み合わせ(図11Dのテーブル33a_8の1、3、6、8行目の組み合わせ)を統合する。   For example, in the first row of the combination table 33a_5 illustrated in FIG. 11B, the determination result of the conditional expression ce5 is “F”, and the conditional expression ce6 is “F”. Therefore, the duplication removal unit 133 sets the combination in which the determination result of the table 33a_6 is “F” (the combination of the second to fifth rows of the table 33a_6 in FIG. 11C) and the combination in which the determination result of the table 33a_8 is “F” (FIG. 11D table 33a_8 in the first, third, sixth and eighth rows).

なお、図11Eに示す設定値テーブル33_9の1〜4行目は、図11Bに示す組み合わせテーブル33a_5の2行目に該当する。また、設定値テーブル33_9の5〜20行目は、図11Bに示す組み合わせテーブル33a_5の3行目に該当する。設定値テーブル33_9の21〜36行目は、図11Bに示す組み合わせテーブル33a_5の1行目に該当する。   Note that the first to fourth lines of the setting value table 33_9 illustrated in FIG. 11E correspond to the second line of the combination table 33a_5 illustrated in FIG. 11B. Further, the 5th to 20th lines of the setting value table 33_9 correspond to the 3rd line of the combination table 33a_5 illustrated in FIG. 11B. The 21st to 36th lines of the setting value table 33_9 correspond to the first line of the combination table 33a_5 illustrated in FIG. 11B.

なお、図11Bに示す組み合わせテーブル33a_5の4行目の組み合わせは、2行目の組み合わせと重複するため、テーブル33a_6、33a_8を統合する際に組み合わせを除外している。これは、条件式ce5が「T」であるならば、条件式ce6の判定結果にかかわらず、条件式ce7が「T」になるためである。そのため、組み合わせテーブル33a_5の2、4行目のいずれか一方を除外しても単体検査に影響を与えないため、図11Bに示す組み合わせテーブル33a_5の4行目の組み合わせに基づいたテーブル33a_6、33a_8の統合は除外することができる。   Note that the combination in the fourth row of the combination table 33a_5 illustrated in FIG. 11B overlaps with the combination in the second row, and therefore the combination is excluded when integrating the tables 33a_6 and 33a_8. This is because if the conditional expression ce5 is “T”, the conditional expression ce7 becomes “T” regardless of the determination result of the conditional expression ce6. For this reason, even if any one of the second and fourth lines of the combination table 33a_5 is excluded, the single inspection is not affected. Therefore, the tables 33a_6 and 33a_8 based on the combination of the fourth line of the combination table 33a_5 illustrated in FIG. Integration can be excluded.

(2.1.4.出力部)
出力部140は、重複除去部133が生成した設定値テーブル33を記憶部30に記憶させる。なお、ここでは、出力部140が設定値テーブル33を記憶させるとしたが、例えば重複除去部133が記憶部30に記憶するようにしてもよい。
(2.1.4. Output unit)
The output unit 140 stores the setting value table 33 generated by the duplication removal unit 133 in the storage unit 30. Although the output unit 140 stores the setting value table 33 here, the deduplication unit 133 may store the setting value table 33 in the storage unit 30, for example.

また、出力部140が検査部20に設定値テーブル33を出力するようにしてもよく、あるいは図示しないディスプレイ等に出力するようにしてもよい。   Further, the output unit 140 may output the set value table 33 to the inspection unit 20, or may output the set value table 33 to a display or the like (not shown).

(2.2.検査部)
検査部20は、記憶部30からソースコード31および設定値テーブル33を読み出すと、設定値テーブル33に含まれる変数の設定値を用いてソースコード31をモジュールごとに実行することで、ソースコード31の単体検査を行う。
(2.2. Inspection Department)
When the inspection unit 20 reads the source code 31 and the setting value table 33 from the storage unit 30, the inspection unit 20 executes the source code 31 for each module by using the setting value of the variable included in the setting value table 33. Perform single unit inspection.

(3.決定処理)
次に、図12を用いて、実施形態に係る検査装置1が実行する決定処理の処理手順について説明する。図12は、実施形態に係る検査装置1が実行する決定処理の処理手順を示すフローチャートである。
(3. Decision processing)
Next, with reference to FIG. 12, the procedure of the determination process executed by the inspection apparatus 1 according to the embodiment will be described. FIG. 12 is a flowchart illustrating a processing procedure of determination processing executed by the inspection apparatus 1 according to the embodiment.

図12に示すように、まず、検査装置1は、ソースコード31を読み込む(ステップS101)。次に、検査装置1は、ソースコード31から条件分岐を抽出する(ステップS102)。   As shown in FIG. 12, first, the inspection apparatus 1 reads the source code 31 (step S101). Next, the inspection apparatus 1 extracts a conditional branch from the source code 31 (step S102).

検査装置1は、抽出した条件分岐の条件式に含まれる変数を抽出する(ステップS103)。検査装置1は、抽出した変数の取り得る値全てを抽出する(ステップS104)。   The inspection apparatus 1 extracts variables included in the extracted conditional expression of the conditional branch (step S103). The inspection apparatus 1 extracts all possible values of the extracted variable (step S104).

検査装置1は、変数の取り得る値と条件式の判定結果との組み合わせを生成する(ステップS105)。   The inspection apparatus 1 generates a combination of the values that the variable can take and the determination result of the conditional expression (step S105).

検査装置1は、ステップS105で生成した組み合わせのなかから、ソースコード31を実行する場合には組み合わせられない変数の設定値を含む組み合わせを除外する(ステップS106)。   The inspection apparatus 1 excludes combinations including variable setting values that cannot be combined when executing the source code 31 from the combinations generated in step S105 (step S106).

検査装置1は、ステップS105で生成した組み合わせのなかから、単体検査に影響を与えない変数の値を含む組み合わせを除外する(ステップ107)。   The inspection apparatus 1 excludes combinations including variable values that do not affect the single inspection from the combinations generated in step S105 (step 107).

検査装置1は、ステップS106およびステップS107で除外した組み合わせに基づき、変数の設定値の組み合わせを決定し(ステップS108)、決定した設定値の組み合わせを出力する(ステップS109)。   The inspection apparatus 1 determines a combination of variable setting values based on the combinations excluded in Step S106 and Step S107 (Step S108), and outputs the determined combination of setting values (Step S109).

以上のように、実施形態に係る検査装置1は、ソースコード31に含まれる変数の設定値を自動で決定することができ、ユーザの作業量を削減することができる。   As described above, the inspection apparatus 1 according to the embodiment can automatically determine the setting value of the variable included in the source code 31, and can reduce the amount of work for the user.

(4.変形例)
以上、本発明の実施形態について説明してきたが、この発明は上記実施形態に限定されるものではなく様々な変形が可能である。以下では、このような変形例について説明する。上記実施形態および以下で説明する形態を含む全ての形態は、適宜に組み合わせ可能である。
(4. Modifications)
As mentioned above, although embodiment of this invention has been described, this invention is not limited to the said embodiment, A various deformation | transformation is possible. Below, such a modification is demonstrated. All the forms including the above embodiment and the forms described below can be appropriately combined.

上記実施形態では、検査装置1が変数と条件式の判定結果との組み合わせテーブルを生成してから、重複する組み合わせを除外するとしたが、これに限定されない。例えば論理積を含む条件式の組み合わせを算出する場合に、検査装置1が重複する組み合わせを除外しつつ、組み合わせテーブルを生成するようにしてもよい。   In the above-described embodiment, the inspection apparatus 1 generates a combination table of variables and conditional expression determination results and then excludes duplicate combinations. However, the present invention is not limited to this. For example, when calculating a combination of conditional expressions including a logical product, the inspection apparatus 1 may generate a combination table while excluding duplicate combinations.

具体的に、検査装置1の組み合わせ生成部131は、複数の条件式の論理積を算出する場合に、複数の条件式が「T」となるようにしてから、各条件式が1つずつ「F」になるように複数の条件式に含まれる変数を設定する。   Specifically, when calculating the logical product of a plurality of conditional expressions, the combination generation unit 131 of the inspection apparatus 1 sets each conditional expression to “T” and then sets each conditional expression to “T”. Variables included in a plurality of conditional expressions are set so as to be “F”.

例えば図1に示す条件式c「(A==USE)&&(B==USE)」の場合、組み合わせ生成部131は、条件式a「A==USE」および条件式b「B==USE」がどちらも「T」になるように変数A、Bの組み合わせを生成する。この場合、組み合わせ生成部131は、変数A、Bともに「USE」とする。   For example, in the case of the conditional expression c “(A == USE) && (B == USE)” illustrated in FIG. "Is a combination of variables A and B so that both become" T ". In this case, the combination generation unit 131 sets “USE” for both the variables A and B.

次に、組み合わせ生成部131は、各条件式a、bが1つずつ「F」になるように変数A、Bの組み合わせを生成する。まず、組み合わせ生成部131は、条件式aが「F」となり、条件式bが「T」となる変数A、Bの組み合わせとして、変数Aが「NOT」、変数Bが「USE」の組み合わせと、変数Aが「OTHER」、変数Bが「USE」の組み合わせを生成する。続いて、組み合わせ生成部131は、条件式aが「T」となり、条件式bが「F」となる変数A、Bの組み合わせを生成する。最後に、条件式a、bともに「F」となる変数A、Bの組み合わせを生成する。   Next, the combination generation unit 131 generates a combination of variables A and B so that each conditional expression a and b becomes “F” one by one. First, the combination generation unit 131 sets a combination of variables A and B in which the conditional expression a is “F” and the conditional expression b is “T”, and the variable A is “NOT” and the variable B is “USE”. , Variable A is “OTHER” and variable B is “USE”. Subsequently, the combination generation unit 131 generates a combination of variables A and B in which the conditional expression a is “T” and the conditional expression b is “F”. Finally, a combination of variables A and B that generate “F” for both conditional expressions a and b is generated.

これにより、図13に示すように、重複した組み合わせを除去した組み合わせテーブル33a_10を生成することができ、重複除去部133の処理を省略することができる。なお、図13は、変形例に係る組み合わせ生成部131が生成する組み合わせテーブルの一例を示す図である。   Thereby, as shown in FIG. 13, the combination table 33a_10 from which the duplicate combination is removed can be generated, and the process of the duplicate removal unit 133 can be omitted. FIG. 13 is a diagram illustrating an example of a combination table generated by the combination generation unit 131 according to the modification.

また、上記実施形態では、検査装置1が変数の設定を決定する決定部10と、単体検査を行う検査部20とを備えるとしたが、これに限定されない。例えば決定部10と検査部20とをそれぞれ別の装置に実装するようにしてもよい。すなわち、実施形態に係る決定方法を実行する決定装置(図示せず)が、単体検査を行う検査装置1と別の装置であってもよい。   In the above-described embodiment, the inspection apparatus 1 includes the determination unit 10 that determines the setting of the variable and the inspection unit 20 that performs the single unit inspection. However, the present invention is not limited to this. For example, you may make it mount the determination part 10 and the test | inspection part 20 in a respectively different apparatus. That is, a determination device (not shown) that executes the determination method according to the embodiment may be a device different from the inspection device 1 that performs a single inspection.

(5.効果)
上記実施形態に係る決定プログラムは、単体検査の対象であるソースコード31を読み込む手順をコンピュータに実行させる。更に決定プログラムは、ソースコード31に含まれる条件分岐を抽出する手順をコンピュータに実行させる。更に決定プログラムは、条件分岐の条件式に含まれる変数の取り得る値と、条件式の判定結果と、の組み合わせに基づき、単体検査を行う場合に代入する変数の設定値を決定する手順をコンピュータに実行させる。更に決定プログラムは、決定した設定値を出力する手順をコンピュータに実行させる。
(5. Effect)
The determination program according to the above-described embodiment causes the computer to execute a procedure for reading the source code 31 that is the target of the single inspection. Further, the determination program causes the computer to execute a procedure for extracting a conditional branch included in the source code 31. Further, the determination program uses a computer to determine a setting value of a variable to be substituted when performing a single inspection based on a combination of a possible value of a variable included in the conditional expression of the conditional branch and a determination result of the conditional expression. To run. Further, the determination program causes the computer to execute a procedure for outputting the determined setting value.

これにより、単体検査を行う場合に代入する変数の設定値をコンピュータが決定することができ、ユーザの作業量を削減することができる。   As a result, the computer can determine the set value of the variable to be substituted when performing a single inspection, and the amount of work for the user can be reduced.

上記実施形態に係る決定プログラムは、変数の設定値を決定する手順として、変数の取り得る値の全てが少なくとも1回は代入されるように、設定値を決定する。   The determination program according to the above embodiment determines the setting value as a procedure for determining the setting value of the variable so that all the possible values of the variable are substituted at least once.

これにより、変数の設定値の漏れを抑制することができ、単体検査の精度を向上させることができる。   Thereby, the leakage of the set value of the variable can be suppressed, and the accuracy of the single inspection can be improved.

上記実施形態に係る決定プログラムは、変数の設定値を決定する手順として、変数の取り得る値と判定結果との組み合わせが少なくとも1回は検査されるように、設定値を決定する。   The determination program according to the above-described embodiment determines the setting value as a procedure for determining the setting value of the variable so that the combination of the possible value of the variable and the determination result is examined at least once.

これにより、変数の設定値の漏れを抑制することができ、単体検査の精度を向上させることができる。   Thereby, the leakage of the set value of the variable can be suppressed, and the accuracy of the single inspection can be improved.

上記実施形態に係る決定プログラムは、変数の設定値を決定する手順として、複数の変数の取り得る値の組み合わせのうち、ソースコード31では組み合わせられない組み合わせを除外して設定値を決定する。   The determination program according to the above-described embodiment determines the setting value as a procedure for determining the setting value of the variable by excluding combinations that cannot be combined in the source code 31 from combinations of values that can be taken by a plurality of variables.

これにより、単体検査の検査数を削減することができ検査規模の増加を抑制することができる。   Thereby, the number of inspections for a single inspection can be reduced, and an increase in the inspection scale can be suppressed.

上記実施形態に係る決定プログラムは、変数の設定値を決定する手順として、複数の変数の取り得る値の組み合わせのうち、判定結果に影響を与えない変数の設定値を含む組み合わせを除外して設定値を決定する。   In the determination program according to the embodiment, as a procedure for determining the setting value of a variable, a setting including a setting value of a variable that does not affect the determination result is excluded from combinations of values that a plurality of variables can take. Determine the value.

これにより、単体検査の検査数を削減することができ検査規模の増加を抑制することができる。   Thereby, the number of inspections for a single inspection can be reduced, and an increase in the inspection scale can be suppressed.

上記実施形態に係る決定プログラムは、変数の設定値を決定する手順として、条件式に含まれる演算子の演算順序に応じて、判定結果に影響を与えない前記変数の設定値を含む前記組み合わせの少なくとも1つが検査されるように前記設定値を決定する。   The determination program according to the embodiment includes, as a procedure for determining a variable setting value, the combination of the combination including the variable setting value that does not affect the determination result according to the calculation order of the operators included in the conditional expression. The set value is determined so that at least one is inspected.

これにより、単体検査の検査数を削減することができ検査規模の増加を抑制することができる。   Thereby, the number of inspections for a single inspection can be reduced, and an increase in the inspection scale can be suppressed.

上記実施形態に係る決定プログラムは、条件分岐を抽出する手順は、ソースコード31のプリプロセス実行時に行われる。   In the determination program according to the above-described embodiment, the procedure for extracting the conditional branch is performed when the source code 31 is preprocessed.

これにより、プリプロセス実行時に、単体検査を行う場合に変数に代入する設定値を決定することができる。   Thereby, it is possible to determine a setting value to be substituted into a variable when performing a single inspection during execution of the preprocess.

さらなる効果や変形例は、当業者によって容易に導き出すことができる。このため、本発明のより広範な態様は、以上のように表しかつ記述した特定の詳細および代表的な実施形態に限定されるものではない。したがって、添付の特許請求の範囲およびその均等物によって定義される総括的な発明の概念の精神または範囲から逸脱することなく、様々な変更が可能である。   Further effects and modifications can be easily derived by those skilled in the art. Thus, the broader aspects of the present invention are not limited to the specific details and representative embodiments shown and described above. Accordingly, various modifications can be made without departing from the spirit or scope of the general inventive concept as defined by the appended claims and their equivalents.

1 検査装置
10 決定部
110 読込部
120 抽出部
130 設定値決定部
140 出力部
20 検査部
30 記憶部
DESCRIPTION OF SYMBOLS 1 Inspection apparatus 10 Determination part 110 Reading part 120 Extraction part 130 Setting value determination part 140 Output part 20 Inspection part 30 Storage part

Claims (8)

単体検査の対象であるソースコードを読み込む手順と、
前記ソースコードに含まれる条件分岐を抽出する手順と、
前記条件分岐の条件式に含まれる変数の取り得る値と、前記条件式の判定結果と、の組み合わせに基づき、前記単体検査を行う場合に代入する前記変数の設定値を決定する手順と、
決定した前記設定値を出力する手順と、
をコンピュータに実行させることを特徴とする決定プログラム。
The procedure for reading the source code that is the subject of unit inspection,
A procedure for extracting a conditional branch included in the source code;
A procedure for determining a setting value of the variable to be substituted when performing the unit test based on a combination of a value included in the conditional expression of the conditional branch and a determination result of the conditional expression;
A procedure for outputting the determined setting value;
A determination program characterized by causing a computer to execute.
前記変数の設定値を決定する手順として、
前記変数の取り得る値の全てが少なくとも1回は代入されるように、前記設定値を決定すること
を特徴とする請求項1に記載の決定プログラム。
As a procedure for determining the setting value of the variable,
The determination program according to claim 1, wherein the setting value is determined so that all of the possible values of the variable are substituted at least once.
前記変数の設定値を決定する手順として、
前記変数の取り得る値と前記判定結果との組み合わせが少なくとも1回は検査されるように、前記設定値を決定すること
を特徴とする請求項1または2に記載の決定プログラム。
As a procedure for determining the setting value of the variable,
The determination program according to claim 1 or 2, wherein the set value is determined so that a combination of a possible value of the variable and the determination result is examined at least once.
前記変数の設定値を決定する手順として、
複数の前記変数の取り得る値の組み合わせのうち、前記ソースコードでは組み合わせられない組み合わせを除外して前記設定値を決定すること
を特徴とする請求項1〜3のいずれか一項に記載の決定プログラム。
As a procedure for determining the setting value of the variable,
The determination according to any one of claims 1 to 3, wherein the setting value is determined by excluding combinations that cannot be combined in the source code from among combinations of values that can be taken by the plurality of variables. program.
前記変数の設定値を決定する手順として、
複数の前記変数の取り得る値の組み合わせのうち、判定結果に影響を与えない前記変数の前記設定値を含む組み合わせを除外して前記設定値を決定すること
を特徴とする請求項1〜4のいずれか一項に記載の決定プログラム。
As a procedure for determining the setting value of the variable,
5. The set value is determined by excluding a combination including the set value of the variable that does not affect a determination result from combinations of possible values of the plurality of variables. The decision program according to any one of the above.
前記変数の設定値を決定する手順として、
前記条件式に含まれる演算子の演算順序に応じて、判定結果に影響を与えない前記変数の前記設定値を含む前記組み合わせの少なくとも1つが検査されるように前記設定値を決定すること
を特徴とする請求項5に記載の決定プログラム。
As a procedure for determining the setting value of the variable,
The setting value is determined so that at least one of the combinations including the setting value of the variable that does not affect a determination result is examined according to an operation order of operators included in the conditional expression. The determination program according to claim 5.
前記条件分岐を抽出する手順は、
前記ソースコードのプリプロセス実行時に行われること
を特徴とする請求項1〜6のいずれか一項に記載の決定プログラム。
The procedure for extracting the conditional branch is as follows:
The determination program according to claim 1, wherein the determination program is executed when the source code is preprocessed.
単体検査の対象であるソースコードを読み込む工程と、
前記ソースコードに含まれる条件分岐を抽出する工程と、
前記条件分岐の条件式に含まれる変数の取り得る値と、前記条件式の判定結果と、の組み合わせに基づき、前記単体検査を行う場合に代入する前記変数の設定値を決定する工程と、
決定した前記設定値を出力する工程と、
を含むことを特徴とする決定方法。
The process of reading the source code that is the subject of the unit inspection;
Extracting a conditional branch included in the source code;
Determining a setting value of the variable to be substituted when performing the unit test based on a combination of a value that can be included in the conditional expression of the conditional branch and a determination result of the conditional expression;
Outputting the determined set value;
A determination method characterized by comprising:
JP2017014504A 2017-01-30 2017-01-30 Determination program and determination method Pending JP2018124654A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017014504A JP2018124654A (en) 2017-01-30 2017-01-30 Determination program and determination method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017014504A JP2018124654A (en) 2017-01-30 2017-01-30 Determination program and determination method

Publications (1)

Publication Number Publication Date
JP2018124654A true JP2018124654A (en) 2018-08-09

Family

ID=63111446

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017014504A Pending JP2018124654A (en) 2017-01-30 2017-01-30 Determination program and determination method

Country Status (1)

Country Link
JP (1) JP2018124654A (en)

Similar Documents

Publication Publication Date Title
US9092586B1 (en) Version management mechanism for fluid guard ring PCells
WO2012032890A1 (en) Source code conversion method and source code conversion program
JP2000148808A (en) Method for verifying correctness of structural rtl for scheduled motion description
CN101751333A (en) Method, computer program and computer system for assisting in analyzing program
JP2007012003A (en) System for providing development environment of feature-oriented software product line
US8365114B2 (en) Logic modification synthesis
JP2017041171A (en) Test scenario generation support device and test scenario generation support method
US10628140B2 (en) Program code generation apparatus
JP6419667B2 (en) Test DB data generation method and apparatus
Fu et al. LLM4SecHW: Leveraging domain-specific large language model for hardware debugging
JP4445517B2 (en) Circuit design verification method and program for circuit design verification
Beller et al. The last line effect
CN112395198B (en) Software defect discovery method based on differential subgraph mining
CN112631925A (en) Method for detecting single variable atom violation defect
JP2018124654A (en) Determination program and determination method
JP2013077124A (en) Software test case generation device
CN112347723B (en) Layout-based ROM code extraction verification method and device
CN111666216B (en) Intelligent contract analysis method and device
JP6369269B2 (en) Verification support apparatus, verification support method, and computer program
JP2009134360A (en) Model inspection system, model inspection method, and model inspection program
CN106155898B (en) Method and device for acquiring path of flow chart
CN104038356A (en) Execution method, configuration apparatus and processing apparatus for data route
JP6723483B2 (en) Test case generation device, test case generation method, and test case generation program
CN112464636A (en) Constraint file comparison method and device, electronic equipment and storage medium
Akhtar et al. A Systematic Literature Review on Software-refactoring Techniques, Challenges, and Practices