pg-verify 0.1.0 → 0.1.1
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 +4 -4
- data/Gemfile.lock +1 -18
- data/data/banner.txt +5 -0
- data/lib/pg-verify/cli/cli.rb +14 -0
- data/lib/pg-verify/version.rb +1 -1
- data/pg-verify.gemspec +0 -1
- metadata +2 -17
- data/data/project-template/.pg-verify.yml +0 -0
- data/data/project-template/program-graph.rb.resource +0 -103
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9b580ce77eaa5f2da5c136688b09db56a3397d810188fcfe8480a59bca92760a
|
|
4
|
+
data.tar.gz: 89a4e5af16afc5186326cb12615432cb17d38fb7e986b790b7e061cc53138541
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c3d040e30a27cf278ff987157b97abeb045d0cf12d209eacc7f4577e81ca39ae40bff1bff51ffb9581b030f5b28628ca08e84994b554c5ca8ac01773c1a8e4f5
|
|
7
|
+
data.tar.gz: 56f901795a267c9fea53f0a203122767cb50003fc18f510df455de9f3df715421a7b788321d3538f19e3e87ac3b5cac4d6d6e8908db16f935bf5481959197e9b
|
data/Gemfile.lock
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
pg-verify (0.1.
|
|
4
|
+
pg-verify (0.1.1)
|
|
5
5
|
config (~> 4.2.1)
|
|
6
|
-
ebnf (~> 2.3.4)
|
|
7
6
|
plantuml_builder (~> 0.3.0)
|
|
8
7
|
rainbow (~> 3.0.0)
|
|
9
8
|
thor (~> 1.2.1)
|
|
@@ -50,21 +49,10 @@ GEM
|
|
|
50
49
|
dry-core (~> 0.5, >= 0.5)
|
|
51
50
|
dry-initializer (~> 3.0)
|
|
52
51
|
dry-schema (~> 1.8, >= 1.8.0)
|
|
53
|
-
ebnf (2.3.4)
|
|
54
|
-
htmlentities (~> 4.3)
|
|
55
|
-
rdf (~> 3.2)
|
|
56
|
-
scanf (~> 1.0)
|
|
57
|
-
sxp (~> 1.2)
|
|
58
|
-
unicode-types (~> 1.8)
|
|
59
|
-
htmlentities (4.3.4)
|
|
60
|
-
link_header (0.0.8)
|
|
61
|
-
matrix (0.4.2)
|
|
62
52
|
plantuml_builder (0.3.0)
|
|
63
53
|
docopt (~> 0.5.0)
|
|
64
54
|
rainbow (3.0.0)
|
|
65
55
|
rake (13.0.6)
|
|
66
|
-
rdf (3.2.11)
|
|
67
|
-
link_header (~> 0.0, >= 0.0.8)
|
|
68
56
|
rspec (3.12.0)
|
|
69
57
|
rspec-core (~> 3.12.0)
|
|
70
58
|
rspec-expectations (~> 3.12.0)
|
|
@@ -78,12 +66,7 @@ GEM
|
|
|
78
66
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
79
67
|
rspec-support (~> 3.12.0)
|
|
80
68
|
rspec-support (3.12.0)
|
|
81
|
-
scanf (1.0.0)
|
|
82
|
-
sxp (1.2.4)
|
|
83
|
-
matrix (~> 0.4)
|
|
84
|
-
rdf (~> 3.2)
|
|
85
69
|
thor (1.2.1)
|
|
86
|
-
unicode-types (1.8.0)
|
|
87
70
|
|
|
88
71
|
PLATFORMS
|
|
89
72
|
x86_64-darwin-19
|
data/data/banner.txt
ADDED
data/lib/pg-verify/cli/cli.rb
CHANGED
|
@@ -93,6 +93,18 @@ module PgVerify
|
|
|
93
93
|
|
|
94
94
|
class BaseCommand < Thor
|
|
95
95
|
|
|
96
|
+
desc "version", "Print version information"
|
|
97
|
+
def version()
|
|
98
|
+
banner = File.read(File.join(PgVerify.root, "data", "banner.txt"))
|
|
99
|
+
banner = banner.gsub("0.1.0", PgVerify::VERSION)
|
|
100
|
+
colors = [ "red", "orange", "yellow", "orange", "red" ]
|
|
101
|
+
banner = banner.split("\n").each_with_index.map { |l, i| l.send(:"c_#{colors[i]}") }.join("\n")
|
|
102
|
+
puts banner
|
|
103
|
+
puts
|
|
104
|
+
puts "You are running #{'pg-verify'.c_string} version #{PgVerify::VERSION.to_s.c_num}"
|
|
105
|
+
puts "Installation root: #{PgVerify.root.to_s.c_file}"
|
|
106
|
+
end
|
|
107
|
+
|
|
96
108
|
desc "test", "Test the model specifications"
|
|
97
109
|
method_option :script, :type => :string
|
|
98
110
|
def test()
|
|
@@ -205,6 +217,8 @@ module PgVerify
|
|
|
205
217
|
# Copy the actual default config into the project as that
|
|
206
218
|
# will contain all keys and should be commented
|
|
207
219
|
FileUtils.cp(File.join(PgVerify.root, "data", "config", "pg-verify.yml"), File.join(target, ".pg-verify.yml"))
|
|
220
|
+
prelude_pg_file = File.join(PgVerify.root, "integration_tests", "ruby_dsl", "016_pressure_tank.rb")
|
|
221
|
+
FileUtils.cp(prelude_pg_file, File.join(target, Settings.ruby_dsl.default_script_name))
|
|
208
222
|
|
|
209
223
|
# Initialize git project
|
|
210
224
|
Dir.chdir(target) {
|
data/lib/pg-verify/version.rb
CHANGED
data/pg-verify.gemspec
CHANGED
|
@@ -30,7 +30,6 @@ Gem::Specification.new do |spec|
|
|
|
30
30
|
|
|
31
31
|
# Gem dependencies
|
|
32
32
|
spec.add_dependency "thor", "~> 1.2.1"
|
|
33
|
-
spec.add_dependency "ebnf", "~> 2.3.4"
|
|
34
33
|
spec.add_dependency "rainbow", "~> 3.0.0"
|
|
35
34
|
spec.add_dependency "config", "~> 4.2.1"
|
|
36
35
|
spec.add_dependency "plantuml_builder", "~> 0.3.0"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pg-verify
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Arian Weber
|
|
@@ -24,20 +24,6 @@ dependencies:
|
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: 1.2.1
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: ebnf
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - "~>"
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: 2.3.4
|
|
34
|
-
type: :runtime
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - "~>"
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: 2.3.4
|
|
41
27
|
- !ruby/object:Gem::Dependency
|
|
42
28
|
name: rainbow
|
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -97,13 +83,12 @@ files:
|
|
|
97
83
|
- bin/pg-verify.rb
|
|
98
84
|
- bin/setup
|
|
99
85
|
- calc.ebnf
|
|
86
|
+
- data/banner.txt
|
|
100
87
|
- data/config/pg-verify.yml
|
|
101
88
|
- data/nusmv.sample.smv
|
|
102
89
|
- data/project-template/.gitignore.resource
|
|
103
|
-
- data/project-template/.pg-verify.yml
|
|
104
90
|
- data/project-template/README.md
|
|
105
91
|
- data/project-template/addon/.keep
|
|
106
|
-
- data/project-template/program-graph.rb.resource
|
|
107
92
|
- devpg
|
|
108
93
|
- doc/examples/railroad_crossing.rb
|
|
109
94
|
- doc/examples/train-tree.rb
|
|
File without changes
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
####################################################################
|
|
2
|
-
# Model definition
|
|
3
|
-
####################################################################
|
|
4
|
-
|
|
5
|
-
model :FeelThePain do
|
|
6
|
-
|
|
7
|
-
# Define a graph called 'Hand'.
|
|
8
|
-
graph :Hand do
|
|
9
|
-
# The hand can be touching the fence or be somewhere else
|
|
10
|
-
# It starts in 'somewhere' as that state is listed first
|
|
11
|
-
states :somewhere, :at_fence
|
|
12
|
-
|
|
13
|
-
# Transition non-deterministically between those states
|
|
14
|
-
transition :somewhere => :somewhere
|
|
15
|
-
transition :somewhere => :at_fence
|
|
16
|
-
transition :at_fence => :somewhere
|
|
17
|
-
transition :at_fence => :at_fence
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
# Define another graph called 'PowerSwitch', which also
|
|
21
|
-
# transitions non-deterministically.
|
|
22
|
-
graph :PowerSwitch do
|
|
23
|
-
states :off, :on
|
|
24
|
-
transition :off => :off
|
|
25
|
-
transition :off => :on
|
|
26
|
-
transition :on => :off
|
|
27
|
-
transition :on => :on
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
graph :Fence do
|
|
31
|
-
# The fence has no states we are interested in
|
|
32
|
-
states :exists
|
|
33
|
-
|
|
34
|
-
# The fence has a voltage which can go up to 15
|
|
35
|
-
var :voltage => (0..12), init: 0
|
|
36
|
-
|
|
37
|
-
# The voltage increases when the power switch is on
|
|
38
|
-
transition :exists => :exists do
|
|
39
|
-
guard "PowerSwitch == on"
|
|
40
|
-
action "voltage := voltage + 1"
|
|
41
|
-
end
|
|
42
|
-
# ..and instantly stops when the switch is off
|
|
43
|
-
transition :exists => :exists do
|
|
44
|
-
guard "PowerSwitch == off"
|
|
45
|
-
action "voltage := 0"
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
graph :Pain do
|
|
51
|
-
# We can either be in pain or not
|
|
52
|
-
states :No, :Yes
|
|
53
|
-
# Using regular variables with string interpolation
|
|
54
|
-
pain_threshold = 7
|
|
55
|
-
transition :No => :Yes do
|
|
56
|
-
# action "voltage := 2"
|
|
57
|
-
guard "Hand == at_fence && voltage >= #{pain_threshold}"
|
|
58
|
-
end
|
|
59
|
-
transition :Yes => :No do
|
|
60
|
-
guard "Hand == somewhere || voltage < #{pain_threshold}"
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
####################################################################
|
|
65
|
-
# Validity tests
|
|
66
|
-
####################################################################
|
|
67
|
-
|
|
68
|
-
# Specification of validity characteristics regarding the hand.
|
|
69
|
-
# The 'specify' block serves as a namespace/container for the contained specifications
|
|
70
|
-
specify "The Hand" do
|
|
71
|
-
# Define some simple specs using a description text and an LTL expression
|
|
72
|
-
it "isn't always touching the fence" => :"F Hand == somewhere"
|
|
73
|
-
it "isn't always away form the fence" => :"F Hand == at_fence"
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
# Specification of validity characteristics regarding the pain
|
|
77
|
-
specify "The pain" do
|
|
78
|
-
# Use a regular LTL Formula as the expression
|
|
79
|
-
it "is felt at some point" => :"F Pain == Yes"
|
|
80
|
-
# Use a more declarative syntax. This becomes useful for complex expressions
|
|
81
|
-
# as LTL patterns can be used very easily
|
|
82
|
-
it "is always felt at some point" => ltl.globally.exists(:"Pain == Yes")
|
|
83
|
-
|
|
84
|
-
# Pattern: 'Universality', range: 'after q'
|
|
85
|
-
it "is felt after the switch is activated" => ltl.after(:"PowerSwitch == on").exists(:"Pain == Yes")
|
|
86
|
-
# Pattern: 'Absence', range: 'before q'
|
|
87
|
-
it "is never felt before the switch is activated" => ltl.before(:"PowerSwitch == on").never(:"Pain == Yes")
|
|
88
|
-
# Pattern: 'Reaction', range: 'global'
|
|
89
|
-
it "always reacts to the switch being activated" => ltl.globally.reacts(:"PowerSwitch == on", :"Pain == Yes")
|
|
90
|
-
|
|
91
|
-
# Define an assumption. That assumption must be true for all contained specs
|
|
92
|
-
assuming "the switch is never activated" => :"G PowerSwitch == off" do
|
|
93
|
-
it "is never felt " => :"G Pain == No"
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
# Assumptions can be nested and used with the declarative syntax.
|
|
97
|
-
assuming "the switch is activated" => ltl.globally.exists(:"PowerSwitch == No") do
|
|
98
|
-
assuming "the hand never touches the fence" => :"G Hand != at_fence" do
|
|
99
|
-
it "is never felt " => :"G Pain == No"
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
end
|