# Copyright (c) 2022 by warp-core
#
# Endless Sky is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later version.
#
# Endless Sky is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https://www.gnu.org/licenses/>.

test "Hyperjumps To Autocondition"
	status active
	description `Test the "hyperjumps to: <planet|system>" autoconditions.`
	sequence
		inject "Three Earthly Barges Save"
		call "Load First Savegame"
		assert
			# Current planet
			"hyperjumps to planet: Earth" == 0
			# Another planet in the current system
			"hyperjumps to planet: Luna" == 0
			# Current system
			"hyperjumps to system: Sol" == 0
			# Other accessible locations
			"hyperjumps to system: Vega" == 1
			"hyperjumps to system: Alnitak" == 11
			"hyperjumps to planet: Farpoint" == 11
			# Location only accessible by jump drive or wormhole
			"hyperjumps to system: Waypoint" == -1
			# Locations only accessible by jump drive
			"hyperjumps to system: Sol Saryd" == -1
			"hyperjumps to planet: Spera Anatrusk" == -1
			# The following three calls should each print an error about the planet not having a system
			# and the planet/system not existing, respectively.
			# Planet not yet asigned to a system object.
			"hyperjumps to planet: Mountaintop" == -1
			# Non-existent locations
			"hyperjumps to planet: Csilla" == -1
			"hyperjumps to system: Xian" == -1
