term_note 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/lib/testing.rb +527 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 18cc749d193c1eaff54a5d90659cd44a3c1efd5e198ea798bdd7571ae9b29376
|
4
|
+
data.tar.gz: 3feeb08908a4c0c6a7f73a4fc840b7b8a36f791dd4b4fbb25bcc7f906192fdc8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 46a47c4114dddef08df354c0185672a6a99ed6be87fcfcf0223f2525a42c76bd9176a19f4af476a9dbf9902dcbaf756a405342e29d3a2547d449ec13e13a7579
|
7
|
+
data.tar.gz: a6824ebd926c9186e6dfc20a3c61899b09f065a8e6fb0e97cc9335de7eaecddf5dac06e5380f984fecdd1d3d9f148697511a1b87a8a97c47cae09cbe6414fdaa
|
data/lib/testing.rb
ADDED
@@ -0,0 +1,527 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'method_source'
|
3
|
+
require 'colorize'
|
4
|
+
|
5
|
+
class MyList
|
6
|
+
|
7
|
+
def initialize(a = [])
|
8
|
+
@list = a
|
9
|
+
end
|
10
|
+
|
11
|
+
def contents
|
12
|
+
@list
|
13
|
+
end
|
14
|
+
|
15
|
+
def append(a)
|
16
|
+
@list.append(a)
|
17
|
+
end
|
18
|
+
|
19
|
+
def find_first_position_of(a)
|
20
|
+
i = 0
|
21
|
+
position = nil
|
22
|
+
while i < @list.length
|
23
|
+
if @list[i] == a
|
24
|
+
position = i
|
25
|
+
break
|
26
|
+
end
|
27
|
+
i += 1
|
28
|
+
end
|
29
|
+
return position
|
30
|
+
end
|
31
|
+
|
32
|
+
def find_positions_of(a)
|
33
|
+
positions = []
|
34
|
+
i = 0
|
35
|
+
while i < @list.length
|
36
|
+
if @list[i] == a
|
37
|
+
positions.append i
|
38
|
+
end
|
39
|
+
i += 1
|
40
|
+
end
|
41
|
+
return positions
|
42
|
+
end
|
43
|
+
|
44
|
+
def maximum
|
45
|
+
i = 0
|
46
|
+
max = @list[0]
|
47
|
+
while i < @list.length
|
48
|
+
if @list[i] > max
|
49
|
+
max = @list[i]
|
50
|
+
end
|
51
|
+
i += 1
|
52
|
+
end
|
53
|
+
return max
|
54
|
+
end
|
55
|
+
|
56
|
+
def minimum_wrong
|
57
|
+
i = 0
|
58
|
+
min = @list[0]
|
59
|
+
while i < @list.length
|
60
|
+
if @list[i] > min
|
61
|
+
min = @list[i]
|
62
|
+
end
|
63
|
+
i += 1
|
64
|
+
end
|
65
|
+
return min
|
66
|
+
end
|
67
|
+
|
68
|
+
def minimum_correct
|
69
|
+
i = 0
|
70
|
+
min = @list[0]
|
71
|
+
while i < @list.length
|
72
|
+
if @list[i] < min
|
73
|
+
min = @list[i]
|
74
|
+
end
|
75
|
+
i += 1
|
76
|
+
end
|
77
|
+
return min
|
78
|
+
end
|
79
|
+
|
80
|
+
def min_max_slow
|
81
|
+
[minimum, maximum]
|
82
|
+
end
|
83
|
+
|
84
|
+
def min_max_fast
|
85
|
+
i = 0
|
86
|
+
min = @list[0]
|
87
|
+
max = @list[0]
|
88
|
+
while i < @list.length
|
89
|
+
min = @list[i] if @list[i] < min
|
90
|
+
max = @list[i] if @list[i] > max
|
91
|
+
i += 1
|
92
|
+
end
|
93
|
+
[min, max]
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.set_slow
|
97
|
+
alias_method :min_max, :min_max_slow
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.set_fast
|
101
|
+
alias_method :min_max, :min_max_fast
|
102
|
+
end
|
103
|
+
|
104
|
+
def self.set_wrong
|
105
|
+
alias_method :minimum, :minimum_wrong
|
106
|
+
end
|
107
|
+
|
108
|
+
def self.set_correct
|
109
|
+
alias_method :minimum, :minimum_correct
|
110
|
+
end
|
111
|
+
|
112
|
+
self.set_fast
|
113
|
+
self.set_correct
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
if ARGV[0] =~ /RUN_TESTS/
|
118
|
+
class MyListClassTests < Test::Unit::TestCase; end
|
119
|
+
else
|
120
|
+
class MyListClassTests; end
|
121
|
+
end
|
122
|
+
|
123
|
+
MyList.set_slow if ARGV[0] =~ /SLOW/
|
124
|
+
MyList.set_wrong if ARGV[0] =~ /WRONG/
|
125
|
+
|
126
|
+
class MyListClassTests
|
127
|
+
def self.in_sequence(sequence)
|
128
|
+
ARGV[0] =~ /#{sequence}/ || ARGV[0].nil? || ARGV[0] =~ /RECORD/
|
129
|
+
end
|
130
|
+
|
131
|
+
if in_sequence('T1')
|
132
|
+
def test_new
|
133
|
+
assert_kind_of MyList, MyList.new([1, 2, 3])
|
134
|
+
end
|
135
|
+
end
|
136
|
+
if in_sequence('T2')
|
137
|
+
def test_contents
|
138
|
+
assert_equal [1, 2, 3], MyList.new([1, 2, 3]).contents
|
139
|
+
end
|
140
|
+
end
|
141
|
+
if in_sequence('T3')
|
142
|
+
def test_append
|
143
|
+
my_list = MyList.new([1, 2, 3])
|
144
|
+
my_list.append(4)
|
145
|
+
assert_equal [1, 2, 3, 4], my_list.contents
|
146
|
+
assert_includes my_list.contents, 4
|
147
|
+
end
|
148
|
+
end
|
149
|
+
if in_sequence('T4')
|
150
|
+
def test_find_first_position_of
|
151
|
+
my_list = MyList.new([1, 2, 3, 2, 5])
|
152
|
+
assert_equal 1, my_list.find_first_position_of(2)
|
153
|
+
assert_equal 0, my_list.find_first_position_of(1)
|
154
|
+
assert_equal 4, my_list.find_first_position_of(5)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
if in_sequence('T5')
|
159
|
+
def test_find_positions_of
|
160
|
+
my_list = MyList.new([1, 2, 3, 2, 5])
|
161
|
+
assert_equal [1, 3], my_list.find_positions_of(2)
|
162
|
+
assert_equal [0], my_list.find_positions_of(1)
|
163
|
+
assert_equal [4], my_list.find_positions_of(5)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
if in_sequence('T6')
|
167
|
+
def test_maximum
|
168
|
+
my_list = MyList.new([1, 2, 3, 2, 5, 16, 7, 12])
|
169
|
+
assert_equal 16, my_list.maximum
|
170
|
+
my_list = MyList.new([12, 2, 33, 2, 5, 16, 7, 12])
|
171
|
+
assert_equal 33, my_list.maximum
|
172
|
+
end
|
173
|
+
end
|
174
|
+
if in_sequence('T7')
|
175
|
+
def test_minimum
|
176
|
+
my_list = MyList.new([1, 2, 3, 2, 5, 16, 7, 12])
|
177
|
+
assert_equal 1, my_list.minimum
|
178
|
+
my_list = MyList.new([12, 1, 2, 3, 2, 25, 16, 7])
|
179
|
+
assert_equal 1, my_list.minimum
|
180
|
+
end
|
181
|
+
end
|
182
|
+
if in_sequence('T8')
|
183
|
+
def test_min_max
|
184
|
+
my_list = MyList.new([1, 2, 3, 2, 5, 16, 7, 12])
|
185
|
+
assert_equal [1, 16], my_list.min_max
|
186
|
+
my_list = MyList.new([12, 2, 33, 2, 5, 16, 7, 12])
|
187
|
+
assert_equal [2, 33], my_list.min_max
|
188
|
+
my_list = MyList.new([12, 1, 2, 3, 2, 25, 16, 7])
|
189
|
+
assert_equal [1, 25], my_list.min_max
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
if ARGV[0] !~ /RUN_TESTS/
|
195
|
+
class Term
|
196
|
+
class << self
|
197
|
+
attr_reader :height, :width
|
198
|
+
end
|
199
|
+
|
200
|
+
def self.get_terminal_size
|
201
|
+
@height, @width = [Integer(`tput li`), Integer(`tput co`)]
|
202
|
+
end
|
203
|
+
|
204
|
+
get_terminal_size
|
205
|
+
Signal.trap("WINCH") do
|
206
|
+
get_terminal_size
|
207
|
+
puts "New Size: #{@height} X #{@width}"
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
class Presentation
|
212
|
+
attr_reader :current
|
213
|
+
|
214
|
+
def initialize(first_slide = 1)
|
215
|
+
self.current = @current = first_slide
|
216
|
+
end
|
217
|
+
|
218
|
+
def current=(position)
|
219
|
+
if position < 1
|
220
|
+
@current = 1
|
221
|
+
elsif position > size
|
222
|
+
@current = size
|
223
|
+
else
|
224
|
+
@current = position
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
def play
|
229
|
+
while current <= size
|
230
|
+
display_slide
|
231
|
+
key = STDIN.gets.chomp
|
232
|
+
case key
|
233
|
+
when 'b'
|
234
|
+
self.current -= 1
|
235
|
+
when /[0-9][0-9]*/
|
236
|
+
self.current = key.to_i
|
237
|
+
when 'q'
|
238
|
+
exit
|
239
|
+
when 'h', '?'
|
240
|
+
print_help
|
241
|
+
else
|
242
|
+
self.current += 1
|
243
|
+
end
|
244
|
+
system('clear')
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
def record # requires MacOS + ImageMagick
|
249
|
+
(1..size).each do |index|
|
250
|
+
self.current = index
|
251
|
+
display_slide
|
252
|
+
sleep 1
|
253
|
+
`screencapture slide_#{"%04d" % (index)}.png`
|
254
|
+
end
|
255
|
+
`convert slide_*.png presentation.pdf`
|
256
|
+
end
|
257
|
+
|
258
|
+
def print_help
|
259
|
+
system('clear')
|
260
|
+
puts "Press... to:"
|
261
|
+
puts "h,? print this help"
|
262
|
+
puts "q quit"
|
263
|
+
puts "<number> go to slide <number>"
|
264
|
+
puts "<enter> go to next slide"
|
265
|
+
puts "b go to previous slide"
|
266
|
+
puts "Run... to:"
|
267
|
+
puts "ruby #{$0} RECORD, to generate pdf of presentation"
|
268
|
+
STDIN.gets.chomp
|
269
|
+
end
|
270
|
+
|
271
|
+
def slides
|
272
|
+
@slides ||= self.class.public_instance_methods(true).
|
273
|
+
grep(/\Aslide_/).
|
274
|
+
map(&:to_s).
|
275
|
+
sort_by { |s| s.split('_').last.to_i }.
|
276
|
+
map(&:to_sym)
|
277
|
+
end
|
278
|
+
|
279
|
+
def size
|
280
|
+
slides.size
|
281
|
+
end
|
282
|
+
|
283
|
+
def display_slide
|
284
|
+
center(self.send(@slides[@current - 1]))
|
285
|
+
end
|
286
|
+
|
287
|
+
def split_screen
|
288
|
+
["", "", "", "#underline", "", "", ""]
|
289
|
+
end
|
290
|
+
|
291
|
+
def center(slide)
|
292
|
+
lines = slide.size
|
293
|
+
blank = Term.height - lines
|
294
|
+
half, rest = blank.divmod(2)
|
295
|
+
|
296
|
+
puts "\n" * half
|
297
|
+
|
298
|
+
slide.each do |l|
|
299
|
+
content, format = l.split('#')
|
300
|
+
content ||= l
|
301
|
+
format = (format || '').split('.')
|
302
|
+
display = format.include?('CODE') ? content.ljust(Term.width - 10) : content.center(Term.width)
|
303
|
+
result = (format - ['CODE']).inject(display) do |res, f|
|
304
|
+
res.send(f.to_sym)
|
305
|
+
end
|
306
|
+
puts result
|
307
|
+
end
|
308
|
+
puts "\n" * (half + rest - 1)
|
309
|
+
rescue ArgumentError => e
|
310
|
+
"Παρακαλώ μεγαλώστε το παράθυρο για εμφανιστεί η σελίδα..."
|
311
|
+
puts "Error: #{e.message}"
|
312
|
+
puts e.backtrace
|
313
|
+
puts ["lines:", lines, "height:", Term.height, "width:", Term.width, "blank:", blank, "half:", half, "rest:", rest].join(" ")
|
314
|
+
@current -= 1
|
315
|
+
ensure
|
316
|
+
|
317
|
+
pager = "Slide: %d / %d >" % [current, size]
|
318
|
+
prompt = "b: back one,<number>: goto slide, <enter>: next, h,?: help, q: quit"
|
319
|
+
printf prompt + pager.rjust(Term.width - prompt.size - 3)
|
320
|
+
|
321
|
+
end
|
322
|
+
|
323
|
+
def run_tests(sequence)
|
324
|
+
['Run Tests'] +
|
325
|
+
if ARGV[0] !~ /RUN_TESTS/
|
326
|
+
`ruby testing.rb #{['RUN_TESTS', sequence].join('_')}`
|
327
|
+
end.split("\n").map { |c| c + '#CODE' }
|
328
|
+
end
|
329
|
+
|
330
|
+
def method_source(class_name,method,hide = //)
|
331
|
+
["class #{class_name.to_s}", ""] +
|
332
|
+
class_name.
|
333
|
+
instance_method(method).
|
334
|
+
source.
|
335
|
+
gsub(hide,'').
|
336
|
+
split("\n").
|
337
|
+
map { |c| c + '#CODE' }
|
338
|
+
end
|
339
|
+
def self.define_slide_sequence(class_name, method, test_class_name, test_method, test_sequence, variant = nil)
|
340
|
+
if class_name
|
341
|
+
define_slide(variant: variant, class_name: class_name) do
|
342
|
+
method_source(class_name,method,/_slow|_fast|_wrong|_correct/)
|
343
|
+
end
|
344
|
+
define_slide { run_tests(test_sequence.split('_')[0..-2].join('_')) }
|
345
|
+
end
|
346
|
+
if test_class_name
|
347
|
+
define_slide(include: class_name ? -2 : 0){method_source(test_class_name,test_method) }
|
348
|
+
define_slide { run_tests(test_sequence) }
|
349
|
+
end
|
350
|
+
end
|
351
|
+
|
352
|
+
def self.define_slide(include: 0, variant: nil, class_name: nil, &contents)
|
353
|
+
@@slide_counter += 1
|
354
|
+
slide = proc { |number| self.send("slide_#{number}".to_sym) }
|
355
|
+
define_method "slide_#{@@slide_counter}".to_sym do
|
356
|
+
instance_eval("#{class_name}.send(:#{variant.to_s})") if variant
|
357
|
+
current_number = __method__.to_s.split('_').last.to_i
|
358
|
+
(include != 0 ? instance_exec(current_number + include, &slide) : []) +
|
359
|
+
instance_exec(&contents)
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
@@slide_counter = 0
|
364
|
+
|
365
|
+
define_slide { [
|
366
|
+
"Unit Testing", "",
|
367
|
+
"Πως μπορούμε να εξασφαλίσουμε την ορθότητα των προγραμμάτων;"
|
368
|
+
] }
|
369
|
+
|
370
|
+
define_slide { ["Παντελέλης Μιχάλης#light_magenta",
|
371
|
+
"email: mpantel@aegean.gr#magenta", "",
|
372
|
+
"Ηλεκτρολόγος Μηχανικός & Μηχανικός Η/Υ#magenta", "",
|
373
|
+
"Ειδικός Λογαριασμός Ερευνας Π.Αιγαίου",
|
374
|
+
"Προϊστάμενος Τμήματος Διαχείρισης Πληροφοριακών Συστημάτων"]
|
375
|
+
}
|
376
|
+
|
377
|
+
define_slide{["Μπορούμε να αποδείξουμε ότι ένα πρόγραμμα είναι ορθό;"]}
|
378
|
+
define_slide(include:-1){["", "", "Για οποιαδήποτε είσοδο;"]}
|
379
|
+
define_slide(include:-1){["", "", "Αυτοματοποιημένα;"]}
|
380
|
+
define_slide{["Με το ερώτημα αυτό ασχολήθηκαν από τις αρχές του περασμένου αιώνα..."]}
|
381
|
+
|
382
|
+
#David Hilbert (https://en.wikipedia.org/wiki/David_Hilbert)
|
383
|
+
#His attempt to support axiomatized mathematics with definitive principles, which could banish theoretical uncertainties, ended in failure.
|
384
|
+
# (Entscheidungsproblem, 1928
|
385
|
+
define_slide(include:-1){["", "", "Ο David Hilbert (https://en.wikipedia.org/wiki/David_Hilbert):", "",
|
386
|
+
"Σχεδίαζε να ορίσει αξιώματα με τα οποία να μπορούμε να αποδείξουμε",
|
387
|
+
"υποθέσεις σε διάφορα μαθηματικά συστήματα (1900)", "",
|
388
|
+
"Στόχος: Η πληρότητα και η συνέπεια..."]}
|
389
|
+
|
390
|
+
#Kurt Gödel (https://en.wikipedia.org/wiki/Kurt_G%C3%B6del)
|
391
|
+
# Gödel demonstrated that any non-contradictory formal system, which was comprehensive enough to include at least arithmetic,
|
392
|
+
# cannot demonstrate its completeness by way of its own axioms. In 1931 his incompleteness theorem showed that Hilbert's
|
393
|
+
# grand plan was impossible as stated. The second point cannot in any reasonable way be combined with the first point,
|
394
|
+
# as long as the axiom system is genuinely finitary.
|
395
|
+
#Nevertheless, the subsequent achievements of proof theory at the very least clarified consistency
|
396
|
+
# as it relates to theories of central concern to mathematicians.
|
397
|
+
# Hilbert's work had started logic on this course of clarification; the need to understand Gödel's work then
|
398
|
+
# led to the development of recursion theory and then mathematical logic as an autonomous discipline in the 1930s.
|
399
|
+
# The basis for later theoretical computer science, in the work of Alonzo Church and Alan Turing, also grew directly out of this 'debate'.
|
400
|
+
|
401
|
+
define_slide(include:-2){["", "", "Ο Kurt Gödel (https://en.wikipedia.org/wiki/Kurt_G%C3%B6del):", "",
|
402
|
+
"Απέδειξε το θεώρημα της ΜΗ πληρώτητας (1931)#bold", "",
|
403
|
+
"Οπότε τα σχέδια του Hilbert ναυάγησαν :-("]}
|
404
|
+
|
405
|
+
|
406
|
+
#Alan Turing (https://en.wikipedia.org/wiki/Alan_Turing)
|
407
|
+
#Turing's proof (https://en.wikipedia.org/wiki/Turing%27s_proof)
|
408
|
+
#https://en.wikipedia.org/wiki/Halting_problem
|
409
|
+
#In computability theory, the halting problem is the problem of determining, from a description of an arbitrary
|
410
|
+
# computer program and an input, whether the program will finish running, or continue to run forever.
|
411
|
+
# Alan Turing proved in 1936 that a general algorithm to solve the halting problem for all possible program-input
|
412
|
+
# pairs cannot exist. For any program f that might determine if programs halt, a "pathological" program g called
|
413
|
+
# with an input can pass its own source and its input to f and then specifically do the opposite of
|
414
|
+
# what f predicts g will do. No f can exist that handles this case. A key part of the proof was a mathematical
|
415
|
+
# definition of a computer and program, which became known as a Turing machine; the halting problem is undecidable
|
416
|
+
# over Turing machines. Turing's proof is one of the first cases of decision problems to be concluded.
|
417
|
+
# The theoretical conclusion that it is not solvable is significant to practical computing efforts, defining
|
418
|
+
# a class of applications which no programming invention can possibly perform perfectly.
|
419
|
+
|
420
|
+
define_slide(include:-3){["", "", "O Alan Turing (https://en.wikipedia.org/wiki/Alan_Turing):", "", "",
|
421
|
+
"Απέδειξε ότι ΔΕΝ υπάρχει αλγόριθμος που να αποφασίζει πάντα και σωστά", "",
|
422
|
+
"για ένα οποιοδήποτε πρόγραμμα και την είσοδό του", "",
|
423
|
+
"αν το πρόγραμμα θα σταματήσει όταν το εκτελέσουμε με την είσοδο αυτή"
|
424
|
+
]}
|
425
|
+
|
426
|
+
define_slide {
|
427
|
+
["while (true) continue",
|
428
|
+
*split_screen,
|
429
|
+
"print \"Hello, world!\""
|
430
|
+
] }
|
431
|
+
|
432
|
+
define_slide{["Πώς ελέγχουμε τα προγράμματα που φτιάχουμε π.χ. για το εργαστήριο;", "",
|
433
|
+
"Με το χέρι...", "",
|
434
|
+
"Εποπτικά...", "",
|
435
|
+
"Εμπειρικά..."]}
|
436
|
+
|
437
|
+
define_slide{["Πώς ελέγχουμε μεγάλα συστήματα λογισμικού;", "",
|
438
|
+
"Regression Suites", "",
|
439
|
+
"End User Testing", "",
|
440
|
+
"Automated Testing", ""
|
441
|
+
]}
|
442
|
+
|
443
|
+
define_slide{["Program Development by Stepwise Refinement", "",
|
444
|
+
"Niklaus Wirth", "",
|
445
|
+
"Communications of the ACM, Vol. 14, No. 4, April 1971", "",
|
446
|
+
"http://sunnyday.mit.edu/16.355/wirth-refinement.html#italic"
|
447
|
+
]}
|
448
|
+
|
449
|
+
define_slide{["Test-Driven Development",
|
450
|
+
"(Martin Fowler: https://martinfowler.com/bliki/TestDrivenDevelopment.html)", "",
|
451
|
+
"Είναι τεχνική για τη κατασκευή λογισμικού",
|
452
|
+
"που οδηγείται από της συγγραφή tests", "",
|
453
|
+
"Αναπτύχθηκε από τον Kent Beck στα τέλη της δεκαετίας του 1990",
|
454
|
+
"ως τμήμα της μεθοδολογίας Extreme Programming.", "",
|
455
|
+
]}
|
456
|
+
define_slide {["Test-Driven Development", "", "",
|
457
|
+
"Πρακτικά αποτελείται από τρία επαναλαμβανόμενα βήματα:", "",]}
|
458
|
+
|
459
|
+
define_slide(include:-1) {[
|
460
|
+
"1. Γράφουμε πρώτα τα test για τη λειτουργικότητα",
|
461
|
+
"που θα προσθέσουμε στην εφαρμογή.", "",
|
462
|
+
]}
|
463
|
+
|
464
|
+
define_slide(include:-1) do
|
465
|
+
["2. Γράφουμε τον κώδικα της εφαρμογής μέχρι να ικανοποιήσουμε",
|
466
|
+
"τiς απαιτήσεις του test.", ""]
|
467
|
+
end
|
468
|
+
|
469
|
+
define_slide(include:-1){["3. Αναδιατάσουμε το κώδικα (Refactor) μέχρι να έρθει","στην δομική μορφή που επιθυμούμε."]}
|
470
|
+
|
471
|
+
define_slide { ["RED - GREEN - REFACTOR", "", ""] }
|
472
|
+
define_slide(include:-1) { ["RED: Γράφουμε tests (που αρχικά δεν ικανοποιούνται)", "", ""] }
|
473
|
+
define_slide(include:-1) { ["GREEN: Γράφουμε κώδικα που ικανοποιεί τα tests", "", ""] }
|
474
|
+
define_slide(include:-1) { ["REFACTOR: Βελτιώνουμε τη ποιότητα του κώδικα", "", ""] }
|
475
|
+
|
476
|
+
define_slide { (["Refactoring (Martin Fowler, https://refactoring.com/)", "", "",
|
477
|
+
"Ουσιαστικό (refactoring): αλλαγή στην εσωτερική δομή του λογισμικού ώστε:",
|
478
|
+
"να γίνει εύκολότερη η κατανόησή του",
|
479
|
+
"και οικονομικότερη η εξέλιξή του,",
|
480
|
+
"ΧΩΡΙΣ να αλλάξει η εξωτερική του συμπεριφορά.",
|
481
|
+
"", "",]) }
|
482
|
+
|
483
|
+
define_slide(include:-1) { ["Ρήμα (refactor): η διαδικασία της αναδιάταξης του κώδικα μέσω",
|
484
|
+
"μίας σαφούς αλληλουχίας βημάτων με τρόπο τέτοιο ώστε ",
|
485
|
+
"να μήν αλλάξει η εξωτερική του συμπεριφορά."] }
|
486
|
+
|
487
|
+
define_slide { (["Testing Frameworks", "", "",
|
488
|
+
"Διαθέσιμα πλέον στις περισσότερες γλώσσες προγραμματισμού", "",
|
489
|
+
"Διαφορετικές Φιλοσοφίες (TDD - testing, BDD - Behaviour)", "",
|
490
|
+
"Διαφορετικά επίπεδα testing (unit, integration, front end...)", "",
|
491
|
+
"Διαφορετική αποδοχή από της κοινότητες προγραμματιστών", "",
|
492
|
+
]) }
|
493
|
+
|
494
|
+
define_slide { [
|
495
|
+
"TDD: Assertions - Διαβεβαιώσεις", "", "",
|
496
|
+
"assert_equal 2, @size#CODE", "",
|
497
|
+
"assert_includes @list, \"item\"#CODE", "",
|
498
|
+
"assert_instance_of Array, @list#CODE", "",
|
499
|
+
"assert_kind_of Array, @list#CODE", "",
|
500
|
+
"assert_nil#CODE"
|
501
|
+
] }
|
502
|
+
|
503
|
+
define_slide { ["Παραδείγματα"] }
|
504
|
+
define_slide_sequence(MyList, :initialize, MyListClassTests, :test_new, 'T1')
|
505
|
+
define_slide_sequence(MyList, :contents, MyListClassTests, :test_contents, 'T1_T2')
|
506
|
+
define_slide_sequence(MyList, :append, MyListClassTests, :test_append, 'T1_T2_T3')
|
507
|
+
define_slide_sequence(MyList, :find_first_position_of, MyListClassTests, :test_find_first_position_of, 'T1_T2_T3_T4')
|
508
|
+
define_slide_sequence(MyList, :find_positions_of, MyListClassTests, :test_find_positions_of, 'T1_T2_T3_T4_T5')
|
509
|
+
define_slide_sequence(MyList, :maximum, MyListClassTests, :test_maximum, 'T1_T2_T3_T4_T5_T6')
|
510
|
+
define_slide_sequence(MyList, :minimum, MyListClassTests, :test_minimum, 'WRONG_T1_T2_T3_T4_T5_T6_T7', :set_wrong)
|
511
|
+
define_slide_sequence(MyList, :minimum, nil, nil, 'T1_T2_T3_T4_T5_T6_T7_CORRECT', :set_correct)
|
512
|
+
define_slide_sequence(MyList, :min_max, MyListClassTests, :test_min_max, 'SLOW_T1_T2_T3_T4_T5_T6_T7_T8', :set_slow)
|
513
|
+
define_slide_sequence(MyList, :min_max, nil, nil, 'T1_T2_T3_T4_T5_T6_T7_T8_FAST', :set_fast)
|
514
|
+
|
515
|
+
define_slide { ["Συμπεράσματα - Unit Testing", "", "",] }
|
516
|
+
define_slide(include:-1) { ["1. Είναι σημαντικό να ελέγχουμε τα προγράμματα που γράφουμε", "",] }
|
517
|
+
define_slide(include:-1) { ["2. Μπορούμε να επικεντρωθούμε στις συνοριακές περιπτώσεις", "",] }
|
518
|
+
define_slide(include:-1) { ["3. Είναι σημαντικό ο έλεγχος να γίνεται αυτοματοποιημένα", "",] }
|
519
|
+
define_slide(include:-1) { ["4. Μπορεί να μας καθοδηγήσει στη βελτίωση του κωδικά που γράφουμε", ""] }
|
520
|
+
define_slide(include:-1) { ["5. Είναι ίσως το σημαντικότερο εργαλείο που διαθέτουμε ως προγραμματιστές", "",] }
|
521
|
+
define_slide { ["Ευχαριστώ για τη προσοχή σας..."] }
|
522
|
+
|
523
|
+
end
|
524
|
+
|
525
|
+
Presentation.new.play if ARGV[0] !~ /RECORD/
|
526
|
+
Presentation.new.record if ARGV[0] =~ /RECORD/
|
527
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: term_note
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michail Pantelelis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-11-16 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple hello world gem
|
14
|
+
email: mpantel@aegean.gr
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/testing.rb
|
20
|
+
homepage: https://rubygems.org/gems/term_note
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.7.6.2
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Give presentations written in Ruby through plain old console
|
44
|
+
test_files: []
|