gipper 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/PostInstall.txt +5 -0
- data/README.rdoc +49 -0
- data/Rakefile +69 -0
- data/VERSION.yml +4 -0
- data/docs/gift_reference.pdf +0 -0
- data/features/fixtures/matching.gift +9 -0
- data/features/fixtures/missing_word.gift +8 -0
- data/features/fixtures/multiple_choice.gift +41 -0
- data/features/fixtures/numerical.gift +10 -0
- data/features/fixtures/short_answer.gift +10 -0
- data/features/fixtures/super_gift.txt +169 -0
- data/features/fixtures/true_or_false.gift +19 -0
- data/features/gift_parsing.feature +10 -0
- data/features/parse_matching_questions.feature +10 -0
- data/features/parse_missing_word.feature +10 -0
- data/features/parse_multiple_choice_questions.feature +10 -0
- data/features/parse_numerical_questions.feature +10 -0
- data/features/parse_short_answer_questions.feature +10 -0
- data/features/parse_true_or_false_questions.feature +10 -0
- data/features/steps/gift_parsing_steps.rb +546 -0
- data/features/steps/parse_matching_steps.rb +30 -0
- data/features/steps/parse_missing_word_steps.rb +58 -0
- data/features/steps/parse_multiple_choice_steps.rb +107 -0
- data/features/steps/parse_numerical_steps.rb +35 -0
- data/features/steps/parse_short_answer_steps.rb +42 -0
- data/features/steps/parse_steps.rb +7 -0
- data/features/steps/parse_true_or_false_steps.rb +61 -0
- data/features/support/env.rb +10 -0
- data/lib/answer.rb +165 -0
- data/lib/answers.rb +99 -0
- data/lib/gipper.rb +15 -0
- data/lib/question.rb +53 -0
- data/lib/quiz.rb +31 -0
- data/lib/special_charater_handler.rb +8 -0
- data/script/txt2html +71 -0
- data/script/txt2html.cmd +1 -0
- data/tasks/rspec.rake +21 -0
- data/test/answer_test.rb +152 -0
- data/test/answers_test.rb +126 -0
- data/test/custom_assertions.rb +68 -0
- data/test/fixtures/begins_with_comment.txt +6 -0
- data/test/question_test.rb +86 -0
- data/test/quiz_test.rb +65 -0
- data/test/special_character_handler_test.rb +43 -0
- data/test/test_helper.rb +19 -0
- metadata +125 -0
@@ -0,0 +1,10 @@
|
|
1
|
+
Story: Parsing multiple choice questions
|
2
|
+
As a developer
|
3
|
+
I want to parse a GIFT file containing multiple choice questions
|
4
|
+
So that I can use the data in my application
|
5
|
+
|
6
|
+
Scenario: read a file and return an array of questions and answers
|
7
|
+
Given a GIFT file of multiple choice questions
|
8
|
+
When I tell gipper to parse the file
|
9
|
+
Then I will get an array of questions and answers
|
10
|
+
And contains the correct multiple choice questions
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Story: Parsing numerical questions
|
2
|
+
As a developer
|
3
|
+
I want to parse a GIFT file containing numerical questions
|
4
|
+
So that I can use the data in my application
|
5
|
+
|
6
|
+
Scenario: read a file and return an array of questions and answers
|
7
|
+
Given a GIFT file of numerical questions
|
8
|
+
When I tell gipper to parse the file
|
9
|
+
Then I will get an array of questions and answers
|
10
|
+
And contains the correct numerical questions
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Story: Parsing short answer questions
|
2
|
+
As a developer
|
3
|
+
I want to parse a GIFT file containing short answer questions
|
4
|
+
So that I can use the data in my application
|
5
|
+
|
6
|
+
Scenario: read a file and return an array of questions and answers
|
7
|
+
Given a GIFT file of short answer questions
|
8
|
+
When I tell gipper to parse the file
|
9
|
+
Then I will get an array of questions and answers
|
10
|
+
And contains the correct short answer questions
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Story: Parsing true or false questions
|
2
|
+
As a developer
|
3
|
+
I want to parse a GIFT file containing true or false questions
|
4
|
+
So that I can use the data in my application
|
5
|
+
|
6
|
+
Scenario: read a file and return an array of questions and answers
|
7
|
+
Given a GIFT file of true or false questions
|
8
|
+
When I tell gipper to parse the file
|
9
|
+
Then I will get an array of questions and answers
|
10
|
+
And contains the correct true or false questions
|
@@ -0,0 +1,546 @@
|
|
1
|
+
|
2
|
+
Given /^a GIFT file$/ do
|
3
|
+
file = File.open(File.join(File.dirname(__FILE__), *%w[.. fixtures super_gift.txt]))
|
4
|
+
@data = file.read
|
5
|
+
assert @data.length > 0
|
6
|
+
end
|
7
|
+
|
8
|
+
Then /^contains the correct questions$/ do
|
9
|
+
#// Basic GIFT questions
|
10
|
+
#// GIFT filter and documentation by Paul Tsuchido Shew http://ac.shew.jp.
|
11
|
+
#//---------------------------
|
12
|
+
#
|
13
|
+
#Who's buried in Grant's tomb?{~Grant ~Jefferson =no one}
|
14
|
+
@questions[0].style.should eql(:multiple_choice)
|
15
|
+
@questions[0].text.should eql("Who's buried in Grant's tomb?")
|
16
|
+
@questions[0].text_post.should eql(nil)
|
17
|
+
@questions[0].title.should eql(nil)
|
18
|
+
@questions[0].answer.length.should eql(3)
|
19
|
+
@questions[0].answer[0].correct.should eql(false)
|
20
|
+
@questions[0].answer[0].text.should eql("Grant")
|
21
|
+
@questions[0].answer[1].correct.should eql(false)
|
22
|
+
@questions[0].answer[1].text.should eql("Jefferson")
|
23
|
+
@questions[0].answer[2].correct.should eql(true)
|
24
|
+
@questions[0].answer[2].text.should eql("no one")
|
25
|
+
|
26
|
+
#Grant is {~buried =entombed ~living} in Grant's tomb.
|
27
|
+
@questions[1].style.should eql(:missing_word)
|
28
|
+
@questions[1].text.should eql("Grant is")
|
29
|
+
@questions[1].text_post.should eql("in Grant's tomb.")
|
30
|
+
@questions[1].title.should eql(nil)
|
31
|
+
@questions[1].answer.length.should eql(3)
|
32
|
+
@questions[1].answer[0].correct.should eql(false)
|
33
|
+
@questions[1].answer[0].text.should eql("buried")
|
34
|
+
@questions[1].answer[1].correct.should eql(true)
|
35
|
+
@questions[1].answer[1].text.should eql("entombed")
|
36
|
+
@questions[1].answer[2].correct.should eql(false)
|
37
|
+
@questions[1].answer[2].text.should eql("living")
|
38
|
+
|
39
|
+
#//----------------------------------
|
40
|
+
#// Formatting
|
41
|
+
#//----------------------------------
|
42
|
+
#The American holiday of Thanksgiving is celebrated on the {
|
43
|
+
# ~second
|
44
|
+
# ~third
|
45
|
+
# =fourth
|
46
|
+
#} Thursday of November.
|
47
|
+
@questions[2].style.should eql(:missing_word)
|
48
|
+
@questions[2].text.should eql("The American holiday of Thanksgiving is celebrated on the")
|
49
|
+
@questions[2].text_post.should eql("Thursday of November.")
|
50
|
+
@questions[2].title.should eql(nil)
|
51
|
+
@questions[2].answer.length.should eql(3)
|
52
|
+
@questions[2].answer[0].correct.should eql(false)
|
53
|
+
@questions[2].answer[0].text.should eql("second")
|
54
|
+
@questions[2].answer[1].correct.should eql(false)
|
55
|
+
@questions[2].answer[1].text.should eql("third")
|
56
|
+
@questions[2].answer[2].correct.should eql(true)
|
57
|
+
@questions[2].answer[2].text.should eql("fourth")
|
58
|
+
#
|
59
|
+
#Japanese characters originally came from what country? {
|
60
|
+
# ~India
|
61
|
+
# =China
|
62
|
+
# ~Korea
|
63
|
+
# ~Egypt}
|
64
|
+
@questions[3].style.should eql(:multiple_choice)
|
65
|
+
@questions[3].text.should eql("Japanese characters originally came from what country?")
|
66
|
+
@questions[3].text_post.should eql(nil)
|
67
|
+
@questions[3].title.should eql(nil)
|
68
|
+
@questions[3].answer.length.should eql(4)
|
69
|
+
@questions[3].answer[0].correct.should eql(false)
|
70
|
+
@questions[3].answer[0].text.should eql("India")
|
71
|
+
@questions[3].answer[1].correct.should eql(true)
|
72
|
+
@questions[3].answer[1].text.should eql("China")
|
73
|
+
@questions[3].answer[2].correct.should eql(false)
|
74
|
+
@questions[3].answer[2].text.should eql("Korea")
|
75
|
+
@questions[3].answer[3].correct.should eql(false)
|
76
|
+
@questions[3].answer[3].text.should eql("Egypt")
|
77
|
+
|
78
|
+
#Who's buried in Grant's tomb?{=no one =nobody}
|
79
|
+
@questions[4].style.should eql(:short_answer)
|
80
|
+
@questions[4].text.should eql("Who's buried in Grant's tomb?")
|
81
|
+
@questions[4].text_post.should eql(nil)
|
82
|
+
@questions[4].title.should eql(nil)
|
83
|
+
@questions[4].answer.length.should eql(2)
|
84
|
+
@questions[4].answer[0].correct.should eql(true)
|
85
|
+
@questions[4].answer[0].text.should eql("no one")
|
86
|
+
@questions[4].answer[1].correct.should eql(true)
|
87
|
+
@questions[4].answer[1].text.should eql("nobody")
|
88
|
+
|
89
|
+
#Two plus two equals {=four =4}
|
90
|
+
@questions[5].style.should eql(:short_answer)
|
91
|
+
@questions[5].text.should eql("Two plus two equals")
|
92
|
+
@questions[5].text_post.should eql(nil)
|
93
|
+
@questions[5].title.should eql(nil)
|
94
|
+
@questions[5].answer.length.should eql(2)
|
95
|
+
@questions[5].answer[0].correct.should eql(true)
|
96
|
+
@questions[5].answer[0].text.should eql("four")
|
97
|
+
@questions[5].answer[1].correct.should eql(true)
|
98
|
+
@questions[5].answer[1].text.should eql("4")
|
99
|
+
|
100
|
+
#Four plus one equals {5}
|
101
|
+
@questions[6].style.should eql(:short_answer)
|
102
|
+
@questions[6].text.should eql("Four plus one equals")
|
103
|
+
@questions[6].text_post.should eql(nil)
|
104
|
+
@questions[6].title.should eql(nil)
|
105
|
+
@questions[6].answer.length.should eql(1)
|
106
|
+
@questions[6].answer[0].correct.should eql(true)
|
107
|
+
@questions[6].answer[0].text.should eql("5")
|
108
|
+
|
109
|
+
|
110
|
+
#Three plus {2} equals five.
|
111
|
+
@questions[7].style.should eql(:missing_word)
|
112
|
+
@questions[7].text.should eql("Three plus")
|
113
|
+
@questions[7].text_post.should eql("equals five.")
|
114
|
+
@questions[7].title.should eql(nil)
|
115
|
+
@questions[7].answer.length.should eql(1)
|
116
|
+
@questions[7].answer[0].correct.should eql(true)
|
117
|
+
@questions[7].answer[0].text.should eql("2")
|
118
|
+
|
119
|
+
#Grant is buried in Grant's tomb.{F}
|
120
|
+
@questions[8].style.should eql(:true_false)
|
121
|
+
@questions[8].text.should eql("Grant is buried in Grant's tomb.")
|
122
|
+
@questions[8].text_post.should eql(nil)
|
123
|
+
@questions[8].title.should eql(nil)
|
124
|
+
@questions[8].answer.length.should eql(1)
|
125
|
+
@questions[8].answer[0].correct.should eql(false)
|
126
|
+
|
127
|
+
# The sun rises in the east.{T}
|
128
|
+
@questions[9].style.should eql(:true_false)
|
129
|
+
@questions[9].text.should eql("The sun rises in the east.")
|
130
|
+
@questions[9].text_post.should eql(nil)
|
131
|
+
@questions[9].title.should eql(nil)
|
132
|
+
@questions[9].answer.length.should eql(1)
|
133
|
+
@questions[9].answer[0].correct.should eql(true)
|
134
|
+
|
135
|
+
#// ------------------------------------------
|
136
|
+
#// Matching
|
137
|
+
#// There must be at least three matching pairs.
|
138
|
+
#// Matching questions do not support feedback or percentage answer weights.
|
139
|
+
#// ------------------------------------------
|
140
|
+
#
|
141
|
+
# Matching Question. {
|
142
|
+
# =subquestion1 -> subanswer1
|
143
|
+
# =subquestion2 -> subanswer2
|
144
|
+
# =subquestion3 -> subanswer3
|
145
|
+
# }
|
146
|
+
@questions[10].style.should eql(:matching)
|
147
|
+
@questions[10].text.should eql("Matching Question.")
|
148
|
+
@questions[10].text_post.should eql(nil)
|
149
|
+
@questions[10].title.should eql(nil)
|
150
|
+
@questions[10].answer.length.should eql(3)
|
151
|
+
@questions[10].answer[0].text.should eql("subquestion1")
|
152
|
+
@questions[10].answer[0].correct.should eql("subanswer1")
|
153
|
+
@questions[10].answer[1].text.should eql("subquestion2")
|
154
|
+
@questions[10].answer[1].correct.should eql("subanswer2")
|
155
|
+
@questions[10].answer[2].text.should eql("subquestion3")
|
156
|
+
@questions[10].answer[2].correct.should eql("subanswer3")
|
157
|
+
|
158
|
+
# Match the following countries with their corresponding capitals. {
|
159
|
+
# =Canada -> Ottawa
|
160
|
+
# =Italy -> Rome
|
161
|
+
# =Japan -> Tokyo
|
162
|
+
# =India -> New Delhi
|
163
|
+
# }
|
164
|
+
question = @questions[11]
|
165
|
+
question.style.should eql(:matching)
|
166
|
+
question.text.should eql("Match the following countries with their corresponding capitals.")
|
167
|
+
question.text_post.should eql(nil)
|
168
|
+
question.title.should eql(nil)
|
169
|
+
question.answer.length.should eql(4)
|
170
|
+
question.answer[0].text.should eql("Canada")
|
171
|
+
question.answer[0].correct.should eql("Ottawa")
|
172
|
+
question.answer[1].text.should eql("Italy")
|
173
|
+
question.answer[1].correct.should eql("Rome")
|
174
|
+
question.answer[2].text.should eql("Japan")
|
175
|
+
question.answer[2].correct.should eql("Tokyo")
|
176
|
+
question.answer[3].text.should eql("India")
|
177
|
+
question.answer[3].correct.should eql("New Delhi")
|
178
|
+
|
179
|
+
#// ------------------------------------------
|
180
|
+
#// Numerical
|
181
|
+
#// ------------------------------------------
|
182
|
+
#
|
183
|
+
# When was Ulysses S. Grant born? {#1822}
|
184
|
+
question = @questions[12]
|
185
|
+
question.style.should eql(:numerical)
|
186
|
+
question.text.should eql("When was Ulysses S. Grant born?")
|
187
|
+
question.text_post.should eql(nil)
|
188
|
+
question.title.should eql(nil)
|
189
|
+
question.answer.length.should eql(1)
|
190
|
+
question.answer[0].correct.should eql(1822)
|
191
|
+
question.answer[0].range.should eql(0)
|
192
|
+
question.answer[0].weight.should eql(nil)
|
193
|
+
|
194
|
+
# What is the value of pi (to 3 decimal places)? {#3.1415:0.0005}
|
195
|
+
question = @questions[13]
|
196
|
+
question.style.should eql(:numerical)
|
197
|
+
question.text.should eql("What is the value of pi (to 3 decimal places)?")
|
198
|
+
question.text_post.should eql(nil)
|
199
|
+
question.title.should eql(nil)
|
200
|
+
question.answer.length.should eql(1)
|
201
|
+
question.answer[0].correct.should eql(3.1415)
|
202
|
+
question.answer[0].range.should eql(0.0005)
|
203
|
+
question.answer[0].weight.should eql(nil)
|
204
|
+
|
205
|
+
# What is the value of pi (to 3 decimal places)? {#3.141..3.142}
|
206
|
+
question = @questions[14]
|
207
|
+
question.style.should eql(:numerical)
|
208
|
+
question.text.should eql("What is the value of pi (to 3 decimal places)?")
|
209
|
+
question.text_post.should eql(nil)
|
210
|
+
question.title.should eql(nil)
|
211
|
+
question.answer.length.should eql(1)
|
212
|
+
(question.answer[0].correct * 100000).round.should eql(314150)
|
213
|
+
(question.answer[0].range * 100000).round.should eql(50)
|
214
|
+
question.answer[0].weight.should eql(nil)
|
215
|
+
|
216
|
+
# When was Ulysses S. Grant born? {#
|
217
|
+
# =1822:0
|
218
|
+
# =%50%1822:2}
|
219
|
+
question = @questions[15]
|
220
|
+
question.style.should eql(:numerical)
|
221
|
+
question.text.should eql("When was Ulysses S. Grant born?")
|
222
|
+
question.text_post.should eql(nil)
|
223
|
+
question.title.should eql(nil)
|
224
|
+
question.answer.length.should eql(2)
|
225
|
+
question.answer[0].correct.should eql(1822)
|
226
|
+
question.answer[0].range.should eql(0)
|
227
|
+
question.answer[0].weight.should eql(nil)
|
228
|
+
question.answer[1].correct.should eql(1822)
|
229
|
+
question.answer[1].range.should eql(2)
|
230
|
+
question.answer[1].weight.should eql(50)
|
231
|
+
|
232
|
+
#
|
233
|
+
#//Line Comments:
|
234
|
+
#
|
235
|
+
#// Subheading: Numerical questions below
|
236
|
+
#What's 2 plus 2? {#4}
|
237
|
+
question = @questions[16]
|
238
|
+
question.style.should eql(:numerical)
|
239
|
+
question.text.should eql("What's 2 plus 2?")
|
240
|
+
question.text_post.should eql(nil)
|
241
|
+
question.title.should eql(nil)
|
242
|
+
question.answer.length.should eql(1)
|
243
|
+
question.answer[0].correct.should eql(4)
|
244
|
+
question.answer[0].range.should eql(0)
|
245
|
+
question.answer[0].weight.should eql(nil)
|
246
|
+
|
247
|
+
#//Question Name:
|
248
|
+
#::Kanji Origins::Japanese characters originally
|
249
|
+
#came from what country? {=China}
|
250
|
+
question = @questions[17]
|
251
|
+
question.style.should eql(:short_answer)
|
252
|
+
question.text.should eql("Japanese characters originally\ncame from what country?")
|
253
|
+
question.text_post.should eql(nil)
|
254
|
+
question.title.should eql("Kanji Origins")
|
255
|
+
question.answer.length.should eql(1)
|
256
|
+
question.answer[0].correct.should eql(true)
|
257
|
+
question.answer[0].text.should eql("China")
|
258
|
+
|
259
|
+
# ::Thanksgiving Date::The American holiday of Thanksgiving is
|
260
|
+
# celebrated on the {~second ~third =fourth} Thursday of November.
|
261
|
+
question = @questions[18]
|
262
|
+
question.style.should eql(:missing_word)
|
263
|
+
question.text.should eql("The American holiday of Thanksgiving is \n celebrated on the")
|
264
|
+
question.text_post.should eql("Thursday of November.")
|
265
|
+
question.title.should eql("Thanksgiving Date")
|
266
|
+
question.answer.length.should eql(3)
|
267
|
+
question.answer[0].correct.should eql(false)
|
268
|
+
question.answer[0].text.should eql("second")
|
269
|
+
question.answer[1].correct.should eql(false)
|
270
|
+
question.answer[1].text.should eql("third")
|
271
|
+
question.answer[2].correct.should eql(true)
|
272
|
+
question.answer[2].text.should eql("fourth")
|
273
|
+
|
274
|
+
#//Feedback:
|
275
|
+
#
|
276
|
+
# What's the answer to this multiple-choice question?{
|
277
|
+
# ~wrong answer#feedback comment on the wrong answer
|
278
|
+
# ~another wrong answer#feedback comment on this wrong answer
|
279
|
+
# =right answer#Very good!}
|
280
|
+
question = @questions[19]
|
281
|
+
question.style.should eql(:multiple_choice)
|
282
|
+
question.text.should eql("What's the answer to this multiple-choice question?")
|
283
|
+
question.text_post.should eql(nil)
|
284
|
+
question.title.should eql(nil)
|
285
|
+
question.answer.length.should eql(3)
|
286
|
+
question.answer[0].correct.should eql(false)
|
287
|
+
question.answer[0].text.should eql("wrong answer")
|
288
|
+
question.answer[0].comment.should eql("feedback comment on the wrong answer")
|
289
|
+
question.answer[1].correct.should eql(false)
|
290
|
+
question.answer[1].text.should eql("another wrong answer")
|
291
|
+
question.answer[1].comment.should eql("feedback comment on this wrong answer")
|
292
|
+
question.answer[2].correct.should eql(true)
|
293
|
+
question.answer[2].text.should eql("right answer")
|
294
|
+
question.answer[2].comment.should eql("Very good!")
|
295
|
+
#
|
296
|
+
# Who's buried in Grant's tomb?{
|
297
|
+
# =no one#excellent answer!
|
298
|
+
# =nobody#excellent answer!}
|
299
|
+
question = @questions[20]
|
300
|
+
question.style.should eql(:short_answer)
|
301
|
+
question.text.should eql("Who's buried in Grant's tomb?")
|
302
|
+
question.text_post.should eql(nil)
|
303
|
+
question.title.should eql(nil)
|
304
|
+
question.answer.length.should eql(2)
|
305
|
+
question.answer[0].correct.should eql(true)
|
306
|
+
question.answer[0].text.should eql("no one")
|
307
|
+
question.answer[0].comment.should eql("excellent answer!")
|
308
|
+
question.answer[1].correct.should eql(true)
|
309
|
+
question.answer[1].text.should eql("nobody")
|
310
|
+
question.answer[1].comment.should eql("excellent answer!")
|
311
|
+
|
312
|
+
# Grant is buried in Grant's tomb.{FALSE#No one is buried in Grant's tomb.}
|
313
|
+
question = @questions[21]
|
314
|
+
question.style.should eql(:true_false)
|
315
|
+
question.text.should eql("Grant is buried in Grant's tomb.")
|
316
|
+
question.text_post.should eql(nil)
|
317
|
+
question.title.should eql(nil)
|
318
|
+
question.answer.length.should eql(1)
|
319
|
+
question.answer[0].correct.should eql(false)
|
320
|
+
question.answer[0].text.should eql(nil)
|
321
|
+
question.answer[0].comment.should eql("No one is buried in Grant's tomb.")
|
322
|
+
|
323
|
+
#//Percentage Answer Weights:
|
324
|
+
#//Percentage answer weights are available for both Multiple Choice and Short Answer questions. Percentage answer weights can be included by following the tilde (for Multiple Choice) or equal sign (for Short Answer) with the desired percent enclosed within percent signs (e.g., %50%).
|
325
|
+
#//This option can be combined with feedback comments.
|
326
|
+
#
|
327
|
+
# Difficult question.{~wrong answer ~%50%half credit answer =full credit answer}
|
328
|
+
question = @questions[22]
|
329
|
+
question.style.should eql(:multiple_choice)
|
330
|
+
question.text.should eql("Difficult question.")
|
331
|
+
question.text_post.should eql(nil)
|
332
|
+
question.title.should eql(nil)
|
333
|
+
question.answer.length.should eql(3)
|
334
|
+
question.answer[0].correct.should eql(false)
|
335
|
+
question.answer[0].text.should eql("wrong answer")
|
336
|
+
question.answer[0].weight.should eql(nil)
|
337
|
+
question.answer[1].correct.should eql(false)
|
338
|
+
question.answer[1].text.should eql("half credit answer")
|
339
|
+
question.answer[1].weight.should eql(50)
|
340
|
+
question.answer[2].correct.should eql(true)
|
341
|
+
question.answer[2].text.should eql("full credit answer")
|
342
|
+
question.answer[2].weight.should eql(nil)
|
343
|
+
|
344
|
+
# ::Jesus' hometown::Jesus Christ was from {
|
345
|
+
# ~Jerusalem#This was an important city, but the wrong answer.
|
346
|
+
# ~%25%Bethlehem#He was born here, but not raised here.
|
347
|
+
# ~%50%Galilee#You need to be more specific.
|
348
|
+
# =Nazareth#Yes! That's right!}.
|
349
|
+
question = @questions[23]
|
350
|
+
question.style.should eql(:missing_word)
|
351
|
+
question.text.should eql("Jesus Christ was from")
|
352
|
+
question.text_post.should eql(".")
|
353
|
+
question.title.should eql("Jesus' hometown")
|
354
|
+
question.answer.length.should eql(4)
|
355
|
+
question.answer[0].correct.should eql(false)
|
356
|
+
question.answer[0].text.should eql("Jerusalem")
|
357
|
+
question.answer[0].weight.should eql(nil)
|
358
|
+
question.answer[0].comment.should eql("This was an important city, but the wrong answer.")
|
359
|
+
|
360
|
+
question.answer[1].correct.should eql(false)
|
361
|
+
question.answer[1].text.should eql("Bethlehem")
|
362
|
+
question.answer[1].weight.should eql(25)
|
363
|
+
question.answer[1].comment.should eql("He was born here, but not raised here.")
|
364
|
+
|
365
|
+
question.answer[2].correct.should eql(false)
|
366
|
+
question.answer[2].text.should eql("Galilee")
|
367
|
+
question.answer[2].weight.should eql(50)
|
368
|
+
question.answer[2].comment.should eql("You need to be more specific.")
|
369
|
+
|
370
|
+
question.answer[3].correct.should eql(true)
|
371
|
+
question.answer[3].text.should eql("Nazareth")
|
372
|
+
question.answer[3].weight.should eql(nil)
|
373
|
+
question.answer[3].comment.should eql("Yes! That's right!")
|
374
|
+
|
375
|
+
# ::Jesus' hometown:: Jesus Christ was from {
|
376
|
+
# =Nazareth#Yes! That's right!
|
377
|
+
# =%75%Nazereth#Right, but misspelled.
|
378
|
+
# =%25%Bethlehem#He was born here, but not raised here.}
|
379
|
+
question = @questions[24]
|
380
|
+
question.style.should eql(:short_answer)
|
381
|
+
question.text.should eql("Jesus Christ was from")
|
382
|
+
question.text_post.should eql(nil)
|
383
|
+
question.title.should eql("Jesus' hometown")
|
384
|
+
question.answer.length.should eql(3)
|
385
|
+
question.answer[0].correct.should eql(true)
|
386
|
+
question.answer[0].text.should eql("Nazareth")
|
387
|
+
question.answer[0].weight.should eql(nil)
|
388
|
+
question.answer[0].comment.should eql("Yes! That's right!")
|
389
|
+
|
390
|
+
question.answer[1].correct.should eql(true)
|
391
|
+
question.answer[1].text.should eql("Nazereth")
|
392
|
+
question.answer[1].weight.should eql(75)
|
393
|
+
question.answer[1].comment.should eql("Right, but misspelled.")
|
394
|
+
|
395
|
+
question.answer[2].correct.should eql(true)
|
396
|
+
question.answer[2].text.should eql("Bethlehem")
|
397
|
+
question.answer[2].weight.should eql(25)
|
398
|
+
question.answer[2].comment.should eql("He was born here, but not raised here.")
|
399
|
+
|
400
|
+
#//Specify text-formatting for the question
|
401
|
+
#//The question text (only) may have an optional text format specified.
|
402
|
+
#//Currently the available formats are moodle (Moodle Auto-Format), html (HTML format), plain (Plain text format) and markdown (Markdown format).
|
403
|
+
#//The format is specified in square brackets immediately before the question text. More information on text formats in Moodle.
|
404
|
+
#
|
405
|
+
#[markdown]The *American holiday of Thanksgiving* is celebrated on the {
|
406
|
+
# ~second
|
407
|
+
# ~third
|
408
|
+
# =fourth
|
409
|
+
# } Thursday of November.
|
410
|
+
question = @questions[25]
|
411
|
+
question.format = "markdown"
|
412
|
+
question.style.should eql(:missing_word)
|
413
|
+
question.text.should eql("The *American holiday of Thanksgiving* is celebrated on the")
|
414
|
+
question.text_post.should eql("Thursday of November.")
|
415
|
+
question.title.should eql(nil)
|
416
|
+
question.answer.length.should eql(3)
|
417
|
+
question.answer[0].correct.should eql(false)
|
418
|
+
question.answer[0].text.should eql("second")
|
419
|
+
question.answer[1].correct.should eql(false)
|
420
|
+
question.answer[1].text.should eql("third")
|
421
|
+
question.answer[2].correct.should eql(true)
|
422
|
+
question.answer[2].text.should eql("fourth")
|
423
|
+
|
424
|
+
#//Multiple Answers:
|
425
|
+
#//The Multiple Answers option is used for multiple choice questions when
|
426
|
+
#//two or more answers must be selected in order to obtain full credit.
|
427
|
+
#//The multiple answers option is enabled by assigning partial answer weight to
|
428
|
+
#//multiple answers, while allowing no single answer to receive full credit.
|
429
|
+
#
|
430
|
+
# What two people are entombed in Grant's tomb? {
|
431
|
+
# ~No one
|
432
|
+
# ~%50%Grant
|
433
|
+
# ~%50%Grant's wife
|
434
|
+
# ~Grant's father }
|
435
|
+
#//Note that there is no equal sign (=) in any answer and the answers should total no more than 100%, otherwise Moodle will return an error. To avoid the problem of students automatically getting 100% by simply checking all of the answers, it is best to include negative answer weights for wrong answers.
|
436
|
+
question = @questions[26]
|
437
|
+
question.style.should eql(:multiple_choice)
|
438
|
+
question.text.should eql("What two people are entombed in Grant's tomb?")
|
439
|
+
question.text_post.should eql(nil)
|
440
|
+
question.title.should eql(nil)
|
441
|
+
question.answer.length.should eql(4)
|
442
|
+
question.answer[0].correct.should eql(false)
|
443
|
+
question.answer[0].text.should eql("No one")
|
444
|
+
question.answer[0].weight.should eql(nil)
|
445
|
+
question.answer[1].correct.should eql(false)
|
446
|
+
question.answer[1].text.should eql("Grant")
|
447
|
+
question.answer[1].weight.should eql(50)
|
448
|
+
question.answer[2].correct.should eql(false)
|
449
|
+
question.answer[2].text.should eql("Grant's wife")
|
450
|
+
question.answer[2].weight.should eql(50)
|
451
|
+
question.answer[3].correct.should eql(false)
|
452
|
+
question.answer[3].text.should eql("Grant's father")
|
453
|
+
question.answer[3].weight.should eql(nil)
|
454
|
+
|
455
|
+
|
456
|
+
# What two people are entombed in Grant's tomb? {
|
457
|
+
# ~%-50%No one
|
458
|
+
# ~%50%Grant
|
459
|
+
# ~%50%Grant's wife
|
460
|
+
# ~%-50%Grant's father }
|
461
|
+
|
462
|
+
question = @questions[27]
|
463
|
+
question.style.should eql(:multiple_choice)
|
464
|
+
question.text.should eql("What two people are entombed in Grant's tomb?")
|
465
|
+
question.text_post.should eql(nil)
|
466
|
+
question.title.should eql(nil)
|
467
|
+
question.answer.length.should eql(4)
|
468
|
+
question.answer[0].correct.should eql(false)
|
469
|
+
question.answer[0].text.should eql("No one")
|
470
|
+
question.answer[0].weight.should eql(-50)
|
471
|
+
question.answer[1].correct.should eql(false)
|
472
|
+
question.answer[1].text.should eql("Grant")
|
473
|
+
question.answer[1].weight.should eql(50)
|
474
|
+
question.answer[2].correct.should eql(false)
|
475
|
+
question.answer[2].text.should eql("Grant's wife")
|
476
|
+
question.answer[2].weight.should eql(50)
|
477
|
+
question.answer[3].correct.should eql(false)
|
478
|
+
question.answer[3].text.should eql("Grant's father")
|
479
|
+
question.answer[3].weight.should eql(-50)
|
480
|
+
#//Special Characters ~ = # { } :
|
481
|
+
#//These symbols ~ = # { } control the operation of this filter
|
482
|
+
#//and cannot be used as normal text within questions.
|
483
|
+
#//Since these symbols have a special role in determining the
|
484
|
+
#//operation of this filter, they are called "control characters."
|
485
|
+
#//But sometimes you may want to use one of these characters,
|
486
|
+
#//for example to show a mathematical formula in a question.
|
487
|
+
#//The way to get around this problem is "escaping" the control characters.
|
488
|
+
#//This means simply putting a backslash (\) before a control character
|
489
|
+
#//so the filter will know that you want to use it as a literal character
|
490
|
+
#//instead of as a control character. For example:
|
491
|
+
#
|
492
|
+
# Which answer equals 5? {
|
493
|
+
# ~ \= 2 + 2
|
494
|
+
# = \= 2 + 3
|
495
|
+
# ~ \= 2 + 4 }
|
496
|
+
question = @questions[28]
|
497
|
+
question.style.should eql(:multiple_choice)
|
498
|
+
question.text.should eql("Which answer equals 5?")
|
499
|
+
question.text_post.should eql(nil)
|
500
|
+
question.title.should eql(nil)
|
501
|
+
question.answer.length.should eql(3)
|
502
|
+
question.answer[0].correct.should eql(false)
|
503
|
+
question.answer[0].text.should eql("= 2 + 2")
|
504
|
+
question.answer[1].correct.should eql(true)
|
505
|
+
question.answer[1].text.should eql("= 2 + 3")
|
506
|
+
question.answer[2].correct.should eql(false)
|
507
|
+
question.answer[2].text.should eql("= 2 + 4")
|
508
|
+
#
|
509
|
+
# ::GIFT Control Characters::
|
510
|
+
# Which of the following is NOT a control character for the GIFT import format? {
|
511
|
+
# ~ \~ # \~ is a control character.
|
512
|
+
# ~ \= # \= is a control character.
|
513
|
+
# ~ \# # \# is a control character.
|
514
|
+
# ~ \{ # \{ is a control character.
|
515
|
+
# ~ \} # \} is a control character.
|
516
|
+
# = \ # Correct! \ (backslash) is not a control character. BUT,
|
517
|
+
# it is used to escape the control characters.
|
518
|
+
# }
|
519
|
+
question = @questions[29]
|
520
|
+
question.style.should eql(:multiple_choice)
|
521
|
+
question.text.should eql("Which of the following is NOT a control character for the GIFT import format?")
|
522
|
+
question.text_post.should eql(nil)
|
523
|
+
question.title.should eql("GIFT Control Characters")
|
524
|
+
question.answer.length.should eql(6)
|
525
|
+
question.answer[0].correct.should eql(false)
|
526
|
+
question.answer[0].text.should eql("~")
|
527
|
+
question.answer[0].comment.should eql("~ is a control character.")
|
528
|
+
question.answer[1].correct.should eql(false)
|
529
|
+
question.answer[1].text.should eql("=")
|
530
|
+
question.answer[1].comment.should eql("= is a control character.")
|
531
|
+
question.answer[2].correct.should eql(false)
|
532
|
+
question.answer[2].text.should eql("#")
|
533
|
+
question.answer[2].comment.should eql("# is a control character.")
|
534
|
+
question.answer[3].correct.should eql(false)
|
535
|
+
question.answer[3].text.should eql("{")
|
536
|
+
question.answer[3].comment.should eql("{ is a control character.")
|
537
|
+
question.answer[4].correct.should eql(false)
|
538
|
+
question.answer[4].text.should eql("}")
|
539
|
+
question.answer[4].comment.should eql("} is a control character.")
|
540
|
+
question.answer[5].correct.should eql(true)
|
541
|
+
question.answer[5].text.should eql("\\")
|
542
|
+
question.answer[5].comment.should eql("Correct! \\ (backslash) is not a control character. BUT,
|
543
|
+
it is used to escape the control characters.")
|
544
|
+
|
545
|
+
end
|
546
|
+
|