LEFT | RIGHT |
(no file at all) | |
1 // These tests verify the test running logic. | 1 // These tests verify the test running logic. |
2 | 2 |
3 package gocheck_test | 3 package gocheck_test |
4 | 4 |
5 import ( | 5 import ( |
6 . "launchpad.net/gocheck" | 6 . "launchpad.net/gocheck" |
7 "time" | 7 "time" |
8 ) | 8 ) |
9 | 9 |
10 var benchmarkS = Suite(&BenchmarkS{}) | 10 var benchmarkS = Suite(&BenchmarkS{}) |
(...skipping 22 matching lines...) Expand all Loading... |
33 Run(&helper, &runConf) | 33 Run(&helper, &runConf) |
34 | 34 |
35 expected := "(?s).*\nPASS: gocheck_test\\.go:[0-9]+: FixtureHelper\\.Set
UpSuite\t *0\\.001s\n.*" | 35 expected := "(?s).*\nPASS: gocheck_test\\.go:[0-9]+: FixtureHelper\\.Set
UpSuite\t *0\\.001s\n.*" |
36 c.Assert(output.value, Matches, expected) | 36 c.Assert(output.value, Matches, expected) |
37 } | 37 } |
38 | 38 |
39 func (s *BenchmarkS) TestBenchmark(c *C) { | 39 func (s *BenchmarkS) TestBenchmark(c *C) { |
40 helper := FixtureHelper{sleep: 100000} | 40 helper := FixtureHelper{sleep: 100000} |
41 output := String{} | 41 output := String{} |
42 runConf := RunConf{ | 42 runConf := RunConf{ |
43 » » Output: &output, | 43 » » Output: &output, |
44 » » Benchmark: true, | 44 » » Benchmark: true, |
45 BenchmarkTime: 10000000, | 45 BenchmarkTime: 10000000, |
46 » » Filter: "Benchmark1", | 46 » » Filter: "Benchmark1", |
47 } | 47 } |
48 Run(&helper, &runConf) | 48 Run(&helper, &runConf) |
49 c.Check(helper.calls[0], Equals, "SetUpSuite") | 49 c.Check(helper.calls[0], Equals, "SetUpSuite") |
50 c.Check(helper.calls[1], Equals, "SetUpTest") | 50 c.Check(helper.calls[1], Equals, "SetUpTest") |
51 c.Check(helper.calls[2], Equals, "Benchmark1") | 51 c.Check(helper.calls[2], Equals, "Benchmark1") |
52 c.Check(helper.calls[3], Equals, "TearDownTest") | 52 c.Check(helper.calls[3], Equals, "TearDownTest") |
53 c.Check(helper.calls[4], Equals, "SetUpTest") | 53 c.Check(helper.calls[4], Equals, "SetUpTest") |
54 c.Check(helper.calls[5], Equals, "Benchmark1") | 54 c.Check(helper.calls[5], Equals, "Benchmark1") |
55 c.Check(helper.calls[6], Equals, "TearDownTest") | 55 c.Check(helper.calls[6], Equals, "TearDownTest") |
56 // ... and more. | 56 // ... and more. |
57 | 57 |
58 expected := "PASS: gocheck_test\\.go:[0-9]+: FixtureHelper\\.Benchmark1\
t *100\t *[12][0-9]{5} ns/op\n" | 58 expected := "PASS: gocheck_test\\.go:[0-9]+: FixtureHelper\\.Benchmark1\
t *100\t *[12][0-9]{5} ns/op\n" |
59 c.Assert(output.value, Matches, expected) | 59 c.Assert(output.value, Matches, expected) |
60 } | 60 } |
61 | 61 |
62 func (s *BenchmarkS) TestBenchmarkBytes(c *C) { | 62 func (s *BenchmarkS) TestBenchmarkBytes(c *C) { |
63 helper := FixtureHelper{sleep: 100000} | 63 helper := FixtureHelper{sleep: 100000} |
64 output := String{} | 64 output := String{} |
65 runConf := RunConf{ | 65 runConf := RunConf{ |
66 » » Output: &output, | 66 » » Output: &output, |
67 » » Benchmark: true, | 67 » » Benchmark: true, |
68 BenchmarkTime: 10000000, | 68 BenchmarkTime: 10000000, |
69 » » Filter: "Benchmark2", | 69 » » Filter: "Benchmark2", |
70 } | 70 } |
71 Run(&helper, &runConf) | 71 Run(&helper, &runConf) |
72 | 72 |
73 expected := "PASS: gocheck_test\\.go:[0-9]+: FixtureHelper\\.Benchmark2\
t *100\t *[12][0-9]{5} ns/op\t *[4-9]\\.[0-9]{2} MB/s\n" | 73 expected := "PASS: gocheck_test\\.go:[0-9]+: FixtureHelper\\.Benchmark2\
t *100\t *[12][0-9]{5} ns/op\t *[4-9]\\.[0-9]{2} MB/s\n" |
74 c.Assert(output.value, Matches, expected) | 74 c.Assert(output.value, Matches, expected) |
75 } | 75 } |
LEFT | RIGHT |