mumukit 2.26.0 → 2.27.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mumukit/metatest/checker.rb +42 -7
- data/lib/mumukit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa9b52569d8acc92b3996ab2797748cb26b04c8b424eabe47c8ea1fcd8f554a0
|
4
|
+
data.tar.gz: 18a004a9b5ccf64c278952ac02ac3fc1f5942c3acbd06ed583c5623c8c422f49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c403421b59fde8fb7a27ca8448d43a1331b86d590199278b5bf26f7ae76c165220ab67d97bf6eff63c8a082aa1b3de59ab51e1b90968dbf7056c2db36182603
|
7
|
+
data.tar.gz: a03dba8b04f49b4dfa4a0127db26021f47d6d9ca550ef8bd0ac30c2578c660ac990701622e887120293369c7c2efdebd290c87a2cf8c4b6763ab9abe2a7b44fb
|
@@ -1,10 +1,39 @@
|
|
1
1
|
module Mumukit::Metatest
|
2
2
|
class Checker
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
|
4
|
+
## Check an input against a metatest example.
|
5
|
+
## The example has the following shape:
|
6
|
+
##
|
7
|
+
## ```
|
8
|
+
## {
|
9
|
+
## name: 'an example name',
|
10
|
+
## postconditions: {
|
11
|
+
## an_assertion: assertion_config,
|
12
|
+
## another_assertion: assertion_config,
|
13
|
+
## }
|
14
|
+
## }
|
15
|
+
## ```
|
16
|
+
##
|
17
|
+
## Alternatively, the `postconditions` key may be omitted:
|
18
|
+
##
|
19
|
+
## ```
|
20
|
+
## {
|
21
|
+
## name: 'an example name',
|
22
|
+
## an_assertion: assertion_config,
|
23
|
+
## another_assertion: assertion_config,
|
24
|
+
## }
|
25
|
+
##
|
26
|
+
def check(input, example)
|
27
|
+
check_assertions input, postconditions_for(example), example
|
28
|
+
[example[:name], :passed, render_success_output(input)]
|
6
29
|
rescue => e
|
7
|
-
[example[:name], :failed, render_error_output(
|
30
|
+
[example[:name], :failed, render_error_output(input, e.message)]
|
31
|
+
end
|
32
|
+
|
33
|
+
## If no postconditions are included in the example,
|
34
|
+
## all the example except by the name is considered as postconditions
|
35
|
+
def postconditions_for(example)
|
36
|
+
example[:postconditions] || example.except(:name)
|
8
37
|
end
|
9
38
|
|
10
39
|
def render_success_output(value)
|
@@ -15,8 +44,14 @@ module Mumukit::Metatest
|
|
15
44
|
error
|
16
45
|
end
|
17
46
|
|
18
|
-
def
|
19
|
-
|
47
|
+
def check_assertions(input, assertions_hash, example)
|
48
|
+
assertions_hash.each do |assertion_name, assertion_config|
|
49
|
+
check_assertion assertion_name, input, assertion_config, example
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def check_assertion(assertion_name, input, assertion_config, _example)
|
54
|
+
send "check_#{assertion_name}", input, assertion_config
|
20
55
|
end
|
21
56
|
|
22
57
|
def fail(message)
|
@@ -31,4 +66,4 @@ module Mumukit::Metatest
|
|
31
66
|
raise Mumukit::Metatest::Errored, message
|
32
67
|
end
|
33
68
|
end
|
34
|
-
end
|
69
|
+
end
|
data/lib/mumukit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumukit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.27.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: 2018-
|
11
|
+
date: 2018-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|