2016-11-14 9 views

答えて

11

あなたがCheck.QuickThrowOnFailureを使用する場合、それはこれらの値が設定されたコンフィギュレーションConfig.QuickThrowOnFailure、使用しています:

> Config.QuickThrowOnFailure;; 
val it : Config = 
    {MaxTest = 100; 
    MaxFail = 1000; 
    Replay = null; 
    Name = ""; 
    StartSize = 1; 
    EndSize = 100; 
    QuietOnSuccess = false; 
    Every = <fun:[email protected]>; 
    EveryShrink = <fun:[email protected]>; 
    Arbitrary = []; 
    Runner = <StartupCode$FsCheck>[email protected];} 

ここで考慮すべき重要な値がStartSizeですが、特にEndSizeを。 FsCheckのいくつかのジェネレータは、サイズのコンテキストを使用して、生成する値のサイズまたは範囲を判断します。

EndSizeをたとえばに変更すると、 1,000テストを失敗させることができます:

> Check.One({Config.QuickThrowOnFailure with EndSize = 1000}, fun (a:int) -> (add a 0) = a);; 
System.Exception: Falsifiable, after 15 tests (0 shrinks) (StdGen (1912816373,296229213)): 
Original: 
101 
with exception: 
> System.Exception: nasty bug 
    at FSI_0040.add(Int32 a, Int32 b) 
    at [email protected](Int32 a) 
    at FsCheck.Testable.evaluate[a,b](FSharpFunc`2 body, a a) in C:\Users\Kurt\Projects\FsCheck\FsCheck\src\FsCheck\Testable.fs:line 161 

    at <StartupCode$FsCheck>[email protected](String message) in C:\Users\Kurt\Projects\FsCheck\FsCheck\src\FsCheck\Runner.fs:line 365 
    at <StartupCode$FsCheck>[email protected](String , TestResult) in C:\Users\Kurt\Projects\FsCheck\FsCheck\src\FsCheck\Runner.fs:line 365 
    at FsCheck.Runner.check[a](Config config, a p) in C:\Users\Kurt\Projects\FsCheck\FsCheck\src\FsCheck\Runner.fs:line 275 
    at <StartupCode$FSI_0055>[email protected]() 
Stopped due to error 
+0

ありがとうございます!うまくいく – vidi

関連する問題