Sha256: c05be6f667e35276f939767064dea61067330d2115e751bf811a131461b5b769

Contents?: true

Size: 725 Bytes

Versions: 90

Compression:

Stored size: 725 Bytes

Contents

require 'exercise_cases'

require 'time'

class GigasecondCase < OpenStruct
  def name
    'test_%s' % description.gsub(/[ :-]/, '_')
  end

  def description
    send(:'#') || input
  end

  def got
    "Time.utc(#{start_values.join(', ')})"
  end

  def want
    "Time.utc(#{stop_values.join(', ')})"
  end

  def start_values
    ts = Time.parse(input)
    [ts.year, ts.month, ts.day, ts.hour, ts.min, ts.sec]
  end

  def stop_values
    ts = Time.parse(expected)
    [ts.year, ts.month, ts.day, ts.hour, ts.min, ts.sec]
  end

  def skipped?
    index > 0
  end
end

GigasecondCases = proc do |data|
  JSON.parse(data)['add']['cases'].map.with_index do |row, i|
    GigasecondCase.new(row.merge('index' => i))
  end
end

Version data entries

90 entries across 90 versions & 1 rubygems

Version Path
trackler-2.1.0.1 tracks/ruby/lib/gigasecond_cases.rb
trackler-2.1.0.0 tracks/ruby/lib/gigasecond_cases.rb
trackler-2.0.8.55 tracks/ruby/lib/gigasecond_cases.rb
trackler-2.0.8.54 tracks/ruby/lib/gigasecond_cases.rb
trackler-2.0.8.53 tracks/ruby/lib/gigasecond_cases.rb
trackler-2.0.8.52 tracks/ruby/lib/gigasecond_cases.rb
trackler-2.0.8.51 tracks/ruby/lib/gigasecond_cases.rb
trackler-2.0.8.50 tracks/ruby/lib/gigasecond_cases.rb
trackler-2.0.8.49 tracks/ruby/lib/gigasecond_cases.rb
trackler-2.0.8.48 tracks/ruby/lib/gigasecond_cases.rb
trackler-2.0.8.47 tracks/ruby/lib/gigasecond_cases.rb
trackler-2.0.8.46 tracks/ruby/lib/gigasecond_cases.rb
trackler-2.0.8.45 tracks/ruby/lib/gigasecond_cases.rb
trackler-2.0.8.44 tracks/ruby/lib/gigasecond_cases.rb
trackler-2.0.8.43 tracks/ruby/lib/gigasecond_cases.rb
trackler-2.0.8.42 tracks/ruby/lib/gigasecond_cases.rb
trackler-2.0.8.41 tracks/ruby/lib/gigasecond_cases.rb
trackler-2.0.8.40 tracks/ruby/lib/gigasecond_cases.rb
trackler-2.0.8.39 tracks/ruby/lib/gigasecond_cases.rb
trackler-2.0.8.38 tracks/ruby/lib/gigasecond_cases.rb