exam_LPP_T_5 0.1.2
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 +7 -0
- data/.coveralls.yml +2 -0
- data/.gitignore +20 -0
- data/.rspec +2 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/Guardfile +38 -0
- data/LICENSE.txt +22 -0
- data/README.md +7 -0
- data/README.rdoc +3 -0
- data/Rakefile +13 -0
- data/exam.gemspec +32 -0
- data/html/Exam.html +112 -0
- data/html/Exam/DList.html +569 -0
- data/html/Exam/Examen.html +335 -0
- data/html/Exam/Interfaz.html +333 -0
- data/html/Exam/List.html +323 -0
- data/html/Exam/Test.html +384 -0
- data/html/Exam/ToF.html +164 -0
- data/html/Inversor.html +112 -0
- data/html/Inverter.html +164 -0
- data/html/Object.html +119 -0
- data/html/README_rdoc.html +86 -0
- data/html/created.rid +13 -0
- data/html/fonts.css +167 -0
- data/html/fonts/Lato-Light.ttf +0 -0
- data/html/fonts/Lato-LightItalic.ttf +0 -0
- data/html/fonts/Lato-Regular.ttf +0 -0
- data/html/fonts/Lato-RegularItalic.ttf +0 -0
- data/html/fonts/SourceCodePro-Bold.ttf +0 -0
- data/html/fonts/SourceCodePro-Regular.ttf +0 -0
- data/html/images/add.png +0 -0
- data/html/images/arrow_up.png +0 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/transparent.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +108 -0
- data/html/js/darkfish.js +140 -0
- data/html/js/jquery.js +4 -0
- data/html/js/navigation.js +142 -0
- data/html/js/search.js +109 -0
- data/html/js/search_index.js +1 -0
- data/html/js/searcher.js +228 -0
- data/html/rdoc.css +580 -0
- data/html/table_of_contents.html +222 -0
- data/lib/exam.rb +8 -0
- data/lib/exam/d_list.rb +124 -0
- data/lib/exam/examen.rb +38 -0
- data/lib/exam/interfaz.rb +34 -0
- data/lib/exam/list.rb +57 -0
- data/lib/exam/quiz.rb +39 -0
- data/lib/exam/test.rb +37 -0
- data/lib/exam/tof.rb +9 -0
- data/lib/exam/version.rb +3 -0
- data/lib/inverter.rb +1 -0
- data/lib/inverter/reverse.rb +10 -0
- data/lib/inverter/version.rb +3 -0
- data/rspec_results.html +339 -0
- data/spec/exam_spec.rb +346 -0
- data/spec/spec_helper.rb +19 -0
- metadata +225 -0
@@ -0,0 +1,222 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>Table of Contents - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link href="./fonts.css" rel="stylesheet">
|
10
|
+
<link href="./rdoc.css" rel="stylesheet">
|
11
|
+
|
12
|
+
<script type="text/javascript">
|
13
|
+
var rdoc_rel_prefix = "./";
|
14
|
+
</script>
|
15
|
+
|
16
|
+
<script src="./js/jquery.js"></script>
|
17
|
+
<script src="./js/navigation.js"></script>
|
18
|
+
<script src="./js/search_index.js"></script>
|
19
|
+
<script src="./js/search.js"></script>
|
20
|
+
<script src="./js/searcher.js"></script>
|
21
|
+
<script src="./js/darkfish.js"></script>
|
22
|
+
|
23
|
+
|
24
|
+
<body id="top" class="table-of-contents">
|
25
|
+
<main role="main">
|
26
|
+
<h1 class="class">Table of Contents - RDoc Documentation</h1>
|
27
|
+
|
28
|
+
<h2 id="pages">Pages</h2>
|
29
|
+
<ul>
|
30
|
+
<li class="file">
|
31
|
+
<a href="README_rdoc.html">README</a>
|
32
|
+
</li>
|
33
|
+
|
34
|
+
</ul>
|
35
|
+
|
36
|
+
<h2 id="classes">Classes and Modules</h2>
|
37
|
+
<ul>
|
38
|
+
<li class="class">
|
39
|
+
<a href="Exam/DList.html">Exam::DList</a>
|
40
|
+
</li>
|
41
|
+
<li class="class">
|
42
|
+
<a href="Exam/Interfaz.html">Exam::Interfaz</a>
|
43
|
+
</li>
|
44
|
+
<li class="class">
|
45
|
+
<a href="Exam/List.html">Exam::List</a>
|
46
|
+
</li>
|
47
|
+
<li class="class">
|
48
|
+
<a href="Exam/Test.html">Exam::Test</a>
|
49
|
+
</li>
|
50
|
+
<li class="class">
|
51
|
+
<a href="Exam/ToF.html">Exam::ToF</a>
|
52
|
+
</li>
|
53
|
+
<li class="module">
|
54
|
+
<a href="Inverter.html">Inverter</a>
|
55
|
+
</li>
|
56
|
+
<li class="class">
|
57
|
+
<a href="Object.html">Object</a>
|
58
|
+
</li>
|
59
|
+
</ul>
|
60
|
+
|
61
|
+
<h2 id="methods">Methods</h2>
|
62
|
+
<ul>
|
63
|
+
|
64
|
+
<li class="method">
|
65
|
+
<a href="Exam/Interfaz.html#method-c-new">::new</a>
|
66
|
+
—
|
67
|
+
<span class="container">Exam::Interfaz</span>
|
68
|
+
|
69
|
+
<li class="method">
|
70
|
+
<a href="Exam/DList.html#method-c-new">::new</a>
|
71
|
+
—
|
72
|
+
<span class="container">Exam::DList</span>
|
73
|
+
|
74
|
+
<li class="method">
|
75
|
+
<a href="Exam/ToF.html#method-c-new">::new</a>
|
76
|
+
—
|
77
|
+
<span class="container">Exam::ToF</span>
|
78
|
+
|
79
|
+
<li class="method">
|
80
|
+
<a href="Exam/Examen.html#method-c-new">::new</a>
|
81
|
+
—
|
82
|
+
<span class="container">Exam::Examen</span>
|
83
|
+
|
84
|
+
<li class="method">
|
85
|
+
<a href="Exam/Test.html#method-c-new">::new</a>
|
86
|
+
—
|
87
|
+
<span class="container">Exam::Test</span>
|
88
|
+
|
89
|
+
<li class="method">
|
90
|
+
<a href="Exam/List.html#method-c-new">::new</a>
|
91
|
+
—
|
92
|
+
<span class="container">Exam::List</span>
|
93
|
+
|
94
|
+
<li class="method">
|
95
|
+
<a href="Exam/Test.html#method-i-3C-3D-3E">#<=></a>
|
96
|
+
—
|
97
|
+
<span class="container">Exam::Test</span>
|
98
|
+
|
99
|
+
<li class="method">
|
100
|
+
<a href="Exam/Test.html#method-i-3D-3D">#==</a>
|
101
|
+
—
|
102
|
+
<span class="container">Exam::Test</span>
|
103
|
+
|
104
|
+
<li class="method">
|
105
|
+
<a href="Exam/Test.html#method-i-check_ans">#check_ans</a>
|
106
|
+
—
|
107
|
+
<span class="container">Exam::Test</span>
|
108
|
+
|
109
|
+
<li class="method">
|
110
|
+
<a href="Exam/Examen.html#method-i-check_exam">#check_exam</a>
|
111
|
+
—
|
112
|
+
<span class="container">Exam::Examen</span>
|
113
|
+
|
114
|
+
<li class="method">
|
115
|
+
<a href="Exam/DList.html#method-i-each">#each</a>
|
116
|
+
—
|
117
|
+
<span class="container">Exam::DList</span>
|
118
|
+
|
119
|
+
<li class="method">
|
120
|
+
<a href="Exam/Interfaz.html#method-i-examinar">#examinar</a>
|
121
|
+
—
|
122
|
+
<span class="container">Exam::Interfaz</span>
|
123
|
+
|
124
|
+
<li class="method">
|
125
|
+
<a href="Exam/Examen.html#method-i-invertir">#invertir</a>
|
126
|
+
—
|
127
|
+
<span class="container">Exam::Examen</span>
|
128
|
+
|
129
|
+
<li class="method">
|
130
|
+
<a href="Exam/Interfaz.html#method-i-invertir_examen">#invertir_examen</a>
|
131
|
+
—
|
132
|
+
<span class="container">Exam::Interfaz</span>
|
133
|
+
|
134
|
+
<li class="method">
|
135
|
+
<a href="Exam/Interfaz.html#method-i-mostrar">#mostrar</a>
|
136
|
+
—
|
137
|
+
<span class="container">Exam::Interfaz</span>
|
138
|
+
|
139
|
+
<li class="method">
|
140
|
+
<a href="Exam/List.html#method-i-popHead">#popHead</a>
|
141
|
+
—
|
142
|
+
<span class="container">Exam::List</span>
|
143
|
+
|
144
|
+
<li class="method">
|
145
|
+
<a href="Exam/DList.html#method-i-popHead">#popHead</a>
|
146
|
+
—
|
147
|
+
<span class="container">Exam::DList</span>
|
148
|
+
|
149
|
+
<li class="method">
|
150
|
+
<a href="Exam/DList.html#method-i-popTail">#popTail</a>
|
151
|
+
—
|
152
|
+
<span class="container">Exam::DList</span>
|
153
|
+
|
154
|
+
<li class="method">
|
155
|
+
<a href="Exam/List.html#method-i-push">#push</a>
|
156
|
+
—
|
157
|
+
<span class="container">Exam::List</span>
|
158
|
+
|
159
|
+
<li class="method">
|
160
|
+
<a href="Exam/DList.html#method-i-pushHead">#pushHead</a>
|
161
|
+
—
|
162
|
+
<span class="container">Exam::DList</span>
|
163
|
+
|
164
|
+
<li class="method">
|
165
|
+
<a href="Exam/DList.html#method-i-pushTail">#pushTail</a>
|
166
|
+
—
|
167
|
+
<span class="container">Exam::DList</span>
|
168
|
+
|
169
|
+
<li class="method">
|
170
|
+
<a href="Exam/Interfaz.html#method-i-responder">#responder</a>
|
171
|
+
—
|
172
|
+
<span class="container">Exam::Interfaz</span>
|
173
|
+
|
174
|
+
<li class="method">
|
175
|
+
<a href="Inverter.html#method-i-reverse">#reverse</a>
|
176
|
+
—
|
177
|
+
<span class="container">Inverter</span>
|
178
|
+
|
179
|
+
<li class="method">
|
180
|
+
<a href="Exam/Examen.html#method-i-size">#size</a>
|
181
|
+
—
|
182
|
+
<span class="container">Exam::Examen</span>
|
183
|
+
|
184
|
+
<li class="method">
|
185
|
+
<a href="Exam/DList.html#method-i-size">#size</a>
|
186
|
+
—
|
187
|
+
<span class="container">Exam::DList</span>
|
188
|
+
|
189
|
+
<li class="method">
|
190
|
+
<a href="Exam/DList.html#method-i-to_is">#to_is</a>
|
191
|
+
—
|
192
|
+
<span class="container">Exam::DList</span>
|
193
|
+
|
194
|
+
<li class="method">
|
195
|
+
<a href="Exam/List.html#method-i-to_s">#to_s</a>
|
196
|
+
—
|
197
|
+
<span class="container">Exam::List</span>
|
198
|
+
|
199
|
+
<li class="method">
|
200
|
+
<a href="Exam/Test.html#method-i-to_s">#to_s</a>
|
201
|
+
—
|
202
|
+
<span class="container">Exam::Test</span>
|
203
|
+
|
204
|
+
<li class="method">
|
205
|
+
<a href="Exam/DList.html#method-i-to_s">#to_s</a>
|
206
|
+
—
|
207
|
+
<span class="container">Exam::DList</span>
|
208
|
+
|
209
|
+
<li class="method">
|
210
|
+
<a href="Exam/Examen.html#method-i-to_s">#to_s</a>
|
211
|
+
—
|
212
|
+
<span class="container">Exam::Examen</span>
|
213
|
+
</ul>
|
214
|
+
</main>
|
215
|
+
|
216
|
+
|
217
|
+
<footer id="validator-badges" role="contentinfo">
|
218
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
219
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.2.
|
220
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
221
|
+
</footer>
|
222
|
+
|
data/lib/exam.rb
ADDED
data/lib/exam/d_list.rb
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
module Exam
|
2
|
+
# create a DList
|
3
|
+
class DList
|
4
|
+
|
5
|
+
include Enumerable
|
6
|
+
|
7
|
+
attr_accessor :head, :tail
|
8
|
+
|
9
|
+
def each
|
10
|
+
aux=@head
|
11
|
+
while aux[:next]
|
12
|
+
yield aux[:value]
|
13
|
+
aux=aux[:next]
|
14
|
+
end
|
15
|
+
yield aux[:value]
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
def initialize(v)
|
20
|
+
if v.kind_of?(Array)
|
21
|
+
@head = Node.new(v[0],nil, nil)
|
22
|
+
v.shift
|
23
|
+
pushHead(v)
|
24
|
+
else
|
25
|
+
@head = Node.new(v, nil, nil)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def popHead
|
30
|
+
nodo = @head
|
31
|
+
if nodo
|
32
|
+
@head=@head[:next]
|
33
|
+
if @head
|
34
|
+
@head[:prev]=nil
|
35
|
+
end
|
36
|
+
return nodo[:value]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def popTail
|
41
|
+
nodo = @head
|
42
|
+
if nodo
|
43
|
+
while nodo[:next] do
|
44
|
+
nodo=nodo[:next]
|
45
|
+
end
|
46
|
+
aux=nodo[:prev]
|
47
|
+
aux[:next]=nil
|
48
|
+
nodo[:prev]=nil
|
49
|
+
return nodo[:value]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def pushHead(v)
|
54
|
+
if v.kind_of?(Array)
|
55
|
+
for i in 0..v.size-1
|
56
|
+
aux = @head
|
57
|
+
nodo=Node.new(v[i], aux, nil)
|
58
|
+
@head=nodo
|
59
|
+
aux[:prev]=@head
|
60
|
+
end
|
61
|
+
else
|
62
|
+
aux = @head
|
63
|
+
nodo=Node.new(v, aux, nil)
|
64
|
+
@head=nodo
|
65
|
+
aux[:prev]=@head
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def pushTail(v)
|
70
|
+
aux = @head
|
71
|
+
|
72
|
+
if v.kind_of?(Array)
|
73
|
+
for i in 0..v.size-1
|
74
|
+
while aux[:next]!=nil do
|
75
|
+
aux=aux[:next]
|
76
|
+
end
|
77
|
+
nuevo_nodo=Node.new(v[i], nil, aux)
|
78
|
+
aux[:next]=nuevo_nodo
|
79
|
+
end
|
80
|
+
else
|
81
|
+
while aux[:next] do
|
82
|
+
aux=aux[:next]
|
83
|
+
end
|
84
|
+
nuevo_nodo=Node.new(v, nil, aux)
|
85
|
+
aux[:next]=nuevo_nodo
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def size
|
90
|
+
aux=@head
|
91
|
+
n=0
|
92
|
+
while aux[:next] do
|
93
|
+
n=n+1
|
94
|
+
aux=aux[:next]
|
95
|
+
end
|
96
|
+
n=n+1
|
97
|
+
end
|
98
|
+
|
99
|
+
def to_s
|
100
|
+
aux=@head
|
101
|
+
s=""
|
102
|
+
while aux[:next] do
|
103
|
+
s = s + "#{aux[:value]} "
|
104
|
+
aux=aux[:next]
|
105
|
+
end
|
106
|
+
s = s + "#{aux[:value]}"
|
107
|
+
#puts "#{s}"
|
108
|
+
end
|
109
|
+
|
110
|
+
def to_is
|
111
|
+
aux=@head
|
112
|
+
s=""
|
113
|
+
while aux[:next] do
|
114
|
+
aux=aux[:next]
|
115
|
+
end
|
116
|
+
while aux[:prev] do
|
117
|
+
s = s + "#{aux[:value]} "
|
118
|
+
aux=aux[:prev]
|
119
|
+
end
|
120
|
+
s = s + "#{aux[:value]}"
|
121
|
+
#puts "#{s}"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
data/lib/exam/examen.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
module Exam
|
2
|
+
# create a Examen
|
3
|
+
class Examen
|
4
|
+
|
5
|
+
attr_accessor :list
|
6
|
+
|
7
|
+
def initialize(a)
|
8
|
+
@list = a
|
9
|
+
end
|
10
|
+
|
11
|
+
def check_exam(a)
|
12
|
+
list = @list.clone
|
13
|
+
n = 0
|
14
|
+
for i in 0..a.size-1
|
15
|
+
p = list.popHead
|
16
|
+
if (p.check_ans(a[i]))
|
17
|
+
n = n+1
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
#puts "#{n}/#{a.size}"
|
22
|
+
return "#{n}/#{a.size}"
|
23
|
+
end
|
24
|
+
|
25
|
+
def invertir
|
26
|
+
@list=reverse(@list)
|
27
|
+
end
|
28
|
+
|
29
|
+
def size
|
30
|
+
@list.size
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_s
|
34
|
+
@list.to_s
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Exam
|
2
|
+
# create a Interfaz
|
3
|
+
class Interfaz
|
4
|
+
|
5
|
+
attr_accessor :examen
|
6
|
+
|
7
|
+
def initialize(e)
|
8
|
+
@examen = e
|
9
|
+
end
|
10
|
+
|
11
|
+
def mostrar
|
12
|
+
puts @examen.to_s
|
13
|
+
end
|
14
|
+
|
15
|
+
def responder
|
16
|
+
a=[]
|
17
|
+
for i in 0..@examen.size-1
|
18
|
+
puts "Respuesta a la pregunta #{i+1}: "
|
19
|
+
a=a+[gets.chomp]
|
20
|
+
end
|
21
|
+
@examen.check_exam(a)
|
22
|
+
end
|
23
|
+
|
24
|
+
def examinar
|
25
|
+
mostrar
|
26
|
+
responder
|
27
|
+
end
|
28
|
+
|
29
|
+
def invertir_examen
|
30
|
+
@examen.invertir
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
data/lib/exam/list.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# create a Struct with :value, :next and :prev (for DList)
|
2
|
+
Node = Struct.new(:value, :next, :prev)
|
3
|
+
|
4
|
+
module Exam
|
5
|
+
# create a List
|
6
|
+
class List
|
7
|
+
attr_accessor :head
|
8
|
+
|
9
|
+
def initialize(v)
|
10
|
+
if v.kind_of?(Array)
|
11
|
+
@head = Node.new(v[0],nil)
|
12
|
+
v.shift
|
13
|
+
push(v)
|
14
|
+
else
|
15
|
+
@head = Node.new(v, nil)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def popHead
|
20
|
+
nodo = @head
|
21
|
+
@head=@head[:next]
|
22
|
+
return nodo[:value]
|
23
|
+
end
|
24
|
+
|
25
|
+
def push(v)
|
26
|
+
aux = @head
|
27
|
+
if v.kind_of?(Array)
|
28
|
+
for i in 0..v.size-1
|
29
|
+
a=v[i]
|
30
|
+
while aux[:next]!=nil do
|
31
|
+
aux=aux[:next]
|
32
|
+
end
|
33
|
+
nuevo_nodo=Node.new(a, nil)
|
34
|
+
aux[:next]=nuevo_nodo
|
35
|
+
end
|
36
|
+
else
|
37
|
+
while aux[:next] do
|
38
|
+
aux=aux[:next]
|
39
|
+
end
|
40
|
+
nuevo_nodo=Node.new(v, nil)
|
41
|
+
aux[:next]=nuevo_nodo
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def to_s
|
46
|
+
aux=@head
|
47
|
+
s="Lista: "
|
48
|
+
while aux[:next] do
|
49
|
+
s = s + "#{aux[:value]}" + " -> "
|
50
|
+
aux=aux[:next]
|
51
|
+
end
|
52
|
+
s = s + "#{aux[:value]}"
|
53
|
+
#puts "#{s}"
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|