Skip to content

Commit

Permalink
Trip exercise, initial slightly changed version
Browse files Browse the repository at this point in the history
  • Loading branch information
nethad committed Jul 22, 2019
0 parents commit 6ac5c6d
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.6.3
50 changes: 50 additions & 0 deletions trip_exercise.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
require "minitest/autorun"

################################################################################
# Tests

class TravelTest < Minitest::Test
def self.test_order
:sorted
end

def test_location
skip # Remove this 'skip' instruction if you want to run the test

paris = Location.new("Paris", "French", "Euro")

assert_equal "Paris", paris.name
assert_equal "French", paris.language
assert_equal "Euro", paris.currency
end

def test_trip_to_paris
skip # Remove this 'skip' instruction if you want to run the test

zurich = Location.new("Zurich", "Swiss-German", "Swiss francs")
paris = Location.new("Paris", "French", "Euro")
trip = Trip.new(zurich)
trip.add_stop(paris)

assert_equal ["Zurich", "Paris", "Zurich"], trip.itinerary
assert_equal ["Euro"], trip.foreign_currencies
end

def test_longer_trip
skip # Remove this 'skip' instruction if you want to run the test

trip = Trip.new(Location.new("Zurich", "Swiss-German", "Swiss francs"))
trip.add_stop(Location.new("Milan", "Italian", "Euro"))
trip.add_stop(Location.new("Zagreb", "Croatian", "Kuna"))
trip.add_stop(Location.new("Budapest", "Hungarian", "Forint"))
trip.add_stop(Location.new("Vienna", "German", "Euro"))

assert_equal ["Zurich", "Milan", "Zagreb", "Budapest", "Vienna", "Zurich"], trip.itinerary
assert_equal ["Euro", "Kuna", "Forint"], trip.foreign_currencies
end
end

################################################################################
# Code under test

# TODO: Implement the code that makes the tests pass here!

0 comments on commit 6ac5c6d

Please sign in to comment.