dbtap 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8ff6f5b046d3324a54837496af2f0727b541a34f
4
- data.tar.gz: 42f106382e26df6a255f32172f5e9f5c0423745a
3
+ metadata.gz: 039786803ec29d229e44f8a27dc6e9386f87487b
4
+ data.tar.gz: 9f5bcbd15573227c4b48ffc5aeebd197e533f198
5
5
  SHA512:
6
- metadata.gz: e464b3b5d0f57c32185d6029381c9cd6442037527854d7e75134c8ad240f62ab39b70dde72be71bebc0f4c46738d5c1c6a5977de4cbf714156ec4eefa2eae910
7
- data.tar.gz: 8ee1dd7ca87dc7ced01251f65fa250dc06eea9f67db701ad93c9760c63e6a1baf7d5d553cfde7d982e8c1f9bf29e03fa62921542e9e2746ecc94651555da5bd5
6
+ metadata.gz: d9201218165072d47ff44998463ab82cb77b5d695595e55b9c0d0d695322b18cad5b71d38d3c8f3b0842565cb903360515c16d44804ae0002c7a5a5fba038c0b
7
+ data.tar.gz: cb952364207d30940c1b64322c360341d0b0ada7b46978dcb2819a1f9995e423d0a1d606ec03a88ec429a62a20ffc7e3c9e76e00b84da2213369ad361ed9419c
data/CHANGELOG.md CHANGED
@@ -1,6 +1,21 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## 0.0.2 - 2014-08-20
5
+
6
+ ### Added
7
+ - More details to `PerformsWithin#errors`
8
+
9
+ ### Deprecated
10
+ - Nothing.
11
+
12
+ ### Removed
13
+ - Nothing.
14
+
15
+ ### Fixed
16
+ - PerformsWithin was comparing total time elapsed to average expected time/query.
17
+
18
+
4
19
  ## 0.0.1 - 2014-08-18
5
20
 
6
21
  ### Added
data/lib/dbtap/tapper.rb CHANGED
@@ -37,7 +37,7 @@ module Dbtap
37
37
  def not_ok(test, i)
38
38
  message = "not ok #{i + 1}"
39
39
  message += ' - ' + test.name if test.name
40
- message += "\n " + test.errors.split.join("\n ") if test.errors
40
+ message += "\n " + test.errors.join("\n ") if test.errors
41
41
  puts message
42
42
  end
43
43
 
@@ -22,20 +22,23 @@ module Dbtap
22
22
  end
23
23
 
24
24
  def ok?
25
- (expected_time - elapsed_time).abs.to_f / repetitions <= delta
25
+ time_diff.abs.to_f <= delta
26
26
  end
27
27
 
28
28
  def errors
29
29
  output = []
30
- output << " average runtime: #{elapsed_time} ms"
31
- output << " desired average: #{expected_time} +/- #{delta} ms"
32
-
33
- output.join("\n")
30
+ if time_diff < 0
31
+ output << "too slow by #{time_proportion}"
32
+ else
33
+ output << "too fast by #{time_proportion}"
34
+ end
35
+ output << "average runtime: #{elapsed_time} ms"
36
+ output << "desired average: #{expected_time} +/- #{delta} ms"
34
37
  end
35
38
 
36
39
  private
37
40
  def elapsed_time
38
- @elapsed_time ||= bench_it
41
+ @elapsed_time ||= bench_it / repetitions.to_f
39
42
  end
40
43
 
41
44
  def bench_it
@@ -49,5 +52,13 @@ module Dbtap
49
52
  def repetitions
50
53
  10
51
54
  end
55
+
56
+ def time_diff
57
+ expected_time - elapsed_time
58
+ end
59
+
60
+ def time_proportion
61
+ elapsed_time.to_f / expected_time
62
+ end
52
63
  end
53
64
  end
@@ -27,13 +27,14 @@ module Dbtap
27
27
  def errors
28
28
  output = []
29
29
  unless missing.empty?
30
- output << "Missing #{missing.count}/#{expected_count} Records:\n " + missing.first.inspect
30
+ output << "Missing #{missing.count}/#{expected_count} Records:"
31
+ output << ' ' + missing.first.inspect
31
32
  end
32
33
 
33
34
  unless extras.empty?
34
- output << "Extra #{extras.count} over #{expected_count} Records:\n " + extras.first.inspect
35
+ output << "Extra #{extras.count} over #{expected_count} Records:"
36
+ output << ' ' + extras.first.inspect
35
37
  end
36
- output.join("\n")
37
38
  end
38
39
 
39
40
  private
data/lib/dbtap/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dbtap
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbtap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Duryea
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-19 00:00:00.000000000 Z
11
+ date: 2014-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler