exam1 0.0.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 +7 -0
- data/.coveralls.yml +2 -0
- data/.coveralls.yml~ +0 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/.travis.yml~ +0 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +38 -0
- data/Rakefile +18 -0
- data/exam1.gemspec +30 -0
- data/exam1.gemspec~ +23 -0
- data/lib/exam1.rb +9 -0
- data/lib/exam1/SeleccionSimple.rb +86 -0
- data/lib/exam1/SeleccionSimple.rb~ +86 -0
- data/lib/exam1/doc/Exam1.html +112 -0
- data/lib/exam1/doc/Examen.html +484 -0
- data/lib/exam1/doc/Interfaz.html +384 -0
- data/lib/exam1/doc/List.html +467 -0
- data/lib/exam1/doc/Nodo.html +167 -0
- data/lib/exam1/doc/Object.html +119 -0
- data/lib/exam1/doc/SeleccionSimple.html +361 -0
- data/lib/exam1/doc/SeleccionSimple_rb~.html +237 -0
- data/lib/exam1/doc/Verdadero_Falso.html +208 -0
- data/lib/exam1/doc/created.rid +60 -0
- data/lib/exam1/doc/doc/Exam1_html.html +230 -0
- data/lib/exam1/doc/doc/Examen_html.html +556 -0
- data/lib/exam1/doc/doc/Interfaz_html.html +468 -0
- data/lib/exam1/doc/doc/List_html.html +531 -0
- data/lib/exam1/doc/doc/Nodo_html.html +285 -0
- data/lib/exam1/doc/doc/Object_html.html +237 -0
- data/lib/exam1/doc/doc/SeleccionSimple_html.html +454 -0
- data/lib/exam1/doc/doc/SeleccionSimple_rb~_html.html +377 -0
- data/lib/exam1/doc/doc/Verdadero_Falso_html.html +318 -0
- data/lib/exam1/doc/doc/examen_rb~_html.html +425 -0
- data/lib/exam1/doc/doc/fonts_css.html +307 -0
- data/lib/exam1/doc/doc/index_html.html +241 -0
- data/lib/exam1/doc/doc/js/darkfish_js.html +286 -0
- data/lib/exam1/doc/doc/js/jquery_js.html +1450 -0
- data/lib/exam1/doc/doc/js/navigation_js.html +271 -0
- data/lib/exam1/doc/doc/js/search_index_js.html +177 -0
- data/lib/exam1/doc/doc/js/search_js.html +240 -0
- data/lib/exam1/doc/doc/js/searcher_js.html +358 -0
- data/lib/exam1/doc/doc/linkedlist_rb~_html.html +345 -0
- data/lib/exam1/doc/doc/rdoc_css.html +844 -0
- data/lib/exam1/doc/doc/table_of_contents_html.html +352 -0
- data/lib/exam1/doc/examen_rb~.html +300 -0
- data/lib/exam1/doc/fonts.css +167 -0
- data/lib/exam1/doc/fonts/Lato-Light.ttf +0 -0
- data/lib/exam1/doc/fonts/Lato-LightItalic.ttf +0 -0
- data/lib/exam1/doc/fonts/Lato-Regular.ttf +0 -0
- data/lib/exam1/doc/fonts/Lato-RegularItalic.ttf +0 -0
- data/lib/exam1/doc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/lib/exam1/doc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/lib/exam1/doc/images/add.png +0 -0
- data/lib/exam1/doc/images/arrow_up.png +0 -0
- data/lib/exam1/doc/images/brick.png +0 -0
- data/lib/exam1/doc/images/brick_link.png +0 -0
- data/lib/exam1/doc/images/bug.png +0 -0
- data/lib/exam1/doc/images/bullet_black.png +0 -0
- data/lib/exam1/doc/images/bullet_toggle_minus.png +0 -0
- data/lib/exam1/doc/images/bullet_toggle_plus.png +0 -0
- data/lib/exam1/doc/images/date.png +0 -0
- data/lib/exam1/doc/images/delete.png +0 -0
- data/lib/exam1/doc/images/find.png +0 -0
- data/lib/exam1/doc/images/loadingAnimation.gif +0 -0
- data/lib/exam1/doc/images/macFFBgHack.png +0 -0
- data/lib/exam1/doc/images/package.png +0 -0
- data/lib/exam1/doc/images/page_green.png +0 -0
- data/lib/exam1/doc/images/page_white_text.png +0 -0
- data/lib/exam1/doc/images/page_white_width.png +0 -0
- data/lib/exam1/doc/images/plugin.png +0 -0
- data/lib/exam1/doc/images/ruby.png +0 -0
- data/lib/exam1/doc/images/tag_blue.png +0 -0
- data/lib/exam1/doc/images/tag_green.png +0 -0
- data/lib/exam1/doc/images/transparent.png +0 -0
- data/lib/exam1/doc/images/wrench.png +0 -0
- data/lib/exam1/doc/images/wrench_orange.png +0 -0
- data/lib/exam1/doc/images/zoom.png +0 -0
- data/lib/exam1/doc/index.html +152 -0
- data/lib/exam1/doc/js/darkfish.js +140 -0
- data/lib/exam1/doc/js/jquery.js +18 -0
- data/lib/exam1/doc/js/navigation.js +142 -0
- data/lib/exam1/doc/js/search.js +109 -0
- data/lib/exam1/doc/js/search_index.js +1 -0
- data/lib/exam1/doc/js/searcher.js +228 -0
- data/lib/exam1/doc/linkedlist_rb~.html +238 -0
- data/lib/exam1/doc/rdoc.css +580 -0
- data/lib/exam1/doc/table_of_contents.html +288 -0
- data/lib/exam1/examen.rb +178 -0
- data/lib/exam1/examen.rb~ +178 -0
- data/lib/exam1/linkedlist.rb +129 -0
- data/lib/exam1/linkedlist.rb~ +134 -0
- data/lib/exam1/version.rb +3 -0
- data/spec/.yardoc/checksums +0 -0
- data/spec/.yardoc/object_types +0 -0
- data/spec/.yardoc/objects/root.dat +0 -0
- data/spec/.yardoc/proxy_types +0 -0
- data/spec/doc/_index.html +88 -0
- data/spec/doc/class_list.html +58 -0
- data/spec/doc/created.rid +3 -0
- data/spec/doc/css/common.css +1 -0
- data/spec/doc/css/full_list.css +57 -0
- data/spec/doc/css/style.css +339 -0
- data/spec/doc/file_list.html +57 -0
- data/spec/doc/frames.html +26 -0
- data/spec/doc/images/brick.png +0 -0
- data/spec/doc/images/brick_link.png +0 -0
- data/spec/doc/images/bug.png +0 -0
- data/spec/doc/images/bullet_black.png +0 -0
- data/spec/doc/images/bullet_toggle_minus.png +0 -0
- data/spec/doc/images/bullet_toggle_plus.png +0 -0
- data/spec/doc/images/date.png +0 -0
- data/spec/doc/images/find.png +0 -0
- data/spec/doc/images/loadingAnimation.gif +0 -0
- data/spec/doc/images/macFFBgHack.png +0 -0
- data/spec/doc/images/package.png +0 -0
- data/spec/doc/images/page_green.png +0 -0
- data/spec/doc/images/page_white_text.png +0 -0
- data/spec/doc/images/page_white_width.png +0 -0
- data/spec/doc/images/plugin.png +0 -0
- data/spec/doc/images/ruby.png +0 -0
- data/spec/doc/images/tag_green.png +0 -0
- data/spec/doc/images/wrench.png +0 -0
- data/spec/doc/images/wrench_orange.png +0 -0
- data/spec/doc/images/zoom.png +0 -0
- data/spec/doc/index.html +88 -0
- data/spec/doc/js/app.js +219 -0
- data/spec/doc/js/darkfish.js +118 -0
- data/spec/doc/js/full_list.js +181 -0
- data/spec/doc/js/jquery.js +4 -0
- data/spec/doc/js/quicksearch.js +114 -0
- data/spec/doc/js/thickbox-compressed.js +10 -0
- data/spec/doc/linkedlist_spec_rb.html +56 -0
- data/spec/doc/method_list.html +57 -0
- data/spec/doc/rdoc.css +763 -0
- data/spec/doc/spec_helper_rb.html +54 -0
- data/spec/doc/top-level-namespace.html +102 -0
- data/spec/linkedlist_spec.rb +449 -0
- data/spec/linkedlist_spec.rb~ +449 -0
- data/spec/spec_helper.rb +28 -0
- metadata +331 -0
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'exam1'
|
|
3
|
+
|
|
4
|
+
#require 'coveralls'
|
|
5
|
+
#Coveralls.wear!
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
##INICIALIZAMOS CADA UNA DE LAS PREGUNTAS CON SUS RESPECTIVAS RESPUESTAS
|
|
9
|
+
|
|
10
|
+
describe SeleccionSimple do
|
|
11
|
+
before :each do
|
|
12
|
+
|
|
13
|
+
@p1 = SeleccionSimple.new("¿Cual es la salida del siguiente codigo Ruby?\n
|
|
14
|
+
class Xyz
|
|
15
|
+
def pots
|
|
16
|
+
@nice
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
xyz = Xyz.new
|
|
21
|
+
p xyz.pots", ['#<Xyz:0xa000208>','nil',0,'Ninguna de las anteriores'],1,'b')
|
|
22
|
+
|
|
23
|
+
@p2 = Verdadero_Falso.new("La siguiente definicion de un hash en Ruby es valida:\n
|
|
24
|
+
hash_raro = {\n
|
|
25
|
+
[1, 2, 3] => Object.new(),
|
|
26
|
+
Hash.new => :toto\n
|
|
27
|
+
}",2,'a')
|
|
28
|
+
|
|
29
|
+
@p3 = SeleccionSimple.new("¿Cual es la salida del siguiente codigo Ruby?\n
|
|
30
|
+
class Array
|
|
31
|
+
def say_hi
|
|
32
|
+
HEY!
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
p [1, bob].say_hi", [1,'bob','HEY!','Ninguna de las anteriores'],3,'c')
|
|
36
|
+
|
|
37
|
+
@p4 = SeleccionSimple.new("¿Cual es el tipo del objeto en el siguiente codigo Ruby?\n
|
|
38
|
+
class Objeto\n
|
|
39
|
+
end", ['Una instancia de la clase Class','Una constante','Un objeto','Ninguna de las anteriores'],4,'a')
|
|
40
|
+
|
|
41
|
+
@p5 = Verdadero_Falso.new("Es apropiado que una clase Tablero herede de una clase Juego",5,'a')
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
##FIN DE LA INICIALIZACION
|
|
45
|
+
|
|
46
|
+
##EXISTENCIA DE LAS PREGUNTAS
|
|
47
|
+
|
|
48
|
+
describe "#Simple_Selection" do
|
|
49
|
+
it ":Debe existir una pregunta" do
|
|
50
|
+
expect(@p1.class).to eq(SeleccionSimple)
|
|
51
|
+
|
|
52
|
+
expect(@p2.class).to eq(Verdadero_Falso)
|
|
53
|
+
|
|
54
|
+
expect(@p3.class).to eq(SeleccionSimple)
|
|
55
|
+
|
|
56
|
+
expect(@p4.class).to eq(SeleccionSimple)
|
|
57
|
+
|
|
58
|
+
expect(@p5.class).to eq(Verdadero_Falso)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
##FIN PREGUNTAS
|
|
63
|
+
|
|
64
|
+
##EXISTENCIA DE LAS RESPUESTAS
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
it ":Deben existir opciones de respuesta" do
|
|
68
|
+
expect(@p1.respuesta).to eq(['#<Xyz:0xa000208>','nil',0,'Ninguna de las anteriores'])
|
|
69
|
+
expect(@p2.respuesta).to eq(['Cierto','Falso'])
|
|
70
|
+
expect(@p3.respuesta).to eq([1,'bob','HEY!','Ninguna de las anteriores'])
|
|
71
|
+
expect(@p4.respuesta).to eq(['Una instancia de la clase Class','Una constante','Un objeto','Ninguna de las anteriores'])
|
|
72
|
+
expect(@p5.respuesta).to eq(['Cierto','Falso'])
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
##FIN RESPUESTAS
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
it ":Se debe invocar un método para obtener la pregunta" do
|
|
80
|
+
|
|
81
|
+
expect(@p1.pregunta).to eq("¿Cual es la salida del siguiente codigo Ruby?\n
|
|
82
|
+
class Xyz
|
|
83
|
+
def pots
|
|
84
|
+
@nice
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
xyz = Xyz.new
|
|
89
|
+
p xyz.pots")
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
expect(@p2.pregunta).to eq("La siguiente definicion de un hash en Ruby es valida:\n
|
|
93
|
+
hash_raro = {\n
|
|
94
|
+
[1, 2, 3] => Object.new(),
|
|
95
|
+
Hash.new => :toto\n
|
|
96
|
+
}")
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
expect(@p3.pregunta).to eq("¿Cual es la salida del siguiente codigo Ruby?\n
|
|
100
|
+
class Array
|
|
101
|
+
def say_hi
|
|
102
|
+
HEY!
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
p [1, bob].say_hi")
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
expect(@p4.pregunta).to eq("¿Cual es el tipo del objeto en el siguiente codigo Ruby?\n
|
|
109
|
+
class Objeto\n
|
|
110
|
+
end")
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
expect(@p5.pregunta).to eq("Es apropiado que una clase Tablero herede de una clase Juego")
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
it ":Se debe invocar un método para obtener las opciones de respuesta" do
|
|
119
|
+
|
|
120
|
+
expect(@p1.respuesta[0]).to eq('#<Xyz:0xa000208>')
|
|
121
|
+
expect(@p2.respuesta[0]).to eq('Cierto')
|
|
122
|
+
expect(@p3.respuesta[0]).to eq(1)
|
|
123
|
+
expect(@p4.respuesta[0]).to eq('Una instancia de la clase Class')
|
|
124
|
+
expect(@p5.respuesta[0]).to eq('Cierto')
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
expect(@p1.respuesta[1]).to eq('nil')
|
|
128
|
+
expect(@p2.respuesta[1]).to eq('Falso')
|
|
129
|
+
expect(@p3.respuesta[1]).to eq('bob')
|
|
130
|
+
expect(@p4.respuesta[1]).to eq('Una constante')
|
|
131
|
+
expect(@p5.respuesta[1]).to eq('Falso')
|
|
132
|
+
|
|
133
|
+
expect(@p1.respuesta[2]).to eq(0)
|
|
134
|
+
expect(@p3.respuesta[2]).to eq('HEY!')
|
|
135
|
+
expect(@p4.respuesta[2]).to eq('Un objeto')
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
expect(@p1.respuesta[3]).to eq('Ninguna de las anteriores')
|
|
139
|
+
expect(@p3.respuesta[3]).to eq('Ninguna de las anteriores')
|
|
140
|
+
expect(@p4.respuesta[3]).to eq('Ninguna de las anteriores')
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
##FORMATEADO POR PANTALLA
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
it ":Se deben mostrar por consola formateada la pregunta y las opciones de respuesta" do
|
|
149
|
+
|
|
150
|
+
expect(@p1.to_s).to eq("¿Cual es la salida del siguiente codigo Ruby?\n
|
|
151
|
+
class Xyz
|
|
152
|
+
def pots
|
|
153
|
+
@nice
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
xyz = Xyz.new
|
|
158
|
+
p xyz.pots\n a) #<Xyz:0xa000208>\n b) nil\n c) 0\n d) Ninguna de las anteriores\n")
|
|
159
|
+
|
|
160
|
+
expect(@p2.to_s).to eq("La siguiente definicion de un hash en Ruby es valida:\n
|
|
161
|
+
hash_raro = {\n
|
|
162
|
+
[1, 2, 3] => Object.new(),
|
|
163
|
+
Hash.new => :toto\n
|
|
164
|
+
}\n a) Cierto\n b) Falso\n")
|
|
165
|
+
|
|
166
|
+
expect(@p3.to_s).to eq("¿Cual es la salida del siguiente codigo Ruby?\n
|
|
167
|
+
class Array
|
|
168
|
+
def say_hi
|
|
169
|
+
HEY!
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
p [1, ""bob""].say_hi\n a) 1\n b) bob\n c) HEY!\n d) Ninguna de las anteriores\n")
|
|
173
|
+
|
|
174
|
+
expect(@p4.to_s).to eq("¿Cual es el tipo del objeto en el siguiente codigo Ruby?\n
|
|
175
|
+
class Objeto\n
|
|
176
|
+
end\n a) Una instancia de la clase Class\n b) Una constante\n c) Un objeto\n d) Ninguna de las anteriores\n")
|
|
177
|
+
|
|
178
|
+
expect(@p5.to_s).to eq("Es apropiado que una clase Tablero herede de una clase Juego\n a) Cierto\n b) Falso\n")
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
describe "#Comparación de las preguntas utilizando el Comparable" do
|
|
182
|
+
|
|
183
|
+
it ":La pregunta 1 y el resto son diferentes" do
|
|
184
|
+
test = (@p1 == @p2)
|
|
185
|
+
testp1 = (@p1 == @p1)
|
|
186
|
+
test2 = (@p1 == @p3)
|
|
187
|
+
test3 = (@p1 == @p4)
|
|
188
|
+
test4 = (@p1 == @p5)
|
|
189
|
+
expect(testp1).to eq(true)
|
|
190
|
+
expect(test).to eq(false)
|
|
191
|
+
expect(test2).to eq(false)
|
|
192
|
+
expect(test3).to eq(false)
|
|
193
|
+
expect(test4).to eq(false)
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
it ":Las preguntas son diferentes" do
|
|
197
|
+
|
|
198
|
+
expect(@p1.pregunta == @p2.pregunta).to eq(false)
|
|
199
|
+
expect(@p2.pregunta == @p3.pregunta).to eq(false)
|
|
200
|
+
expect(@p3.pregunta == @p4.pregunta).to eq(false)
|
|
201
|
+
expect(@p5.pregunta == @p1.pregunta).to eq(false)
|
|
202
|
+
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
it ":Las respuestas son diferentes" do
|
|
206
|
+
|
|
207
|
+
expect(@p1.respuesta == @p2.respuesta).to eq(false)
|
|
208
|
+
expect(@p2.respuesta == @p3.respuesta).to eq(false)
|
|
209
|
+
expect(@p3.respuesta == @p4.respuesta).to eq(false)
|
|
210
|
+
expect(@p5.respuesta == @p1.respuesta).to eq(false)
|
|
211
|
+
expect(@p2.respuesta == @p5.respuesta).to eq(true)
|
|
212
|
+
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
it ":Realizando pruebas de comparación" do
|
|
216
|
+
|
|
217
|
+
expect(@p1 < @p5).to eq(true)
|
|
218
|
+
expect(@p1 > @p4).to eq(false)
|
|
219
|
+
expect(@p1 > @p2).to eq(false)
|
|
220
|
+
expect(@p4 <= @p1).to eq(false)
|
|
221
|
+
expect(@p4 <= @p2).to eq(false)
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
describe List do
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
before :each do
|
|
236
|
+
|
|
237
|
+
@nodo1 = Nodo.new(@p1)
|
|
238
|
+
@nodo2 = Nodo.new(@p2)
|
|
239
|
+
@nodo3 = Nodo.new(@p3)
|
|
240
|
+
@nodo4 = Nodo.new(@p4)
|
|
241
|
+
@nodo5 = Nodo.new(@p5)
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
@lista = List.new(@nodo1)
|
|
245
|
+
|
|
246
|
+
@li = List.new(@nodo1)
|
|
247
|
+
@li.insert_head(@nodo2)
|
|
248
|
+
@li.insert_head(@nodo3)
|
|
249
|
+
@li.insert_head(@nodo4)
|
|
250
|
+
@li.insert_head(@nodo5)
|
|
251
|
+
|
|
252
|
+
@l = List.new(@nodo1)
|
|
253
|
+
@l.insert_head(@nodo2)
|
|
254
|
+
@l.insert_head(@nodo3)
|
|
255
|
+
@l.insert_head(@nodo4)
|
|
256
|
+
@l.insert_head(@nodo5)
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
# @l_inv = List.new(@nodo1)
|
|
260
|
+
# @l_inv.insert_tail(@nodo2)
|
|
261
|
+
# @l_inv.insert_tail(@nodo3)
|
|
262
|
+
# @l_inv.insert_tail(@nodo4)
|
|
263
|
+
# @l_inv.insert_tail(@nodo5)
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
@ex = Examen.new(@l)
|
|
267
|
+
|
|
268
|
+
@int = Interfaz.new(@ex)
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
describe "Nodo" do
|
|
281
|
+
|
|
282
|
+
it "#Debe existir un Nodo de la lista con sus datos y su siguiente" do
|
|
283
|
+
|
|
284
|
+
expect(@nodo1.class).to eq(Nodo)
|
|
285
|
+
|
|
286
|
+
# @lista).to_not eq(nil)
|
|
287
|
+
#@lista.extr_ele.class).to eq(Nodo)
|
|
288
|
+
|
|
289
|
+
end
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
describe "List" do
|
|
293
|
+
it "#Se extrae el primer elemento de la lista" do
|
|
294
|
+
|
|
295
|
+
expect(@lista.remove_tail).to eq(@nodo1.value)
|
|
296
|
+
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
it "#Se puede insertar un elemento" do
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
@lista.insert_head(@nodo2)
|
|
303
|
+
expect(@lista.remove_head).to eq(@nodo2.value)
|
|
304
|
+
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
it "#Se pueden insertar varios elementos" do
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
@lista.insert_head(@nodo3)
|
|
311
|
+
@lista.insert_head(@nodo5)
|
|
312
|
+
@lista.insert_tail(@nodo4)
|
|
313
|
+
expect(@lista.remove_tail).to eq(@nodo4.value)
|
|
314
|
+
expect(@lista.remove_head).to eq(@nodo5.value)
|
|
315
|
+
expect(@lista.remove_head).to eq(@nodo3.value)
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
it "#Debe existir una lista con su cabeza" do
|
|
321
|
+
|
|
322
|
+
expect(@lista.head.class).to eq(Nodo)
|
|
323
|
+
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
it "#Pruebas para utilizar el Mixin Enumerable - Funcion maximo" do
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
expect(@li.max).to eq(@p5)
|
|
331
|
+
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
it "#Pruebas para utilizar el Mixin Enumerable - Funcion minimo" do
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
expect(@li.min).to eq(@p1)
|
|
338
|
+
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
it "#Funcion sort: Devuelve las salidas a la inversa segun el nivel " do
|
|
342
|
+
|
|
343
|
+
p = @li.sort{|b, a| a.nivel <=> b.nivel}
|
|
344
|
+
expect(p).to eq([@p5,@p4,@p3,@p2,@p1])
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
it "#Funcion include" do
|
|
350
|
+
|
|
351
|
+
expect(@li.include?@p5).to eq(true)
|
|
352
|
+
expect(@li.include?@p4).to eq(true)
|
|
353
|
+
expect(@li.include?@p3).to eq(true)
|
|
354
|
+
expect(@li.include?@p2).to eq(true)
|
|
355
|
+
expect(@li.include?@p1).to eq(true)
|
|
356
|
+
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
it "#Funcion each" do
|
|
360
|
+
|
|
361
|
+
expect(@lista.each{|x|}).to eq(@lista.print)
|
|
362
|
+
|
|
363
|
+
end
|
|
364
|
+
|
|
365
|
+
it "#Preguntas de la clase examen" do
|
|
366
|
+
|
|
367
|
+
#expect(@ex.to_s).to eq(@l.print)
|
|
368
|
+
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
it "#Respuestas Correctas" do
|
|
372
|
+
|
|
373
|
+
expect(@ex.rcorrecta[0]).to eq(@p1.rescorr)
|
|
374
|
+
expect(@ex.rcorrecta[1]).to eq(@p2.rescorr)
|
|
375
|
+
expect(@ex.rcorrecta[2]).to eq(@p3.rescorr)
|
|
376
|
+
expect(@ex.rcorrecta[3]).to eq(@p4.rescorr)
|
|
377
|
+
expect(@ex.rcorrecta[4]).to eq(@p5.rescorr)
|
|
378
|
+
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
it "#Introducir respuestas usuario" do
|
|
382
|
+
|
|
383
|
+
expect(@ex.correcta('b',0)).to eq(true)
|
|
384
|
+
expect(@ex.correcta('a',1)).to eq(true)
|
|
385
|
+
expect(@ex.correcta('d',2)).to eq(false)
|
|
386
|
+
expect(@ex.correcta('a',3)).to eq(true)
|
|
387
|
+
expect(@ex.correcta('a',4)).to eq(true)
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
it "#Constructor exam" do
|
|
393
|
+
|
|
394
|
+
expect(@ex.is_a?Examen).to eq(true)
|
|
395
|
+
|
|
396
|
+
end
|
|
397
|
+
it "#Calificiación" do
|
|
398
|
+
|
|
399
|
+
#@ex.calificacion
|
|
400
|
+
|
|
401
|
+
expect(@int.correcta('b',0)).to eq(true)
|
|
402
|
+
expect(@int.correcta('a',1)).to eq(true)
|
|
403
|
+
expect(@int.correcta('d',2)).to eq(false)
|
|
404
|
+
expect(@int.correcta('a',3)).to eq(true)
|
|
405
|
+
expect(@int.correcta('a',4)).to eq(true)
|
|
406
|
+
|
|
407
|
+
expect(@int.calificacion).to eq(true)
|
|
408
|
+
#expect(@ex.correctaP<3).to eq(false)
|
|
409
|
+
|
|
410
|
+
end
|
|
411
|
+
|
|
412
|
+
it "#Constructor Interfaz" do
|
|
413
|
+
|
|
414
|
+
expect(@int.is_a?Interfaz).to eq(true)
|
|
415
|
+
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
it "#Interfaz to_s" do
|
|
420
|
+
|
|
421
|
+
expect(@int.to_s).to eq(@l.print)
|
|
422
|
+
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
it "#Preguntas Inversas" do
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
expect(@ex.invert).to eq(true)
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
end
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
end
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
end
|
|
445
|
+
end
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'coveralls'
|
|
2
|
+
Coveralls.wear!
|
|
3
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
|
4
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
5
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
|
6
|
+
# loaded once.
|
|
7
|
+
#
|
|
8
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
RSpec.configure do |config|
|
|
15
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
|
16
|
+
config.run_all_when_everything_filtered = true
|
|
17
|
+
config.filter_run :focus
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# Run specs in random order to surface order dependencies. If you find an
|
|
22
|
+
# order dependency and want to debug it, you can fix the order by providing
|
|
23
|
+
# the seed, which is printed after each run.
|
|
24
|
+
# --seed 1234
|
|
25
|
+
config.order = 'random'
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
end
|