Class: ImpUnit::SimpleSearch

Inherits:
Object
  • Object
show all
Defined in:
lib/ImpUnit.rb

Overview

Points to specific SimpleSearch.

Class Method Summary collapse

Class Method Details

.randomObject

ImpUnit::SimpleSearch.random



245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/ImpUnit.rb', line 245

def self.random
  number = 0

  options_list = File.read("options/option_list.txt").to_s.split(" ").shuffle

  # Candidate files
  candidate = File.read("candidate/algorithm_candidate.txt").strip.to_s

  # Bases iteration limit on options list size.
  size_limit = options_list.size.to_i

  # Iterate size limit times comparing option with candidate.
  size_limit.times do
    option = options_list[number]

    print "Candidate: #{candidate} Option: #{option} >> "

    if option == candidate
      puts " #{option} matches the candidate #{candidate}."

      abort
    else
      puts " #{option} does not match the candidate #{candidate}."
    end

    sleep(3)

    number = number + 1
  end
end

.standardObject

ImpUnit::SimpleSearch.standard



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/ImpUnit.rb', line 213

def self.standard
  number = 0

  options_list = File.read("options/option_list.txt").to_s.split(" ") #.shuffle

  # Candidate files
  candidate = File.read("candidate/algorithm_candidate.txt").strip.to_s

  # Bases iteration limit on options list size.
  size_limit = options_list.size.to_i

  # Iterate size limit times comparing option with candidate.
  size_limit.times do
    option = options_list[number]

    print "Candidate: #{candidate} Option: #{option} >> "

    if option == candidate
      puts " #{option} matches the candidate #{candidate}."

      abort
    else
      puts " #{option} does not match the candidate #{candidate}."
    end

    sleep(3)

    number = number + 1
  end
end