Created
February 3, 2014 03:01
-
-
Save kencoba/8778313 to your computer and use it in GitHub Desktop.
CFD法を学ぶ、第4回「ソフトウェアテスト技法ドリル」勉強会 ref: http://qiita.com/kencoba/items/958e7673e922fb3902b6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [CFD法を学ぶ、第4回「ソフトウェアテスト技法ドリル」勉強会](http://softest.cocolog-nifty.com/blog/2011/04/cfd4-28d6.html) | |
object 買い物合計金額 extends Enumeration { | |
type 買い物合計金額 = Value | |
val v2000円以上,その他 = Value | |
} | |
object カード持参 extends Enumeration { | |
type カード持参 = Value | |
val 持参している,持参していない = Value | |
} | |
object 支払方法 extends Enumeration { | |
type 支払方法 = Value | |
val 現金,現金以外 = Value | |
} | |
object 付与 extends Enumeration { | |
type 付与 = Value | |
val ポイント付与,付与なし = Value | |
} | |
import 買い物合計金額._ | |
import カード持参._ | |
import 支払方法._ | |
import 付与._ | |
def ディシジョンテーブル(a:買い物合計金額,b:カード持参,c:支払方法):付与 = { | |
(a,b,c) match { | |
case (v2000円以上,持参している,現金) => ポイント付与 | |
case (v2000円以上,持参している,現金以外) => 付与なし | |
case (v2000円以上,持参していない,c) => 付与なし | |
case (その他,b,c) => 付与なし | |
case (a,b,c) => 付与なし // ここはどうすんの? | |
} | |
} | |
println(ディシジョンテーブル(v2000円以上,持参していない,現金)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment