dbtap 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/Gemfile +0 -1
- data/lib/dbtap/tapper.rb +10 -4
- data/lib/dbtap/testers/performs_within.rb +7 -2
- data/lib/dbtap/testers/set_eq.rb +15 -0
- data/lib/dbtap/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 939d118308673dee3dc9c2e14186763478b08af9
|
4
|
+
data.tar.gz: 2f7f4880f88d9906d5860f1aa16521719f3b136f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f94b2b94e94963b0c5b13b4fbe2726e239dd598a2ad972d44a1173d0b8b5820e59bc791a13f82332108038201d5be53a007cbd69f2d5d4e2d2fd2521317f910
|
7
|
+
data.tar.gz: acd7edcc25879cb636a695db92711ff031941d55dcee3387b18dd1227107b858b91dad3c6a97753544f6cfe0110facbf54da65b104beb63f129243ad9d316601
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,22 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## 0.0.3 - 2015-12-11
|
5
|
+
|
6
|
+
### Added
|
7
|
+
- Print SQL and error if a test raises a Sequel::DatabaseError
|
8
|
+
- For set_eq, save a copy of all results to /tmp/actual.csv
|
9
|
+
|
10
|
+
### Deprecated
|
11
|
+
- Nothing.
|
12
|
+
|
13
|
+
### Removed
|
14
|
+
- Nothing.
|
15
|
+
|
16
|
+
### Fixed
|
17
|
+
- PerformsWithin reports too fast/slow as a factor of time.
|
18
|
+
|
19
|
+
|
4
20
|
## 0.0.2 - 2014-08-20
|
5
21
|
|
6
22
|
### Added
|
data/Gemfile
CHANGED
data/lib/dbtap/tapper.rb
CHANGED
@@ -10,6 +10,7 @@ module Dbtap
|
|
10
10
|
attr :tests
|
11
11
|
def initialize
|
12
12
|
@tests = []
|
13
|
+
db.extension :error_sql
|
13
14
|
end
|
14
15
|
|
15
16
|
# Drives the evaluation of each test, emitting TAP-compliant messages
|
@@ -17,10 +18,15 @@ module Dbtap
|
|
17
18
|
def run
|
18
19
|
puts (1..tests.length).to_s
|
19
20
|
tests.each_with_index do |test, i|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
begin
|
22
|
+
if test.is_ok?
|
23
|
+
ok(test, i)
|
24
|
+
else
|
25
|
+
not_ok(test, i)
|
26
|
+
end
|
27
|
+
rescue Sequel::DatabaseError
|
28
|
+
puts $!.sql
|
29
|
+
raise $!
|
24
30
|
end
|
25
31
|
end
|
26
32
|
end
|
@@ -28,9 +28,9 @@ module Dbtap
|
|
28
28
|
def errors
|
29
29
|
output = []
|
30
30
|
if time_diff < 0
|
31
|
-
output << "too slow by #{
|
31
|
+
output << "too slow by factor of #{time_factor}"
|
32
32
|
else
|
33
|
-
output << "too fast by #{
|
33
|
+
output << "too fast by factor of #{time_factor}"
|
34
34
|
end
|
35
35
|
output << "average runtime: #{elapsed_time} ms"
|
36
36
|
output << "desired average: #{expected_time} +/- #{delta} ms"
|
@@ -60,5 +60,10 @@ module Dbtap
|
|
60
60
|
def time_proportion
|
61
61
|
elapsed_time.to_f / expected_time
|
62
62
|
end
|
63
|
+
|
64
|
+
def time_factor
|
65
|
+
return time_proportion if time_proportion > 1
|
66
|
+
return (1 / time_proportion)
|
67
|
+
end
|
63
68
|
end
|
64
69
|
end
|
data/lib/dbtap/testers/set_eq.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'csv'
|
1
2
|
require_relative 'tester'
|
2
3
|
|
3
4
|
module Dbtap
|
@@ -25,6 +26,7 @@ module Dbtap
|
|
25
26
|
end
|
26
27
|
|
27
28
|
def errors
|
29
|
+
drop_csv
|
28
30
|
output = []
|
29
31
|
unless missing.empty?
|
30
32
|
output << "Missing #{missing.count}/#{expected_count} Records:"
|
@@ -49,5 +51,18 @@ module Dbtap
|
|
49
51
|
def expected_count
|
50
52
|
@expected_count = expected.count
|
51
53
|
end
|
54
|
+
|
55
|
+
def drop_csv
|
56
|
+
rows = actual.all
|
57
|
+
CSV.open('/tmp/actual.csv', 'w') do |csv|
|
58
|
+
unless rows.empty?
|
59
|
+
csv << rows.first.keys
|
60
|
+
end
|
61
|
+
|
62
|
+
rows.each do |row|
|
63
|
+
csv << row.values
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
52
67
|
end
|
53
68
|
end
|
data/lib/dbtap/version.rb
CHANGED
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.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Duryea
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
116
|
version: '0'
|
117
117
|
requirements: []
|
118
118
|
rubyforge_project:
|
119
|
-
rubygems_version: 2.
|
119
|
+
rubygems_version: 2.4.5.1
|
120
120
|
signing_key:
|
121
121
|
specification_version: 4
|
122
122
|
summary: Write database-agnostic, TAP-emitting unit tests for your database
|