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.
Files changed (81) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +2 -0
  3. data/.gitignore +20 -0
  4. data/.rspec +2 -0
  5. data/.travis.yml +7 -0
  6. data/Gemfile +4 -0
  7. data/Guardfile +38 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +7 -0
  10. data/README.rdoc +3 -0
  11. data/Rakefile +13 -0
  12. data/exam.gemspec +32 -0
  13. data/html/Exam.html +112 -0
  14. data/html/Exam/DList.html +569 -0
  15. data/html/Exam/Examen.html +335 -0
  16. data/html/Exam/Interfaz.html +333 -0
  17. data/html/Exam/List.html +323 -0
  18. data/html/Exam/Test.html +384 -0
  19. data/html/Exam/ToF.html +164 -0
  20. data/html/Inversor.html +112 -0
  21. data/html/Inverter.html +164 -0
  22. data/html/Object.html +119 -0
  23. data/html/README_rdoc.html +86 -0
  24. data/html/created.rid +13 -0
  25. data/html/fonts.css +167 -0
  26. data/html/fonts/Lato-Light.ttf +0 -0
  27. data/html/fonts/Lato-LightItalic.ttf +0 -0
  28. data/html/fonts/Lato-Regular.ttf +0 -0
  29. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  30. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  31. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  32. data/html/images/add.png +0 -0
  33. data/html/images/arrow_up.png +0 -0
  34. data/html/images/brick.png +0 -0
  35. data/html/images/brick_link.png +0 -0
  36. data/html/images/bug.png +0 -0
  37. data/html/images/bullet_black.png +0 -0
  38. data/html/images/bullet_toggle_minus.png +0 -0
  39. data/html/images/bullet_toggle_plus.png +0 -0
  40. data/html/images/date.png +0 -0
  41. data/html/images/delete.png +0 -0
  42. data/html/images/find.png +0 -0
  43. data/html/images/loadingAnimation.gif +0 -0
  44. data/html/images/macFFBgHack.png +0 -0
  45. data/html/images/package.png +0 -0
  46. data/html/images/page_green.png +0 -0
  47. data/html/images/page_white_text.png +0 -0
  48. data/html/images/page_white_width.png +0 -0
  49. data/html/images/plugin.png +0 -0
  50. data/html/images/ruby.png +0 -0
  51. data/html/images/tag_blue.png +0 -0
  52. data/html/images/tag_green.png +0 -0
  53. data/html/images/transparent.png +0 -0
  54. data/html/images/wrench.png +0 -0
  55. data/html/images/wrench_orange.png +0 -0
  56. data/html/images/zoom.png +0 -0
  57. data/html/index.html +108 -0
  58. data/html/js/darkfish.js +140 -0
  59. data/html/js/jquery.js +4 -0
  60. data/html/js/navigation.js +142 -0
  61. data/html/js/search.js +109 -0
  62. data/html/js/search_index.js +1 -0
  63. data/html/js/searcher.js +228 -0
  64. data/html/rdoc.css +580 -0
  65. data/html/table_of_contents.html +222 -0
  66. data/lib/exam.rb +8 -0
  67. data/lib/exam/d_list.rb +124 -0
  68. data/lib/exam/examen.rb +38 -0
  69. data/lib/exam/interfaz.rb +34 -0
  70. data/lib/exam/list.rb +57 -0
  71. data/lib/exam/quiz.rb +39 -0
  72. data/lib/exam/test.rb +37 -0
  73. data/lib/exam/tof.rb +9 -0
  74. data/lib/exam/version.rb +3 -0
  75. data/lib/inverter.rb +1 -0
  76. data/lib/inverter/reverse.rb +10 -0
  77. data/lib/inverter/version.rb +3 -0
  78. data/rspec_results.html +339 -0
  79. data/spec/exam_spec.rb +346 -0
  80. data/spec/spec_helper.rb +19 -0
  81. metadata +225 -0
data/lib/exam/quiz.rb ADDED
@@ -0,0 +1,39 @@
1
+ module Exam
2
+
3
+ class Quiz
4
+
5
+ attr_accessor :nombre, :preguntas
6
+
7
+ def initialize(nombre, &block)
8
+
9
+ @nombre = nombre
10
+ @preguntas = []
11
+
12
+ instance_eval &block
13
+
14
+ end
15
+
16
+ def question(nombre, opciones = {})
17
+ respuestas = []
18
+ respuestas << opciones[:right]
19
+ respuestas << opciones[:wrong]
20
+ pregunta = Test.new(nombre,opciones[:right],respuestas)
21
+
22
+ @preguntas << pregunta
23
+
24
+ end
25
+
26
+ def run
27
+ l = DList.new(@preguntas)
28
+
29
+ e=Examen.new(l)
30
+
31
+ i=Interfaz.new(e)
32
+
33
+ i.examinar
34
+
35
+ end
36
+
37
+ end
38
+
39
+ end
data/lib/exam/test.rb ADDED
@@ -0,0 +1,37 @@
1
+ module Exam
2
+ # create a Test
3
+ class Test
4
+
5
+ include Comparable
6
+
7
+ attr_accessor :pregunta, :correcta, :respuestas, :nivel
8
+
9
+ def <=> (a)
10
+ @nivel <=> a.nivel
11
+ end
12
+
13
+ def == (a)
14
+ @pregunta==a.pregunta && @correcta==a.correcta && @respuestas.should =~ a.respuestas
15
+ end
16
+
17
+ def initialize(pregunta, correcta, respuestas, nivel=nil)
18
+ @pregunta = pregunta
19
+ @correcta = correcta
20
+ @respuestas = respuestas.shuffle
21
+ @nivel = nivel
22
+ end
23
+
24
+ def check_ans(c)
25
+ return (c == @correcta)
26
+ end
27
+
28
+ def to_s
29
+ texto = "Pregunta: #{@pregunta} \n"
30
+ for i in 0..@respuestas.size-1
31
+ texto = texto + "\t #{i+1}) #{@respuestas[i]} \n"
32
+ end
33
+ return texto
34
+ end
35
+
36
+ end
37
+ end
data/lib/exam/tof.rb ADDED
@@ -0,0 +1,9 @@
1
+ module Exam
2
+ # create ToF that inherits Test
3
+ class ToF < Test
4
+
5
+ def initialize (preguntas, correcta, nivel=nil)
6
+ super(preguntas,correcta, ["V","F"], nivel)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module Exam
2
+ VERSION = "0.1.2"
3
+ end
data/lib/inverter.rb ADDED
@@ -0,0 +1 @@
1
+ require "inverter/reverse.rb"
@@ -0,0 +1,10 @@
1
+ module Inverter
2
+
3
+ def reverse(lista)
4
+ aux = lista.map {|x| x}
5
+ lista_invertida = Exam::DList.new(aux)
6
+ end
7
+
8
+ end
9
+
10
+ class Exam::Examen; include Inverter; end
@@ -0,0 +1,3 @@
1
+ module Inverter
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,339 @@
1
+ <!DOCTYPE html>
2
+ <html lang='en'>
3
+ <head>
4
+ <title>RSpec results</title>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <meta http-equiv="Expires" content="-1" />
7
+ <meta http-equiv="Pragma" content="no-cache" />
8
+ <style type="text/css">
9
+ body {
10
+ margin: 0;
11
+ padding: 0;
12
+ background: #fff;
13
+ font-size: 80%;
14
+ }
15
+ </style>
16
+ <script type="text/javascript">
17
+ // <![CDATA[
18
+
19
+ function addClass(element_id, classname) {
20
+ document.getElementById(element_id).className += (" " + classname);
21
+ }
22
+
23
+ function removeClass(element_id, classname) {
24
+ var elem = document.getElementById(element_id);
25
+ var classlist = elem.className.replace(classname,'');
26
+ elem.className = classlist;
27
+ }
28
+
29
+ function moveProgressBar(percentDone) {
30
+ document.getElementById("rspec-header").style.width = percentDone +"%";
31
+ }
32
+
33
+ function makeRed(element_id) {
34
+ removeClass(element_id, 'passed');
35
+ removeClass(element_id, 'not_implemented');
36
+ addClass(element_id,'failed');
37
+ }
38
+
39
+ function makeYellow(element_id) {
40
+ var elem = document.getElementById(element_id);
41
+ if (elem.className.indexOf("failed") == -1) { // class doesn't includes failed
42
+ if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
43
+ removeClass(element_id, 'passed');
44
+ addClass(element_id,'not_implemented');
45
+ }
46
+ }
47
+ }
48
+
49
+ function apply_filters() {
50
+ var passed_filter = document.getElementById('passed_checkbox').checked;
51
+ var failed_filter = document.getElementById('failed_checkbox').checked;
52
+ var pending_filter = document.getElementById('pending_checkbox').checked;
53
+
54
+ assign_display_style("example passed", passed_filter);
55
+ assign_display_style("example failed", failed_filter);
56
+ assign_display_style("example not_implemented", pending_filter);
57
+
58
+ assign_display_style_for_group("example_group passed", passed_filter);
59
+ assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
60
+ assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
61
+ }
62
+
63
+ function get_display_style(display_flag) {
64
+ var style_mode = 'none';
65
+ if (display_flag == true) {
66
+ style_mode = 'block';
67
+ }
68
+ return style_mode;
69
+ }
70
+
71
+ function assign_display_style(classname, display_flag) {
72
+ var style_mode = get_display_style(display_flag);
73
+ var elems = document.getElementsByClassName(classname)
74
+ for (var i=0; i<elems.length;i++) {
75
+ elems[i].style.display = style_mode;
76
+ }
77
+ }
78
+
79
+ function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
80
+ var display_style_mode = get_display_style(display_flag);
81
+ var subgroup_style_mode = get_display_style(subgroup_flag);
82
+ var elems = document.getElementsByClassName(classname)
83
+ for (var i=0; i<elems.length;i++) {
84
+ var style_mode = display_style_mode;
85
+ if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
86
+ elems[i].style.display = subgroup_style_mode;
87
+ } else {
88
+ elems[i].style.display = display_style_mode;
89
+ }
90
+ }
91
+ }
92
+
93
+ // ]]>
94
+ </script>
95
+ <style type="text/css">
96
+ #rspec-header {
97
+ background: #65C400; color: #fff; height: 4em;
98
+ }
99
+
100
+ .rspec-report h1 {
101
+ margin: 0px 10px 0px 10px;
102
+ padding: 10px;
103
+ font-family: "Lucida Grande", Helvetica, sans-serif;
104
+ font-size: 1.8em;
105
+ position: absolute;
106
+ }
107
+
108
+ #label {
109
+ float:left;
110
+ }
111
+
112
+ #display-filters {
113
+ float:left;
114
+ padding: 28px 0 0 40%;
115
+ font-family: "Lucida Grande", Helvetica, sans-serif;
116
+ }
117
+
118
+ #summary {
119
+ float:right;
120
+ padding: 5px 10px;
121
+ font-family: "Lucida Grande", Helvetica, sans-serif;
122
+ text-align: right;
123
+ }
124
+
125
+ #summary p {
126
+ margin: 0 0 0 2px;
127
+ }
128
+
129
+ #summary #totals {
130
+ font-size: 1.2em;
131
+ }
132
+
133
+ .example_group {
134
+ margin: 0 10px 5px;
135
+ background: #fff;
136
+ }
137
+
138
+ dl {
139
+ margin: 0; padding: 0 0 5px;
140
+ font: normal 11px "Lucida Grande", Helvetica, sans-serif;
141
+ }
142
+
143
+ dt {
144
+ padding: 3px;
145
+ background: #65C400;
146
+ color: #fff;
147
+ font-weight: bold;
148
+ }
149
+
150
+ dd {
151
+ margin: 5px 0 5px 5px;
152
+ padding: 3px 3px 3px 18px;
153
+ }
154
+
155
+ dd .duration {
156
+ padding-left: 5px;
157
+ text-align: right;
158
+ right: 0px;
159
+ float:right;
160
+ }
161
+
162
+ dd.example.passed {
163
+ border-left: 5px solid #65C400;
164
+ border-bottom: 1px solid #65C400;
165
+ background: #DBFFB4; color: #3D7700;
166
+ }
167
+
168
+ dd.example.not_implemented {
169
+ border-left: 5px solid #FAF834;
170
+ border-bottom: 1px solid #FAF834;
171
+ background: #FCFB98; color: #131313;
172
+ }
173
+
174
+ dd.example.pending_fixed {
175
+ border-left: 5px solid #0000C2;
176
+ border-bottom: 1px solid #0000C2;
177
+ color: #0000C2; background: #D3FBFF;
178
+ }
179
+
180
+ dd.example.failed {
181
+ border-left: 5px solid #C20000;
182
+ border-bottom: 1px solid #C20000;
183
+ color: #C20000; background: #FFFBD3;
184
+ }
185
+
186
+
187
+ dt.not_implemented {
188
+ color: #000000; background: #FAF834;
189
+ }
190
+
191
+ dt.pending_fixed {
192
+ color: #FFFFFF; background: #C40D0D;
193
+ }
194
+
195
+ dt.failed {
196
+ color: #FFFFFF; background: #C40D0D;
197
+ }
198
+
199
+
200
+ #rspec-header.not_implemented {
201
+ color: #000000; background: #FAF834;
202
+ }
203
+
204
+ #rspec-header.pending_fixed {
205
+ color: #FFFFFF; background: #C40D0D;
206
+ }
207
+
208
+ #rspec-header.failed {
209
+ color: #FFFFFF; background: #C40D0D;
210
+ }
211
+
212
+
213
+ .backtrace {
214
+ color: #000;
215
+ font-size: 12px;
216
+ }
217
+
218
+ a {
219
+ color: #BE5C00;
220
+ }
221
+
222
+ /* Ruby code, style similar to vibrant ink */
223
+ .ruby {
224
+ font-size: 12px;
225
+ font-family: monospace;
226
+ color: white;
227
+ background-color: black;
228
+ padding: 0.1em 0 0.2em 0;
229
+ }
230
+
231
+ .ruby .keyword { color: #FF6600; }
232
+ .ruby .constant { color: #339999; }
233
+ .ruby .attribute { color: white; }
234
+ .ruby .global { color: white; }
235
+ .ruby .module { color: white; }
236
+ .ruby .class { color: white; }
237
+ .ruby .string { color: #66FF00; }
238
+ .ruby .ident { color: white; }
239
+ .ruby .method { color: #FFCC00; }
240
+ .ruby .number { color: white; }
241
+ .ruby .char { color: white; }
242
+ .ruby .comment { color: #9933CC; }
243
+ .ruby .symbol { color: white; }
244
+ .ruby .regex { color: #44B4CC; }
245
+ .ruby .punct { color: white; }
246
+ .ruby .escape { color: white; }
247
+ .ruby .interp { color: white; }
248
+ .ruby .expr { color: white; }
249
+
250
+ .ruby .offending { background-color: gray; }
251
+ .ruby .linenum {
252
+ width: 75px;
253
+ padding: 0.1em 1em 0.2em 0;
254
+ color: #000000;
255
+ background-color: #FFFBD3;
256
+ }
257
+
258
+ </style>
259
+ </head>
260
+ <body>
261
+ <div class="rspec-report">
262
+
263
+ <div id="rspec-header">
264
+ <div id="label">
265
+ <h1>RSpec Code Examples</h1>
266
+ </div>
267
+
268
+ <div id="display-filters">
269
+ <input id="passed_checkbox" name="passed_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="1" /> <label for="passed_checkbox">Passed</label>
270
+ <input id="failed_checkbox" name="failed_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="2" /> <label for="failed_checkbox">Failed</label>
271
+ <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="3" /> <label for="pending_checkbox">Pending</label>
272
+ </div>
273
+
274
+ <div id="summary">
275
+ <p id="totals">&#160;</p>
276
+ <p id="duration">&#160;</p>
277
+ </div>
278
+ </div>
279
+
280
+
281
+ <div class="results">
282
+ <div id="div_group_1" class="example_group passed">
283
+ <dl style="margin-left: 0px;">
284
+ <dt id="example_group_1" class="passed">Test</dt>
285
+ </dl>
286
+ </div>
287
+ <div id="div_group_2" class="example_group passed">
288
+ <dl style="margin-left: 15px;">
289
+ <dt id="example_group_2" class="passed">Pregunta</dt>
290
+ <script type="text/javascript">moveProgressBar('14.2');</script>
291
+ <dd class="example passed"><span class="passed_spec_name">Pregunta correctamente hecha</span><span class='duration'>0.00067s</span></dd>
292
+ </dl>
293
+ </div>
294
+ <div id="div_group_3" class="example_group passed">
295
+ <dl style="margin-left: 15px;">
296
+ <dt id="example_group_3" class="passed">Conversion</dt>
297
+ <script type="text/javascript">moveProgressBar('28.5');</script>
298
+ <dd class="example passed"><span class="passed_spec_name">Se puede generar html</span><span class='duration'>0.00089s</span></dd>
299
+ </dl>
300
+ </div>
301
+ <div id="div_group_4" class="example_group passed">
302
+ <dl style="margin-left: 0px;">
303
+ <dt id="example_group_4" class="passed">Node</dt>
304
+ </dl>
305
+ </div>
306
+ <div id="div_group_5" class="example_group passed">
307
+ <dl style="margin-left: 15px;">
308
+ <dt id="example_group_5" class="passed">Node</dt>
309
+ <script type="text/javascript">moveProgressBar('42.8');</script>
310
+ <dd class="example passed"><span class="passed_spec_name">#Debe existir un Nodo de la lista con sus datos y su siguiente</span><span class='duration'>0.00059s</span></dd>
311
+ </dl>
312
+ </div>
313
+ <div id="div_group_6" class="example_group passed">
314
+ <dl style="margin-left: 0px;">
315
+ <dt id="example_group_6" class="passed">List</dt>
316
+ </dl>
317
+ </div>
318
+ <div id="div_group_7" class="example_group passed">
319
+ <dl style="margin-left: 15px;">
320
+ <dt id="example_group_7" class="passed">List</dt>
321
+ <script type="text/javascript">moveProgressBar('57.1');</script>
322
+ <dd class="example passed"><span class="passed_spec_name">#Se extrae el primer elemento de la lista</span><span class='duration'>0.00015s</span></dd>
323
+ <script type="text/javascript">moveProgressBar('71.4');</script>
324
+ <dd class="example passed"><span class="passed_spec_name">#Se puede insertar un elemento</span><span class='duration'>0.00012s</span></dd>
325
+ <script type="text/javascript">moveProgressBar('85.7');</script>
326
+ <dd class="example passed"><span class="passed_spec_name">#Debe existir una Lista con su cabeza</span><span class='duration'>0.00013s</span></dd>
327
+ <script type="text/javascript">moveProgressBar('100.0');</script>
328
+ <dd class="example passed"><span class="passed_spec_name">#Se pueden insertar varios elementos</span><span class='duration'>0.00015s</span></dd>
329
+ </dl>
330
+ </div>
331
+ <script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>0.00599 seconds</strong>";</script>
332
+ <script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 0 failures";</script>
333
+ </div>
334
+ </div>
335
+ </body>
336
+ </html>
337
+
338
+ Randomized with seed 9255
339
+