prct07 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +13 -0
- data/.rspec +2 -0
- data/.travis.yml +11 -0
- data/Gemfile +10 -0
- data/Guardfile +39 -0
- data/LICENSE.txt +22 -0
- data/README.md +44 -0
- data/Rakefile +6 -0
- data/doc/Gemfile.html +102 -0
- data/doc/Gemfile_lock.html +176 -0
- data/doc/Guardfile.html +137 -0
- data/doc/LICENSE_txt.html +116 -0
- data/doc/Prct07.html +151 -0
- data/doc/Prct07/Exam.html +193 -0
- data/doc/Prct07/Inter_user.html +319 -0
- data/doc/Prct07/Lista_doble.html +418 -0
- data/doc/Prct07/Preg.html +231 -0
- data/doc/Prct07/SimpleExpec.html +356 -0
- data/doc/Prct07/VerdFals.html +312 -0
- data/doc/README_md.html +163 -0
- data/doc/Rakefile.html +103 -0
- data/doc/created.rid +18 -0
- data/doc/fonts.css +167 -0
- data/doc/fonts/Lato-Light.ttf +0 -0
- data/doc/fonts/Lato-LightItalic.ttf +0 -0
- data/doc/fonts/Lato-Regular.ttf +0 -0
- data/doc/fonts/Lato-RegularItalic.ttf +0 -0
- data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +116 -0
- data/doc/js/darkfish.js +140 -0
- data/doc/js/jquery.js +4 -0
- data/doc/js/navigation.js +142 -0
- data/doc/js/search.js +109 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/searcher.js +228 -0
- data/doc/prct07_gemspec.html +123 -0
- data/doc/rdoc.css +580 -0
- data/doc/table_of_contents.html +205 -0
- data/lib/prct07.rb +8 -0
- data/lib/prct07/exam.rb +80 -0
- data/lib/prct07/inter_user.rb +93 -0
- data/lib/prct07/lista_doble.rb +181 -0
- data/lib/prct07/preg.rb +17 -0
- data/lib/prct07/quiz.rb +80 -0
- data/lib/prct07/simple_expec.rb +40 -0
- data/lib/prct07/verd_fals.rb +27 -0
- data/lib/prct07/version.rb +3 -0
- data/prct07.gemspec +30 -0
- data/spec/prct07_spec.rb +400 -0
- data/spec/spec_helper.rb +20 -0
- metadata +221 -0
data/lib/prct07/preg.rb
ADDED
data/lib/prct07/quiz.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
module Prct07
|
2
|
+
|
3
|
+
|
4
|
+
class Question
|
5
|
+
attr_accessor :text, :answer
|
6
|
+
|
7
|
+
def initialize (text, answer)
|
8
|
+
@text = text
|
9
|
+
@answer = answer
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_s
|
13
|
+
aux = " "
|
14
|
+
aux << text << "\n"
|
15
|
+
i = 1
|
16
|
+
aux << "\t#{i}- #{answer[:right]}\n"
|
17
|
+
answer[:wrong].each do |op|
|
18
|
+
aux<<"\t#{i+=1}- #{op}\n"
|
19
|
+
end
|
20
|
+
aux
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
class Quiz
|
28
|
+
attr_accessor :title, :arquestions
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
def initialize(title, &block)
|
33
|
+
@title = title
|
34
|
+
@arquestions = []
|
35
|
+
instance_eval &block
|
36
|
+
end
|
37
|
+
|
38
|
+
def question(text, options = {})
|
39
|
+
question = Question.new(text,options)
|
40
|
+
@arquestions << question
|
41
|
+
end
|
42
|
+
|
43
|
+
def wrong (option)
|
44
|
+
@arquestions[-1].answer[:wrong] << option
|
45
|
+
end
|
46
|
+
|
47
|
+
def run
|
48
|
+
temp = title
|
49
|
+
temp << "\n"
|
50
|
+
@arquestions.each_with_index do |question, index|
|
51
|
+
temp << "#{index+ 1})#{question}\n"
|
52
|
+
end
|
53
|
+
temp
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
quiz = Quiz.new("Cuestionario de LPP 11/12/14") {
|
59
|
+
question '!Cuantos argumentos de tipo bloque puede recibir un metodo?',
|
60
|
+
:right => '1',
|
61
|
+
:wrong => []
|
62
|
+
wrong '2'
|
63
|
+
wrong 'muchos'
|
64
|
+
wrong 'los que defina el usuario'
|
65
|
+
|
66
|
+
question '!En Ruby los bloque son objetos que continen codigo?',
|
67
|
+
:right=>'Falso',
|
68
|
+
:wrong => []
|
69
|
+
wrong 'Cierto'
|
70
|
+
question "salida de : class Objeto \n end",
|
71
|
+
:right => "Una instancia de la clase Class",
|
72
|
+
:wrong => []
|
73
|
+
wrong 'una constante'
|
74
|
+
wrong 'un objeto'
|
75
|
+
wrong 'ninguna de las anteriores'
|
76
|
+
}
|
77
|
+
|
78
|
+
puts quiz.run
|
79
|
+
|
80
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#===Class SimpleExpec
|
2
|
+
#* def initialize, def to_html, def <=, def >=, def to_s
|
3
|
+
|
4
|
+
require 'pry'
|
5
|
+
|
6
|
+
module Prct07
|
7
|
+
class SimpleExpec < Prct07::Preg
|
8
|
+
attr_accessor :verd, :distractor
|
9
|
+
def initialize(args)
|
10
|
+
super(args[:text])
|
11
|
+
@verd = args[:verd]
|
12
|
+
raise ArgumentError, 'Specify :right' unless @verd
|
13
|
+
@distractor = args[:distractor]
|
14
|
+
raise ArgumentError, 'Specify :distractor' unless @distractor
|
15
|
+
end
|
16
|
+
def to_html
|
17
|
+
options = @distractor+[@verd]
|
18
|
+
options = options.sample # Metodo que baraja un array
|
19
|
+
options = ''
|
20
|
+
options.each do |options|
|
21
|
+
options += %Q{<input type = "radio" value= "#{options}" name = 0 > #{options}\n}
|
22
|
+
html = %Q{
|
23
|
+
{#{@text}}<br/>
|
24
|
+
{#{options}}
|
25
|
+
}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
def to_s
|
29
|
+
"#{@text}#{@verd}#{@distractor}"
|
30
|
+
end
|
31
|
+
|
32
|
+
def <= (other)
|
33
|
+
distractor.size <= other.distractor.size
|
34
|
+
end
|
35
|
+
|
36
|
+
def >= (other)
|
37
|
+
distractor.size >= other.distractor.size
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#===Class VerdFals
|
2
|
+
#* def initialize, def <=, def >=, def to_s
|
3
|
+
|
4
|
+
module Prct07
|
5
|
+
class VerdFals < Prct07::Preg
|
6
|
+
attr_accessor :verd, :fals
|
7
|
+
def initialize(args)
|
8
|
+
super(args[:text])
|
9
|
+
@verd = args[:verd]
|
10
|
+
raise ArgumentError, 'Specify :verd' unless @verd
|
11
|
+
@fals = args[:fals]
|
12
|
+
raise ArgumentError, 'Specify :fals' unless @fals
|
13
|
+
end
|
14
|
+
def to_s
|
15
|
+
"#{@text}#{@verd}#{@fals}"
|
16
|
+
end
|
17
|
+
def <=(other)
|
18
|
+
verd.size <= other.verd.size
|
19
|
+
end
|
20
|
+
|
21
|
+
def >= (other)
|
22
|
+
verd.size >= other.verd.size
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
end
|
data/prct07.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'prct07/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "prct07"
|
8
|
+
spec.version = Prct07::VERSION
|
9
|
+
spec.authors = ["alu0100622492"]
|
10
|
+
spec.email = ["alu0100622492@ull.edu.es"]
|
11
|
+
spec.summary = %q{Gema_LPP}
|
12
|
+
spec.description = %q{Creacion_de_la_gema_prct07}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency 'rspec', '~>2.11'
|
24
|
+
spec.add_development_dependency "guard"
|
25
|
+
spec.add_development_dependency "guard-rspec"
|
26
|
+
spec.add_development_dependency "guard-bundler"
|
27
|
+
spec.add_development_dependency "coveralls"
|
28
|
+
|
29
|
+
|
30
|
+
end
|
data/spec/prct07_spec.rb
ADDED
@@ -0,0 +1,400 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'prct07'
|
3
|
+
#Crear it para saber de que clase son las pruebas
|
4
|
+
#introducir todas las preguntas hechas practica anterior
|
5
|
+
#describe Prct07 do
|
6
|
+
describe Prct07::Lista_doble do
|
7
|
+
before :each do
|
8
|
+
|
9
|
+
@lista_doble = Prct07::Lista_doble.new
|
10
|
+
|
11
|
+
@preg1=Prct07::SimpleExpec.new(
|
12
|
+
:text => "salida de : class Objeto \n end",
|
13
|
+
:verd => "Una instancia de la clase Class",
|
14
|
+
:distractor => ['una constante', 'un objeto', 'ninguna de las anteriores'])
|
15
|
+
|
16
|
+
@nodo1=Prct07::Nodo.new(@preg1, nil,nil)
|
17
|
+
|
18
|
+
|
19
|
+
@preg2=Prct07::VerdFals.new(
|
20
|
+
:text => "Es apropiado que una clase tablero herede de la clase juego? ",
|
21
|
+
:verd => "Falso",
|
22
|
+
:fals => ['Cierto'])
|
23
|
+
|
24
|
+
@nodo2=Prct07::Nodo.new(@preg2, nil,nil)
|
25
|
+
|
26
|
+
|
27
|
+
@preg3=Prct07::SimpleExpec.new(
|
28
|
+
:text => "salida de :
|
29
|
+
class Xyz \n def pots\n
|
30
|
+
@nice\n end\nend\n",
|
31
|
+
:verd => 'nil',
|
32
|
+
:distractor => ['#<Xyz:0x00000002bf0ed0>',0, "ninguna de las anteriores" ])
|
33
|
+
|
34
|
+
@nodo3=Prct07::Nodo.new(@preg3, nil,nil)
|
35
|
+
|
36
|
+
|
37
|
+
@preg4=Prct07::VerdFals.new(
|
38
|
+
:text => "salida de :
|
39
|
+
hash_raro ={ \n
|
40
|
+
[1, 2, 3] => Object.new(), \n
|
41
|
+
Hash.new => :toto
|
42
|
+
}", :verd => "Cierto",
|
43
|
+
:fals => "Falso" )
|
44
|
+
|
45
|
+
@nodo4=Prct07::Nodo.new(@preg4, nil,nil)
|
46
|
+
|
47
|
+
@preg5=Prct07::SimpleExpec.new(
|
48
|
+
:text => "salida de :
|
49
|
+
class Array \n
|
50
|
+
def say_hi \n
|
51
|
+
HEY!
|
52
|
+
end
|
53
|
+
end \n
|
54
|
+
p[1,, bob].say_hi",
|
55
|
+
:verd => "Ninguna de las anteriores",
|
56
|
+
:distractor => ['1', 'bob', 'HEY!'])
|
57
|
+
|
58
|
+
@nodo5=Prct07::Nodo.new(@preg5, nil,nil)
|
59
|
+
|
60
|
+
|
61
|
+
@preg6=Prct07::VerdFals.new(
|
62
|
+
:text => "Es apropiado que una clase tablero herede de la clase juego? ",
|
63
|
+
:verd => "Falso", :fals => ['Cierto'])
|
64
|
+
|
65
|
+
@nodo6=Prct07::Nodo.new(@preg6, nil,nil)
|
66
|
+
|
67
|
+
end
|
68
|
+
context "Creacion de lista;" do
|
69
|
+
it"Empujamos al principio" do
|
70
|
+
|
71
|
+
@lista_doble.push_principio(@nodo1)
|
72
|
+
@lista_doble.push_principio(@nodo2)
|
73
|
+
@lista_doble.push_principio(@nodo3)
|
74
|
+
@lista_doble.push_principio(@nodo4)
|
75
|
+
@lista_doble.push_principio(@nodo5)
|
76
|
+
@lista_doble.push_principio(@nodo6)
|
77
|
+
@lista_doble.pop_principio()
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
context "Pruebas de la clase SimpleExpec con Comparable \n" do
|
83
|
+
it "Pertenece la pregunta a la clase SimpleExpec" do
|
84
|
+
expect(@preg1.class) == Prct07::SimpleExpec
|
85
|
+
end
|
86
|
+
|
87
|
+
|
88
|
+
it "Comprueba que la pregunta preg1 tenga mas opciones erroneas que la pregunta preg3" do
|
89
|
+
expect(@preg1 <= @preg3).to eq(true)
|
90
|
+
end
|
91
|
+
|
92
|
+
it "Comprueba que la pregunta preg1 tenga las mismas opciones erroneas que la pregunta preg5" do
|
93
|
+
expect(@preg1 == @preg5).to eq(false)
|
94
|
+
end
|
95
|
+
|
96
|
+
it "Comprueba que la pregunta preg3 tenga menos opciones que la pregunta preg5" do
|
97
|
+
expect(@preg3 >= @preg5).to eq(true)
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
context "Pruebas para la clase VerdFals con Comparable\n" do
|
107
|
+
|
108
|
+
it "Pertenece la pregunta a la clase VerdFals" do
|
109
|
+
expect(@preg2.class) == Prct07::VerdFals
|
110
|
+
end
|
111
|
+
|
112
|
+
it "Debe tener una respuesta correcta" do
|
113
|
+
expect(@preg2.verd) == ['Cierto']
|
114
|
+
end
|
115
|
+
|
116
|
+
it "Debe tener unas opciones incorrectas" do
|
117
|
+
expect(@preg2.fals) == 'Falso'
|
118
|
+
end
|
119
|
+
|
120
|
+
it "Debe tener un metodo to_s" do
|
121
|
+
expect(@preg2).to respond_to :to_s
|
122
|
+
end
|
123
|
+
|
124
|
+
it "Comprueba que la pregunta preg2 tenga menos opciones correctas que la pregunta preg6" do
|
125
|
+
expect(@preg2 <= @preg6).to eq(true)
|
126
|
+
end
|
127
|
+
|
128
|
+
it "Comprueba que la pregunta preg2 tenga las mismas opciones correctas que la pregunta preg4" do
|
129
|
+
expect(@preg2 == @preg4).to eq(false)
|
130
|
+
end
|
131
|
+
|
132
|
+
it "Comprueba que la pregunta preg2 tenga mas opciones correctas que la pregunta preg6" do
|
133
|
+
expect(@preg6 >= @preg2).to eq(true)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
context "Pruebas para la clase Lista_doble con Enumerable \n" do
|
144
|
+
|
145
|
+
it "Es de la clase Lista_doble" do
|
146
|
+
expect(@nodo1.class) == Prct07::Lista_doble
|
147
|
+
end
|
148
|
+
|
149
|
+
it "Existe un Nodo de la lista con sus datos, su siguiente y su anterior" do
|
150
|
+
expect(@lista_doble.head != nil && @lista_doble.siguiente == nil && @lista_doble.anterior == nil)
|
151
|
+
end
|
152
|
+
|
153
|
+
it "Insertar nodos en la lista" do
|
154
|
+
@lista_doble.push_principio(@nodo1)
|
155
|
+
expect(@lista_doble.head) == (@nodo1)
|
156
|
+
end
|
157
|
+
|
158
|
+
it "Insertar varios elementos por el principio" do
|
159
|
+
@lista_doble.push_principio(@nodo1)
|
160
|
+
@lista_doble.push_principio(@nodo2)
|
161
|
+
expect(@lista_doble.head) == (@nodo2)
|
162
|
+
end
|
163
|
+
|
164
|
+
#it "Insertar varios elementos por el final" do
|
165
|
+
#@lista_doble.push_final(@nodo1)
|
166
|
+
#@lista_doble.push_final(@nodo2)
|
167
|
+
#expect(@lista_doble.ultcola) == (@nodo1)
|
168
|
+
#end
|
169
|
+
|
170
|
+
it "Extraer el primer elemento de la lista" do
|
171
|
+
@lista_doble.push_principio(@nodo1)
|
172
|
+
@lista_doble.push_principio(@nodo2)
|
173
|
+
@lista_doble.pop_principio()
|
174
|
+
expect(@lista_doble.head) == (@nodo2)
|
175
|
+
end
|
176
|
+
|
177
|
+
|
178
|
+
it "Metodo each con el metodo Enumerable" do
|
179
|
+
@lista_doble.each{|i| i}
|
180
|
+
end
|
181
|
+
|
182
|
+
it "Metodo count con el metodo Enumerable" do
|
183
|
+
expect( @lista_doble.count).to eq(0)
|
184
|
+
end
|
185
|
+
|
186
|
+
it "Metodo all con el metodo Enumerable" do
|
187
|
+
expect(@lista_doble.all?).to eq(true)
|
188
|
+
end
|
189
|
+
|
190
|
+
it "Metodo max con el metodo Enumerable" do
|
191
|
+
expect(@lista_doble.max).to eq(nil)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
describe Prct07::Exam do
|
197
|
+
describe Prct07::Inter_user do
|
198
|
+
describe Prct07::Lista_doble do
|
199
|
+
|
200
|
+
before :each do
|
201
|
+
@list= Prct07::Lista_doble.new
|
202
|
+
|
203
|
+
@preg1=Prct07::SimpleExpec.new(
|
204
|
+
:text => "salida de : class Objeto \n end",
|
205
|
+
:verd => "Una instancia de la clase Class",
|
206
|
+
:distractor => ['una constante', 'un objeto', 'ninguna de las anteriores'])
|
207
|
+
|
208
|
+
@preg2=Prct07::VerdFals.new(
|
209
|
+
:text => "Es apropiado que una clase tablero herede de la clase juego? ",
|
210
|
+
:verd => "Falso",
|
211
|
+
:fals => ['Cierto'])
|
212
|
+
|
213
|
+
|
214
|
+
@preg3=Prct07::SimpleExpec.new(
|
215
|
+
:text => "salida de :
|
216
|
+
class Xyz \n def pots\n
|
217
|
+
@nice\n end\nend\n",
|
218
|
+
:verd => 'nil',
|
219
|
+
:distractor => ['#<Xyz:0x00000002bf0ed0>',0, "ninguna de las anteriores" ])
|
220
|
+
|
221
|
+
|
222
|
+
@preg4=Prct07::VerdFals.new(
|
223
|
+
:text => "salida de :
|
224
|
+
hash_raro ={ \n
|
225
|
+
[1, 2, 3] => Object.new(), \n
|
226
|
+
Hash.new => :toto
|
227
|
+
}",
|
228
|
+
:verd => "Cierto",
|
229
|
+
:fals => "Falso" )
|
230
|
+
|
231
|
+
|
232
|
+
@list.push_principio(@preg1)
|
233
|
+
@list.push_principio(@preg2)
|
234
|
+
@list.push_principio(@preg3)
|
235
|
+
@list.push_principio(@preg4)
|
236
|
+
|
237
|
+
|
238
|
+
@examen = Prct07::Exam.new(@list)
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
@interfaz= Prct07::Inter_user.new(@list)
|
243
|
+
@interfaz.examen.seleccion_presentados = ["Cierto", 'nil', "Falso","Una instancia de la clase Class"]
|
244
|
+
|
245
|
+
end
|
246
|
+
|
247
|
+
context "Pruebas de la clase examen e interfaz de usuario" do
|
248
|
+
it "Existe una clase examen" do
|
249
|
+
expect(@examen.class).to eq Prct07::Exam
|
250
|
+
end
|
251
|
+
|
252
|
+
it "La clase examen tiene una lista de preguntas" do
|
253
|
+
expect(@examen.lista_enlazada.class).to eq Prct07::Lista_doble
|
254
|
+
end
|
255
|
+
|
256
|
+
it "La clase interfaz tiene un atributo de la clase examen" do
|
257
|
+
expect(@interfaz.examen.class) == Prct07::Exam
|
258
|
+
end
|
259
|
+
|
260
|
+
it "El examen tiene un atributo de tipo Lista doble" do
|
261
|
+
expect(@interfaz.examen.lista_enlazada.class) == Prct07::Lista_doble
|
262
|
+
end
|
263
|
+
|
264
|
+
|
265
|
+
#nota =10
|
266
|
+
it "La clase examen te dice si estas aprobado o suspendido" do
|
267
|
+
@interfaz.mostrar(["Cierto", 'nil', "Falso","Una instancia de la clase Class"])
|
268
|
+
expect(@interfaz.puntuacion)== (true)
|
269
|
+
end
|
270
|
+
#nota 7.5
|
271
|
+
it "La clase examen te dice si estas aprobado o suspendido" do
|
272
|
+
@interfaz.mostrar(["Cierto",'nil',"Cierto","Una instancia de la clase Class"])
|
273
|
+
expect(@interfaz.puntuacion)== (true)
|
274
|
+
end
|
275
|
+
#nota5
|
276
|
+
it "La clase examen te dice si estas aprobado o suspendido" do
|
277
|
+
@interfaz.mostrar(['nil',"Cierto", "Falso","Una instancia de la clase Class"])
|
278
|
+
expect(@interfaz.puntuacion)== (true)
|
279
|
+
end
|
280
|
+
#nota2.5
|
281
|
+
it "La clase examen te dice si estas aprobado o suspendido" do
|
282
|
+
@interfaz.mostrar(["Falso", 'nil', "Cierto",'Una constante'])
|
283
|
+
expect(@interfaz.puntuacion)== (true)
|
284
|
+
end
|
285
|
+
#nota = 0
|
286
|
+
it "La clase examen te dice si estas aprobado o suspendido" do
|
287
|
+
@interfaz.examen.seleccion_presentados = ["Verdadero","Una instancia de la clase Class", "Ninguna de las anteriores", "Cierto"]
|
288
|
+
@interfaz.mostrar(@interfaz.examen.seleccion_presentados)
|
289
|
+
expect(@interfaz.puntuacion)== (true)
|
290
|
+
end
|
291
|
+
|
292
|
+
|
293
|
+
it "Pertenece a la clase lista_enlazada " do
|
294
|
+
expect(@examen.class.ancestors) == Kernel
|
295
|
+
end
|
296
|
+
it "Donde pertenece" do
|
297
|
+
expect(@examen.class.superclass) == Object
|
298
|
+
end
|
299
|
+
|
300
|
+
end
|
301
|
+
|
302
|
+
context "Pruebas de funcion funcional reverse" do
|
303
|
+
it "Comprobamos si el metodo reverse funciona" do
|
304
|
+
|
305
|
+
@listaprueba = Prct07::Lista_doble.new
|
306
|
+
@listaprueba.push_principio(@preg4)
|
307
|
+
@listaprueba.push_principio(@preg3)
|
308
|
+
@listaprueba.push_principio(@preg2)
|
309
|
+
@listaprueba.push_principio(@preg1)
|
310
|
+
|
311
|
+
|
312
|
+
@a = Prct07::Lista_doble.new
|
313
|
+
@a.push_principio(@preg1)
|
314
|
+
@a.push_principio(@preg2)
|
315
|
+
@a.push_principio(@preg3)
|
316
|
+
@a.push_principio(@preg4)
|
317
|
+
@ab=@a.reverse_lista
|
318
|
+
|
319
|
+
expect(@listaprueba.head.valor).to eq(@ab.head.valor)
|
320
|
+
expect(@listaprueba.pop_principio()).to eq (@ab.pop_principio())
|
321
|
+
expect(@listaprueba.pop_principio()).to eq (@ab.pop_principio())
|
322
|
+
expect(@listaprueba.pop_principio()).to eq (@ab.pop_principio())
|
323
|
+
expect(@listaprueba.pop_principio()).to eq (@ab.pop_principio())
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
end
|
330
|
+
end
|
331
|
+
end
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
335
|
+
describe Prct07::Quiz do
|
336
|
+
describe Prct07::Question do
|
337
|
+
context "Pruebas de las clase Question y Quiz DSL" do
|
338
|
+
@quiz = Prct07::Quiz.new("Cuestionario de LPP 11/12/14"){
|
339
|
+
question '!Cuantos argumentos de tipo bloque puede recibir un metodo?',
|
340
|
+
:right => '1',
|
341
|
+
:wrong => []
|
342
|
+
wrong '2'
|
343
|
+
wrong 'muchos'
|
344
|
+
wrong 'los que defina el usuario'
|
345
|
+
|
346
|
+
question '!En Ruby los bloque son objetos que continen codigo?',
|
347
|
+
:right =>'Falso',
|
348
|
+
:wrong => []
|
349
|
+
wrong 'Cierto'
|
350
|
+
question "salida de : class Objeto \n end",
|
351
|
+
:right => "Una instancia de la clase Class",
|
352
|
+
:wrong => []
|
353
|
+
wrong 'una constante'
|
354
|
+
wrong 'un objeto'
|
355
|
+
wrong 'ninguna de las anteriores'
|
356
|
+
|
357
|
+
}
|
358
|
+
it "Pertenece la pregunta a la clase Quiz" do
|
359
|
+
expect(@quiz.class) == Prct07::Quiz
|
360
|
+
end
|
361
|
+
it "Debe tener un metodo to_s" do
|
362
|
+
expect(@quiz).to respond_to :to_s
|
363
|
+
end
|
364
|
+
#it "Tiene un metodo wrong" do
|
365
|
+
# expect(@quiz).to respond_to :wrong
|
366
|
+
#end
|
367
|
+
end
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
# context "Pruebas para la clase Inter_user \n" do
|
372
|
+
|
373
|
+
# it "Examen ancestor" do
|
374
|
+
# expect(@insta.class.ancestors) == Kernel
|
375
|
+
# end
|
376
|
+
# it "Interfaz users" do
|
377
|
+
# @lista_enlazada=Prct07::Lista_doble.new()
|
378
|
+
|
379
|
+
# @lista_enlazada.push_principio(@nodo1)
|
380
|
+
# @lista_enlazada.push_principio(@nodo2)
|
381
|
+
# @lista_enlazada.push_principio(@nodo3)
|
382
|
+
# #@lista_enlazada.pop_final()
|
383
|
+
# @Inter_user=Prct07::Inter_user.new(1)
|
384
|
+
# #@Inter_user.mostrar()
|
385
|
+
# end
|
386
|
+
|
387
|
+
# end
|
388
|
+
|
389
|
+
# before :each do
|
390
|
+
# @instance = Prct07::Exam.new()
|
391
|
+
# end
|
392
|
+
# context "Pruebas para la clase Exam \n" do
|
393
|
+
|
394
|
+
# it "Examen ancestor" do
|
395
|
+
# expect(@instance.class.ancestors) == Kernel
|
396
|
+
# end
|
397
|
+
|
398
|
+
# end
|
399
|
+
|
400
|
+
|