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.
Files changed (143) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +2 -0
  3. data/.coveralls.yml~ +0 -0
  4. data/.gitignore +14 -0
  5. data/.rspec +2 -0
  6. data/.travis.yml +4 -0
  7. data/.travis.yml~ +0 -0
  8. data/Gemfile +4 -0
  9. data/LICENSE.txt +22 -0
  10. data/README.md +38 -0
  11. data/Rakefile +18 -0
  12. data/exam1.gemspec +30 -0
  13. data/exam1.gemspec~ +23 -0
  14. data/lib/exam1.rb +9 -0
  15. data/lib/exam1/SeleccionSimple.rb +86 -0
  16. data/lib/exam1/SeleccionSimple.rb~ +86 -0
  17. data/lib/exam1/doc/Exam1.html +112 -0
  18. data/lib/exam1/doc/Examen.html +484 -0
  19. data/lib/exam1/doc/Interfaz.html +384 -0
  20. data/lib/exam1/doc/List.html +467 -0
  21. data/lib/exam1/doc/Nodo.html +167 -0
  22. data/lib/exam1/doc/Object.html +119 -0
  23. data/lib/exam1/doc/SeleccionSimple.html +361 -0
  24. data/lib/exam1/doc/SeleccionSimple_rb~.html +237 -0
  25. data/lib/exam1/doc/Verdadero_Falso.html +208 -0
  26. data/lib/exam1/doc/created.rid +60 -0
  27. data/lib/exam1/doc/doc/Exam1_html.html +230 -0
  28. data/lib/exam1/doc/doc/Examen_html.html +556 -0
  29. data/lib/exam1/doc/doc/Interfaz_html.html +468 -0
  30. data/lib/exam1/doc/doc/List_html.html +531 -0
  31. data/lib/exam1/doc/doc/Nodo_html.html +285 -0
  32. data/lib/exam1/doc/doc/Object_html.html +237 -0
  33. data/lib/exam1/doc/doc/SeleccionSimple_html.html +454 -0
  34. data/lib/exam1/doc/doc/SeleccionSimple_rb~_html.html +377 -0
  35. data/lib/exam1/doc/doc/Verdadero_Falso_html.html +318 -0
  36. data/lib/exam1/doc/doc/examen_rb~_html.html +425 -0
  37. data/lib/exam1/doc/doc/fonts_css.html +307 -0
  38. data/lib/exam1/doc/doc/index_html.html +241 -0
  39. data/lib/exam1/doc/doc/js/darkfish_js.html +286 -0
  40. data/lib/exam1/doc/doc/js/jquery_js.html +1450 -0
  41. data/lib/exam1/doc/doc/js/navigation_js.html +271 -0
  42. data/lib/exam1/doc/doc/js/search_index_js.html +177 -0
  43. data/lib/exam1/doc/doc/js/search_js.html +240 -0
  44. data/lib/exam1/doc/doc/js/searcher_js.html +358 -0
  45. data/lib/exam1/doc/doc/linkedlist_rb~_html.html +345 -0
  46. data/lib/exam1/doc/doc/rdoc_css.html +844 -0
  47. data/lib/exam1/doc/doc/table_of_contents_html.html +352 -0
  48. data/lib/exam1/doc/examen_rb~.html +300 -0
  49. data/lib/exam1/doc/fonts.css +167 -0
  50. data/lib/exam1/doc/fonts/Lato-Light.ttf +0 -0
  51. data/lib/exam1/doc/fonts/Lato-LightItalic.ttf +0 -0
  52. data/lib/exam1/doc/fonts/Lato-Regular.ttf +0 -0
  53. data/lib/exam1/doc/fonts/Lato-RegularItalic.ttf +0 -0
  54. data/lib/exam1/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  55. data/lib/exam1/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  56. data/lib/exam1/doc/images/add.png +0 -0
  57. data/lib/exam1/doc/images/arrow_up.png +0 -0
  58. data/lib/exam1/doc/images/brick.png +0 -0
  59. data/lib/exam1/doc/images/brick_link.png +0 -0
  60. data/lib/exam1/doc/images/bug.png +0 -0
  61. data/lib/exam1/doc/images/bullet_black.png +0 -0
  62. data/lib/exam1/doc/images/bullet_toggle_minus.png +0 -0
  63. data/lib/exam1/doc/images/bullet_toggle_plus.png +0 -0
  64. data/lib/exam1/doc/images/date.png +0 -0
  65. data/lib/exam1/doc/images/delete.png +0 -0
  66. data/lib/exam1/doc/images/find.png +0 -0
  67. data/lib/exam1/doc/images/loadingAnimation.gif +0 -0
  68. data/lib/exam1/doc/images/macFFBgHack.png +0 -0
  69. data/lib/exam1/doc/images/package.png +0 -0
  70. data/lib/exam1/doc/images/page_green.png +0 -0
  71. data/lib/exam1/doc/images/page_white_text.png +0 -0
  72. data/lib/exam1/doc/images/page_white_width.png +0 -0
  73. data/lib/exam1/doc/images/plugin.png +0 -0
  74. data/lib/exam1/doc/images/ruby.png +0 -0
  75. data/lib/exam1/doc/images/tag_blue.png +0 -0
  76. data/lib/exam1/doc/images/tag_green.png +0 -0
  77. data/lib/exam1/doc/images/transparent.png +0 -0
  78. data/lib/exam1/doc/images/wrench.png +0 -0
  79. data/lib/exam1/doc/images/wrench_orange.png +0 -0
  80. data/lib/exam1/doc/images/zoom.png +0 -0
  81. data/lib/exam1/doc/index.html +152 -0
  82. data/lib/exam1/doc/js/darkfish.js +140 -0
  83. data/lib/exam1/doc/js/jquery.js +18 -0
  84. data/lib/exam1/doc/js/navigation.js +142 -0
  85. data/lib/exam1/doc/js/search.js +109 -0
  86. data/lib/exam1/doc/js/search_index.js +1 -0
  87. data/lib/exam1/doc/js/searcher.js +228 -0
  88. data/lib/exam1/doc/linkedlist_rb~.html +238 -0
  89. data/lib/exam1/doc/rdoc.css +580 -0
  90. data/lib/exam1/doc/table_of_contents.html +288 -0
  91. data/lib/exam1/examen.rb +178 -0
  92. data/lib/exam1/examen.rb~ +178 -0
  93. data/lib/exam1/linkedlist.rb +129 -0
  94. data/lib/exam1/linkedlist.rb~ +134 -0
  95. data/lib/exam1/version.rb +3 -0
  96. data/spec/.yardoc/checksums +0 -0
  97. data/spec/.yardoc/object_types +0 -0
  98. data/spec/.yardoc/objects/root.dat +0 -0
  99. data/spec/.yardoc/proxy_types +0 -0
  100. data/spec/doc/_index.html +88 -0
  101. data/spec/doc/class_list.html +58 -0
  102. data/spec/doc/created.rid +3 -0
  103. data/spec/doc/css/common.css +1 -0
  104. data/spec/doc/css/full_list.css +57 -0
  105. data/spec/doc/css/style.css +339 -0
  106. data/spec/doc/file_list.html +57 -0
  107. data/spec/doc/frames.html +26 -0
  108. data/spec/doc/images/brick.png +0 -0
  109. data/spec/doc/images/brick_link.png +0 -0
  110. data/spec/doc/images/bug.png +0 -0
  111. data/spec/doc/images/bullet_black.png +0 -0
  112. data/spec/doc/images/bullet_toggle_minus.png +0 -0
  113. data/spec/doc/images/bullet_toggle_plus.png +0 -0
  114. data/spec/doc/images/date.png +0 -0
  115. data/spec/doc/images/find.png +0 -0
  116. data/spec/doc/images/loadingAnimation.gif +0 -0
  117. data/spec/doc/images/macFFBgHack.png +0 -0
  118. data/spec/doc/images/package.png +0 -0
  119. data/spec/doc/images/page_green.png +0 -0
  120. data/spec/doc/images/page_white_text.png +0 -0
  121. data/spec/doc/images/page_white_width.png +0 -0
  122. data/spec/doc/images/plugin.png +0 -0
  123. data/spec/doc/images/ruby.png +0 -0
  124. data/spec/doc/images/tag_green.png +0 -0
  125. data/spec/doc/images/wrench.png +0 -0
  126. data/spec/doc/images/wrench_orange.png +0 -0
  127. data/spec/doc/images/zoom.png +0 -0
  128. data/spec/doc/index.html +88 -0
  129. data/spec/doc/js/app.js +219 -0
  130. data/spec/doc/js/darkfish.js +118 -0
  131. data/spec/doc/js/full_list.js +181 -0
  132. data/spec/doc/js/jquery.js +4 -0
  133. data/spec/doc/js/quicksearch.js +114 -0
  134. data/spec/doc/js/thickbox-compressed.js +10 -0
  135. data/spec/doc/linkedlist_spec_rb.html +56 -0
  136. data/spec/doc/method_list.html +57 -0
  137. data/spec/doc/rdoc.css +763 -0
  138. data/spec/doc/spec_helper_rb.html +54 -0
  139. data/spec/doc/top-level-namespace.html +102 -0
  140. data/spec/linkedlist_spec.rb +449 -0
  141. data/spec/linkedlist_spec.rb~ +449 -0
  142. data/spec/spec_helper.rb +28 -0
  143. metadata +331 -0
@@ -0,0 +1,54 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
+ <head>
7
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
+
9
+ <title>File: spec_helper.rb [RDoc Documentation]</title>
10
+
11
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet" />
12
+
13
+ <script src="./js/jquery.js" type="text/javascript"
14
+ charset="utf-8"></script>
15
+ <script src="./js/thickbox-compressed.js" type="text/javascript"
16
+ charset="utf-8"></script>
17
+ <script src="./js/quicksearch.js" type="text/javascript"
18
+ charset="utf-8"></script>
19
+ <script src="./js/darkfish.js" type="text/javascript"
20
+ charset="utf-8"></script>
21
+ </head>
22
+
23
+ <body class="file file-popup">
24
+ <div id="metadata">
25
+ <dl>
26
+ <dt class="modified-date">Last Modified</dt>
27
+ <dd class="modified-date">2014-11-19 18:08:36 +0000</dd>
28
+
29
+
30
+ <dt class="requires">Requires</dt>
31
+ <dd class="requires">
32
+ <ul>
33
+
34
+ <li>coveralls</li>
35
+
36
+ </ul>
37
+ </dd>
38
+
39
+
40
+
41
+ </dl>
42
+ </div>
43
+
44
+ <div id="documentation">
45
+
46
+ <div class="description">
47
+ <h2>Description</h2>
48
+
49
+ </div>
50
+
51
+ </div>
52
+ </body>
53
+ </html>
54
+
@@ -0,0 +1,102 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Top Level Namespace
8
+
9
+ &mdash; Documentation by YARD 0.8.7.6
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!top-level-namespace.html";
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index</a> &raquo;
35
+
36
+
37
+ <span class="title">Top Level Namespace</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Top Level Namespace
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ </dl>
82
+ <div class="clear"></div>
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+ </div>
94
+
95
+ <div id="footer">
96
+ Generated on Mon Nov 24 18:23:11 2014 by
97
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
98
+ 0.8.7.6 (ruby-1.9.3).
99
+ </div>
100
+
101
+ </body>
102
+ </html>
@@ -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
+ @ex.invert
431
+
432
+
433
+
434
+
435
+ end
436
+
437
+
438
+ end
439
+
440
+
441
+
442
+
443
+
444
+ end
445
+ end
446
+
447
+
448
+
449
+