Created
May 14, 2016 14:08
-
-
Save meson10/22d02310cd463d0c8cb8c306a6bc0de9 to your computer and use it in GitHub Desktop.
quick_testing.go
This file contains hidden or 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
package main | |
import ( | |
"log" | |
"math" | |
"testing" | |
"testing/quick" | |
) | |
func myMin(a, b float64) float64 { | |
log.Println(a, b) | |
if a < b { | |
return a | |
} else { | |
return b | |
} | |
} | |
func TestEquivalence(t *testing.T) { | |
var g = math.Min | |
config := quick.Config{ | |
MaxCount: 4, | |
} | |
if err := quick.CheckEqual(myMin, g, &config); err != nil { | |
t.Error(err) | |
} | |
} | |
type A struct { | |
Map map[int]float64 | |
Val int | |
} | |
func toTest(a A) bool { | |
log.Println(a) | |
return false | |
} | |
func TestCheck(t *testing.T) { | |
config := quick.Config{ | |
MaxCount: 4, | |
} | |
if err := quick.Check(toTest, &config); err != nil { | |
t.Error(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output