mumuki-qsim-runner 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8344af1b99d0efa137e744b790bac1c493ef67b257a4058db638ed8935ad4606
4
- data.tar.gz: 1ae990e1197ffabdc7269893730067d67062ae748c5aa537d01fc266499615a4
3
+ metadata.gz: 5be822481a8dcdd5175e7359e5539597f0d97536bba0b67968d49a2e7249a08c
4
+ data.tar.gz: 3f9dab23f429cf07f1eb744d5a6cc46032547ff25ffaf0fc0a85579622e011c0
5
5
  SHA512:
6
- metadata.gz: d7156538f1ede88f2edce45fd6f09ef0c99bf3d79bde43f0a36fc467317f94f269399d9dc7e5e575d9db15e8ab8f590dda220c67f50355090789116244163951
7
- data.tar.gz: 99d427cdd46eab7d8a90923a06d06712e127f585ee9dff967e559574c44260f14a169019621c7ed64e8b9b7acfba3d3b8c037650c4b45dfacfba5adf2173a97c
6
+ metadata.gz: 37018b380d5d5405d8c262be206c792ae8f0b1f46a93e5d95af82bf2f87bb7d9e481fd9155eaf5fc3bd15536942f1db2dd5150077e04d95e9a7796ab6f6e4c90
7
+ data.tar.gz: a5c37a7c73968714c9770bebf5cbed872ee8b1b32c19c51a23d8f23e710ed073c61a0e30c82496a9c8c643d3ecb4621eddae324d5b1057a17f8773bdb7662587
data/lib/checker.rb CHANGED
@@ -5,10 +5,10 @@ module Qsim
5
5
  super
6
6
  end
7
7
 
8
- def check_equal(result, records)
9
- records.each do |record, expected|
10
- actual = result[:records][record]
11
- fail I18n.t(:check_equal_failure, record: record, expected: expected, actual: actual) unless actual == expected
8
+ def check_equal(result, state)
9
+ state.each do |target, expected|
10
+ actual = target_value result, target
11
+ fail I18n.t(:check_equal_failure, record: target, expected: expected, actual: actual) unless actual == expected
12
12
  end
13
13
  end
14
14
 
@@ -22,6 +22,17 @@ module Qsim
22
22
 
23
23
  private
24
24
 
25
+ def target_value(result, target)
26
+ case target
27
+ when /R\d/
28
+ result[:records][target]
29
+ when /[0-9A-F]{4}/
30
+ result[:memory][target]
31
+ else
32
+ error I18n.t :unknown_target, target: target
33
+ end
34
+ end
35
+
25
36
  def renderer
26
37
  @renderer ||= Qsim::HtmlRenderer.new
27
38
  end
data/lib/html_renderer.rb CHANGED
@@ -9,7 +9,7 @@ module Qsim
9
9
  fields = range(output_key, output)
10
10
  .map { |key| [key_for(output_key, key), '0000'] }
11
11
  .to_h
12
- .merge(result[output_key])
12
+ .tap { |it| it.merge!(result[output_key].slice(*it.keys)) }
13
13
  .sort
14
14
  @result[output_key] = fields
15
15
  end
data/lib/locales/en.yml CHANGED
@@ -4,3 +4,4 @@ en:
4
4
  special_records: 'Special records'
5
5
  flags: 'Flags'
6
6
  check_equal_failure: "<b>%{record}</b> should be <b>%{expected}</b>, but was <b>%{actual}</b>"
7
+ unknown_target: "Unknown target %{target}."
data/lib/locales/es.yml CHANGED
@@ -4,3 +4,4 @@ es:
4
4
  special_records: 'Registros especiales'
5
5
  flags: 'Banderas'
6
6
  check_equal_failure: "<b>%{record}</b> debería contener el valor <b>%{expected}</b>, pero se encontró <b>%{actual}</b>"
7
+ unknown_target: "Objetivo %{target} desconocido."
data/lib/test_hook.rb CHANGED
@@ -45,7 +45,7 @@ class QsimTestHook < Mumukit::Templates::FileHook
45
45
  def to_examples(examples)
46
46
  examples.each_with_index.map do |example, index|
47
47
  example[:preconditions] = classify(example.fetch(:preconditions, {}))
48
- example.merge(id: index, output: @output)
48
+ { id: index, output: @output }.deep_merge example
49
49
  end
50
50
  end
51
51
 
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module QsimVersionHook
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  end
@@ -20,7 +20,7 @@
20
20
  <h5><%= I18n.t :memory %></h5>
21
21
  <table class="table table-bordered qsim-fields">
22
22
  <tbody>
23
- <% @result[:memory].each_slice(10) do |group| %>
23
+ <% @result[:memory].each_slice(16) do |group| %>
24
24
  <tr>
25
25
  <% group.each.with_index do |record, index| %>
26
26
  <% if index.zero? %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumuki-qsim-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Federico Aloi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-19 00:00:00.000000000 Z
11
+ date: 2019-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit