@@ -56,16 +56,17 @@ let genTests = testList "Gen tests" [
5656 [ 8 ; 16 ; 32 ; 64 ; 128 ; 256 ; 512 ] <| fun count ->
5757
5858 let actual =
59- ( Range.constant DateTime.MinValue DateTime.MaxValue)
60- |> Gen.dateTime
59+ Gen.dateTime
60+ ( Range.constant DateTime.MinValue DateTime.MaxValue)
61+ ( Gen.constant DateTimeKind.Unspecified)
6162 |> Gen.sample 0 count
6263 |> Seq.toList
6364
6465 actual
6566 |> List.distinct
6667 |> List.length
6768 =! actual.Length
68-
69+
6970#if ! FABLE_ COMPILER
7071// See production code
7172 yield ! testCases " timeSpan creates TimeSpan instances"
@@ -97,45 +98,24 @@ let genTests = testList "Gen tests" [
9798 |> Seq.toList
9899 [] =! List.filter ( fun ch -> ch = char nonchar) actual
99100
100- testCase " dateTime randomly generates value between max and min ticks" <| fun _ ->
101- // This is a bad test because essentially the same logic used to
102- // implement Gen.dateTime appears in this test. However, keeping it for
103- // now.
104- let seed = Seed.random ()
105- let range =
106- Range.constant
107- DateTime.MinValue.Ticks
108- DateTime.MaxValue.Ticks
109- let ticks =
110- Random.integral range
111- |> Random.run seed 0
112-
113- let actual =
114- Range.constant DateTime.MinValue DateTime.MaxValue
115- |> Gen.dateTime
116- |> Gen.toRandom
117- |> Random.run seed 0
118- |> Tree.outcome
119-
120- let expected = DateTime ticks
121- actual =! expected
122-
123101 testCase " dateTime shrinks to correct mid-value" <| fun _ ->
124102 let generatedValues =
125103 property {
126104 let! actual =
127- ( Range.constantFrom
128- ( DateTime ( 2000 , 1 , 1 ))
129- DateTime.MinValue
130- DateTime.MaxValue)
131- |> Gen.dateTime
105+ Gen.dateTime
106+ ( Range.constantFrom
107+ ( DateTime ( 2000 , 1 , 1 ))
108+ DateTime.MinValue
109+ DateTime.MaxValue)
110+ ( Gen.constant DateTimeKind.Unspecified)
111+
132112 actual =! DateTime.Now
133113 }
134114 |> expectFailureWithGeneratedValues
135115
136116 if List.isEmpty generatedValues then
137117 failwith " Should have generated values in journal"
138-
118+
139119 let actual = generatedValues.[ 0 ] :?> DateTime
140120 actual =! DateTime ( 2000 , 1 , 1 )
141121
@@ -337,20 +317,20 @@ let genTests = testList "Gen tests" [
337317 let firstValues = System.Collections.Generic.HashSet< int>()
338318 let secondValues = System.Collections.Generic.HashSet< int>()
339319 let thirdValues = System.Collections.Generic.HashSet< int>()
340-
320+
341321 property {
342322 let! x = Gen.int32 ( Range.linear 1 100 )
343323 let! y = Gen.int32 ( Range.linear 1 100 )
344324 let! z = Gen.int32 ( Range.linear 1 100 )
345-
325+
346326 firstValues.Add( x) |> ignore
347327 secondValues.Add( y) |> ignore
348328 thirdValues.Add( z) |> ignore
349-
329+
350330 return true
351331 }
352332 |> Property.checkBoolWith ( PropertyConfig.withTests 100 < tests> PropertyConfig.defaults)
353-
333+
354334 // Each generator should produce multiple different values
355335 // If the seed wasn't threaded properly, they would all produce the same value
356336 firstValues.Count > 10 |> Expect.isTrue
0 commit comments