mumuki-qsim-runner 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/multiple_executions_runner.rb +10 -0
- data/lib/qsim_runner.rb +1 -0
- data/lib/test_hook.rb +61 -6
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e328f5107c8be0e6be6afbfc57da5155a8bf9b94
|
4
|
+
data.tar.gz: 933c6c30132d17a78166df63bb672a3306944af3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1211643581f06df53885d4cc368da7b05e18524b3ad37766cb2cd0018bbae1d8aff01db35adc2771bdbe4e50a11565eb6f9aff50c29bb981c350202a86f4682
|
7
|
+
data.tar.gz: db5bcf5ed50f23e1ecb33b100be94c97c5ec6a2efa4ad1ed115bc682e6cdbcc63358c0448bf92076e54d59597299e9e1d61a1d49ae218d6c8d36a24f1178f763
|
data/lib/qsim_runner.rb
CHANGED
data/lib/test_hook.rb
CHANGED
@@ -1,18 +1,28 @@
|
|
1
1
|
class QsimTestHook < Mumukit::Templates::FileHook
|
2
|
+
include Mumukit::WithTempfile
|
2
3
|
isolated true
|
3
|
-
mashup :extra, :content
|
4
4
|
|
5
5
|
def tempfile_extension
|
6
6
|
'.qsim'
|
7
7
|
end
|
8
8
|
|
9
9
|
def command_line(filename)
|
10
|
-
"runqsim #{filename}
|
10
|
+
"runqsim #{filename} #{q_architecture} #{input_file_separator}"
|
11
11
|
end
|
12
12
|
|
13
13
|
def compile_file_content(request)
|
14
|
-
@examples = parse_test(request)[:examples]
|
15
|
-
|
14
|
+
@examples = to_examples(parse_test(request)[:examples])
|
15
|
+
|
16
|
+
<<EOF
|
17
|
+
CALL main
|
18
|
+
|
19
|
+
#{request.extra}
|
20
|
+
|
21
|
+
main:
|
22
|
+
#{request.content}
|
23
|
+
#{input_file_separator}
|
24
|
+
#{initial_state_file}
|
25
|
+
EOF
|
16
26
|
end
|
17
27
|
|
18
28
|
def execute!(request)
|
@@ -35,16 +45,61 @@ class QsimTestHook < Mumukit::Templates::FileHook
|
|
35
45
|
|
36
46
|
private
|
37
47
|
|
48
|
+
def to_examples(examples)
|
49
|
+
defaults = { preconditions: {} }
|
50
|
+
examples.each_with_index.map { |example, index| defaults.merge(example).merge(id: index) }
|
51
|
+
end
|
52
|
+
|
38
53
|
def framework
|
39
54
|
Mumukit::Metatest::Framework.new checker: Qsim::Checker.new,
|
40
|
-
runner:
|
55
|
+
runner: Qsim::MultipleExecutionsRunner.new
|
41
56
|
end
|
42
57
|
|
43
58
|
def parse_json(json_result)
|
44
|
-
JSON.parse(json_result).deep_symbolize_keys
|
59
|
+
JSON.parse(json_result).map(&:deep_symbolize_keys)
|
45
60
|
end
|
46
61
|
|
47
62
|
def parse_test(request)
|
48
63
|
YAML.load(request.test).deep_symbolize_keys
|
49
64
|
end
|
65
|
+
|
66
|
+
def default_initial_state
|
67
|
+
{
|
68
|
+
special_records: {
|
69
|
+
PC: '0000',
|
70
|
+
SP: 'FFEF',
|
71
|
+
IR: '0000'
|
72
|
+
},
|
73
|
+
flags: {
|
74
|
+
N: 0,
|
75
|
+
Z: 0,
|
76
|
+
V: 0,
|
77
|
+
C: 0
|
78
|
+
},
|
79
|
+
records: {
|
80
|
+
R0: '0000',
|
81
|
+
R1: '0000',
|
82
|
+
R2: '0000',
|
83
|
+
R3: '0000',
|
84
|
+
R4: '0000',
|
85
|
+
R5: '0000',
|
86
|
+
R6: '0000',
|
87
|
+
R7: '0000'
|
88
|
+
},
|
89
|
+
memory: {}
|
90
|
+
}
|
91
|
+
end
|
92
|
+
|
93
|
+
def initial_state_file
|
94
|
+
initial_states = @examples.map { |example| default_initial_state.merge(id: example[:id]).merge(example[:preconditions]) }
|
95
|
+
JSON.generate initial_states
|
96
|
+
end
|
97
|
+
|
98
|
+
def input_file_separator
|
99
|
+
'!!!BEGIN_EXAMPLES!!!'
|
100
|
+
end
|
101
|
+
|
102
|
+
def q_architecture
|
103
|
+
6
|
104
|
+
end
|
50
105
|
end
|
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.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Leonardo Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mumukit
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- lib/locales/en.yml
|
107
107
|
- lib/locales/es.yml
|
108
108
|
- lib/metadata_hook.rb
|
109
|
+
- lib/multiple_executions_runner.rb
|
109
110
|
- lib/qsim_runner.rb
|
110
111
|
- lib/records.html.erb
|
111
112
|
- lib/test_hook.rb
|