Skip to content

Commit 172c008

Browse files
refactor: removed obsolete code.
1 parent d76ad4c commit 172c008

File tree

1 file changed

+0
-72
lines changed

1 file changed

+0
-72
lines changed

spec/moving_a_mars_rover_forwards_spec.rb

-72
Original file line numberDiff line numberDiff line change
@@ -58,78 +58,6 @@
5858
expect(mars_rover).to be_located_at(expected_coordinates).and be_facing('N')
5959
end
6060

61-
# Assume:
62-
# 18 parallels: 9 parallels on the northern hemisphere, each 10 degrees apart, and another 9 in the southern hemisphere.
63-
# 36 meridians, each 10 degrees apart: The western hemisphere as 18, the eastern hemisphere also 18.
64-
# The north pole is 90 degrees N from Mars' equator and the south pole is 90 degrees S from Mars' equator
65-
# At the central meridian (0 degrees) North Pole is at P(0, 9) and South Pole P(0, -9)
66-
context 'at the north pole P(x, 9)' do
67-
[
68-
{
69-
mars_rover: mars_rover(starting_at: Location.new(direction: 'N', coordinates: Coordinates.new(x: 0, y: 8))),
70-
expected_coordinates: Coordinates.new(x: 18, y: 8)
71-
},
72-
{
73-
mars_rover: mars_rover(starting_at: Location.new(direction: 'N', coordinates: Coordinates.new(x: 1, y: 8))),
74-
expected_coordinates: Coordinates.new(x: 19, y: 8)
75-
},
76-
{
77-
mars_rover: mars_rover(starting_at: Location.new(direction: 'N', coordinates: Coordinates.new(x: 18, y: 8))),
78-
expected_coordinates: Coordinates.new(x: 0, y: 8)
79-
},
80-
{
81-
mars_rover: mars_rover(starting_at: Location.new(direction: 'N', coordinates: Coordinates.new(x: 19, y: 8))),
82-
expected_coordinates: Coordinates.new(x: 1, y: 8)
83-
}
84-
].each do |row|
85-
it "moves to the same latitude but at the antimeridian e.g. from #{row[:mars_rover].current_position} to #{row[:expected_coordinates]} and faces south" do
86-
mars_rover = row[:mars_rover]
87-
88-
mars_rover.execute(['f'])
89-
90-
expect(mars_rover).to be_located_at(row[:expected_coordinates]).and be_facing('S')
91-
end
92-
end
93-
end
94-
95-
context 'at the south pole P(x, -9)' do
96-
it 'moves to the same latitude but at the antimeridian, e.g. (0, -8) to (18, -8) and faces north' do
97-
starting_location = Location.new(direction: 'S', coordinates: Coordinates.new(x: 0, y: -8))
98-
mars_rover = mars_rover(starting_at: starting_location)
99-
100-
mars_rover.execute(['f'])
101-
102-
expect(mars_rover).to be_located_at(Coordinates.new(x: 18, y: -8)).and be_facing('N')
103-
end
104-
105-
it 'moves to the same latitude at the antimeridian, e.g. (3, -8) to (21, -8) and faces north' do
106-
starting_location = Location.new(direction: 'S', coordinates: Coordinates.new(x: 3, y: -8))
107-
mars_rover = mars_rover(starting_at: starting_location)
108-
109-
mars_rover.execute(['f'])
110-
111-
expect(mars_rover).to be_located_at(Coordinates.new(x: 21, y: -8)).and be_facing('N')
112-
end
113-
114-
it 'moves to the south pole at an antimeridian back to the prime meridian e.g. (18, -8) to (0, -8)' do
115-
starting_location = Location.new(direction: 'S', coordinates: Coordinates.new(x: 18, y: -8))
116-
mars_rover = mars_rover(starting_at: starting_location)
117-
118-
mars_rover.execute(['f'])
119-
120-
expect(mars_rover).to be_located_at(Coordinates.new(x: 0, y: -8)).and be_facing('N')
121-
end
122-
123-
example 'starting at the equator, at the prime meridian and ending up at the north pole' do
124-
starting_location = Location.new(direction: 'N', coordinates: Coordinates.new(x: 0, y: 0))
125-
mars_rover = mars_rover(starting_at: starting_location)
126-
127-
mars_rover.execute(%w{f f f f f f f f f})
128-
129-
expect(mars_rover).to be_located_at(Coordinates.new(x: 18, y: 8)).and be_facing('S')
130-
end
131-
end
132-
13361
context 'at the edge of the western hemisphere' do
13462
it 'moves into the eastern hemisphere' do
13563
starting_location = Location.new(direction: 'E', coordinates: Coordinates.new(x: 35, y: 0))

0 commit comments

Comments
 (0)