judges 0.32.0 → 0.34.0

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
  SHA256:
3
- metadata.gz: dbd1af811d8d197e9ff7fc69984beafe4da411f607921d0f830863e038b5e010
4
- data.tar.gz: f2cf711c9995259b29cf14ee0f7570fbd64eb96fcb9b4bb07fe274885492d1d8
3
+ metadata.gz: 0e26309233bda6e09c9673cc9b17b3a6309897e2e2a19505288889fe947af3d7
4
+ data.tar.gz: 895a20352dd34b430f3001de0ba8c5eb97e0f1fd2de77386ad63d9282831e021
5
5
  SHA512:
6
- metadata.gz: 95b145038016993ec341e2d457f57e84c98b4a263b80d23daa15fae4465b1ca976c142fca2b85edfbf1030ddefc00301a8974cb60cd2533c8e5360bad34d7b1e
7
- data.tar.gz: bca1b02140ee43e246052fdc67e1e2d452d507652f6b68b2226388761d4237a50255cb4ab81311b5bdd1c60891badcb582112a4e236ceb343662ca4327d8d5c7
6
+ metadata.gz: 7bb06d82f69a67972774c2a7ef92bfc1655bcd30f4c162cae6d1669192725a3e7fc28efecaab9fda0bf3ac4a31b84725412248009ff22a7c77e289ae0699947c
7
+ data.tar.gz: 621ea22a9b604c2433e07ff6a5c241c86d8559de17b59def8d2878477fe5c4340a565090daa38770b054d81960ec45250db10282dd356b05367397fba066e65c
data/.rubocop.yml CHANGED
@@ -51,3 +51,4 @@ Layout/MultilineAssignmentLayout:
51
51
  Enabled: true
52
52
  Layout/FirstHashElementIndentation:
53
53
  EnforcedStyle: consistent
54
+ require: []
data/Gemfile.lock CHANGED
@@ -113,7 +113,7 @@ GEM
113
113
  erubi (1.13.1)
114
114
  ethon (0.16.0)
115
115
  ffi (>= 1.15.0)
116
- factbase (0.7.1)
116
+ factbase (0.7.3)
117
117
  backtrace (> 0)
118
118
  decoor (> 0)
119
119
  json (~> 2.7)
data/README.md CHANGED
@@ -40,6 +40,7 @@ before:
40
40
  category: slow
41
41
  runs: 1
42
42
  skip: false
43
+ repeat: 20
43
44
  input:
44
45
  -
45
46
  foo: 42
@@ -65,6 +66,9 @@ when the test is finished.
65
66
  The `category` (default: `[]`) may have one or an array of categories,
66
67
  which then may be turned on via the `--category` command line flag.
67
68
 
69
+ The `repeat` (default: `1`) makes `input` to be repeated multiple times
70
+ (mostly useful for speed measuring on big data inputs).
71
+
68
72
  The `runs` (default: `1`) is the number of times the `.rb` script should
69
73
  be executed. After each execution, all expected XPath expressions are validated.
70
74
 
data/REUSE.toml CHANGED
@@ -4,13 +4,17 @@
4
4
  version = 1
5
5
  [[annotations]]
6
6
  path = [
7
+ "**/*.csv",
7
8
  "**/*.jpg",
8
9
  "**/*.json",
9
10
  "**/*.md",
10
11
  "**/*.pdf",
11
12
  "**/*.png",
12
13
  "**/*.svg",
14
+ "**/*.txt",
15
+ "**/*.vm",
13
16
  "**/.gitignore",
17
+ "**/CNAME",
14
18
  ".gitattributes",
15
19
  ".gitignore",
16
20
  ".gitleaksignore",
@@ -7,7 +7,7 @@ Feature: Test
7
7
  Scenario: Simple test of a few judges
8
8
  Given I run bin/judges with "test ./fixtures"
9
9
  Then Stdout contains "👉 Testing"
10
- Then Stdout contains "All 2 judge(s) and 2 tests passed"
10
+ Then Stdout contains "All 3 judge(s) and 3 tests passed"
11
11
  And Exit code is zero
12
12
 
13
13
  Scenario: Simple test of just one judge
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
5
+
6
+ # nothing to do here
@@ -0,0 +1,9 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
3
+ ---
4
+ repeat: 10
5
+ input:
6
+ -
7
+ foo: 1
8
+ expected:
9
+ - /fb[count(f)=10]
data/judges.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
10
10
  s.required_ruby_version = '>=3.2'
11
11
  s.name = 'judges'
12
- s.version = '0.32.0'
12
+ s.version = '0.34.0'
13
13
  s.license = 'MIT'
14
14
  s.summary = 'Command-Line Tool for a Factbase'
15
15
  s.description =
@@ -39,6 +39,7 @@ class Judges::Test
39
39
  tested = 0
40
40
  tests = 0
41
41
  visible = []
42
+ times = {}
42
43
  judges = Judges::Judges.new(dir, opts['lib'], @loog)
43
44
  elapsed(@loog, level: Logger::INFO) do
44
45
  judges.each_with_index do |judge, i|
@@ -67,7 +68,9 @@ class Judges::Test
67
68
  @loog.info("Running #{j.script} judge as a pre-condition...")
68
69
  test_one(fb, opts, j, n, yaml, assert: false)
69
70
  end
71
+ start = Time.now
70
72
  test_one(fb, opts, judge, tname, yaml)
73
+ times["#{judge.name}/#{tname}"] = Time.now - start
71
74
  yaml['after']&.each do |rb|
72
75
  @loog.info("Running #{rb} assertion script...")
73
76
  $fb = fb
@@ -82,6 +85,17 @@ class Judges::Test
82
85
  end
83
86
  tested += 1
84
87
  end
88
+ unless times.empty?
89
+ fmt = "%60s\t%9s"
90
+ @loog.info(
91
+ [
92
+ 'Time summaries:',
93
+ format(fmt, 'Script', 'Seconds'),
94
+ format(fmt, '---', '---'),
95
+ times.map { |script, sec| format(fmt, script, format('%.3f', sec)) }.join("\n ")
96
+ ].join("\n ")
97
+ )
98
+ end
85
99
  throw :'👍 No judges tested' if tested.zero?
86
100
  throw :"👍 All #{tested} judge(s) but no tests passed" if tests.zero?
87
101
  throw :"👍 All #{tested} judge(s) and #{tests} tests passed" if errors.empty?
@@ -112,15 +126,17 @@ class Judges::Test
112
126
 
113
127
  def prepare(fb, yaml)
114
128
  inputs = yaml['input']
115
- inputs&.each do |i|
116
- f = fb.insert
117
- i.each do |k, vv|
118
- if vv.is_a?(Array)
119
- vv.each do |v|
120
- f.send(:"#{k}=", v)
129
+ (yaml['repeat']&.to_i || 1).times do
130
+ inputs&.each do |i|
131
+ f = fb.insert
132
+ i.each do |k, vv|
133
+ if vv.is_a?(Array)
134
+ vv.each do |v|
135
+ f.send(:"#{k}=", v)
136
+ end
137
+ else
138
+ f.send(:"#{k}=", vv)
121
139
  end
122
- else
123
- f.send(:"#{k}=", vv)
124
140
  end
125
141
  end
126
142
  end
data/lib/judges.rb CHANGED
@@ -8,5 +8,5 @@
8
8
  # Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
9
9
  # License:: MIT
10
10
  module Judges
11
- VERSION = '0.32.0'
11
+ VERSION = '0.34.0'
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: judges
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.32.0
4
+ version: 0.34.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-24 00:00:00.000000000 Z
11
+ date: 2025-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace
@@ -272,6 +272,8 @@ files:
272
272
  - fixtures/guess/guess.rb
273
273
  - fixtures/guess/guess_made.yml
274
274
  - fixtures/guess/skipped.yml
275
+ - fixtures/repeat/repeat.rb
276
+ - fixtures/repeat/repeated.yml
275
277
  - fixtures/try/tried.yml
276
278
  - fixtures/try/try.rb
277
279
  - judges.gemspec