<commit_before>require 'rspec'
require_relative '../../src/route/track_point'

describe 'TrackPoint' do
  before(:each) do
    @madrid = TrackPoint.new -3.6795367, 40.4379543, 648
    @chiclana = TrackPoint.new -6.15084, 36.4118808, 24
    @granada = TrackPoint.new -3.5922032, 37.1809462, 700
    @veleta = TrackPoint.new -3.348333, 37.050556, 3396
    @googleplex = TrackPoint.new -122.0840575, 37.4219999, 6
  end

  context "#==" do
    it "should discriminate two track points with different longitude" do |member|
      one   = TrackPoint.new(1,1,1)
      other = TrackPoint.new(2,1,1)

      expect(one).to_not eq(other)
    end

    it "should discriminate two track points with different latitude" do
      one   = TrackPoint.new(1,1,1)
      other = TrackPoint.new(1,2,1)

      expect(one).to_not eq(other)
    end

    it "should discriminate two track points with different inclination" do
      one   = TrackPoint.new(1,1,1)
      other = TrackPoint.new(1,1,2)

      expect(one).to_not eq(other)
    end

    it "should not discriminate two equal points" do
      one   = TrackPoint.new(1,1,1)
      other = TrackPoint.new(1,1,1)

      expect(one).to eq(other)
    end
  end

  it 'should raise exception when longitude is tried to be set to a not numeric value' do
    expect { @googleplex.longitude = 'invalid' }.to raise_exception 'Invalid longitude'
    expect { TrackPoint.new 'invalid', 0, 0 }.to raise_exception 'Invalid longitude'
  end

  it 'should raise exception when longitude is tried to be set outside limits' do
    expect { @googleplex.longitude = -181 }.to raise_exception 'Invalid longitude'<commit_msg>Amend style and semantic issues after feedback<commit_after>require 'rspec'
require_relative '../../src/route/track_point'

describe 'TrackPoint' do
  before(:each) do
    @madrid = TrackPoint.new -3.6795367, 40.4379543, 648
    @chiclana = TrackPoint.new -6.15084, 36.4118808, 24
    @granada = TrackPoint.new -3.5922032, 37.1809462, 700
    @veleta = TrackPoint.new -3.348333, 37.050556, 3396
    @googleplex = TrackPoint.new -122.0840575, 37.4219999, 6
  end

  context "#==" do
    it "should discriminate two track points with different longitude" do
      one   = TrackPoint.new(1,1,1)
      other = TrackPoint.new(2,1,1)

      expect(one).to_not eq(other)
    end

    it "should discriminate two track points with different latitude" do
      one   = TrackPoint.new(1,1,1)
      other = TrackPoint.new(1,2,1)

      expect(one).to_not eq(other)
    end

    it "should discriminate two track points with different elevation" do
      one   = TrackPoint.new(1,1,1)
      other = TrackPoint.new(1,1,2)

      expect(one).to_not eq(other)
    end

    it "should not discriminate two equal points" do
      one   = TrackPoint.new(1,1,1)
      other = TrackPoint.new(1,1,1)

      expect(one).to eq(other)
    end
  end

  it 'should raise exception when longitude is tried to be set to a not numeric value' do
    expect { @googleplex.longitude = 'invalid' }.to raise_exception 'Invalid longitude'
    expect { TrackPoint.new 'invalid', 0, 0 }.to raise_exception 'Invalid longitude'
  end

  it 'should raise exception when longitude is tried to be set outside limits' do
    expect { @googleplex.longitude = -181 }.to raise_exception 'Invalid longitude'
{'fraction_non_alphanumeric': 0.10612492419648271, 'fraction_numerical': 0.07580351728320193, 'mean_word_length': 3.154911838790932, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5262032', 'n_tokens_mistral': 1250, 'n_tokens_neox': 1070, 'n_words': 324}