# Copyright (c) 2020 by Peter van der Meer
#
# 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 "Sell 0 ships"
	status active
	description "Test departing without sell a ship."
	sequence
		# Create/inject the savegame and load it.
		inject "Fighters and Carriers and Escorts Save"
		call "Load First Savegame"
		call "Depart"
		# We can only check the conditions after departing, since the conditions are not updated directly after loading or selling.
		assert
			and
				"ships: Fighter" == 2
				"ships: Heavy Warship" == 1
				"ships: Medium Warship" == 1


test "Sell 1 ship"
	status active
	description "Test selling a single ship."
	sequence
		# Create/inject the savegame and load it.
		inject "Fighters and Carriers and Escorts Save"
		call "Load First Savegame"
		call "Sell first ship"
		call "Depart"
		# We can only check the conditions after departing, since the conditions are not updated directly after loading or selling.
		assert
			and
				"ships: Fighter" == 1
				"ships: Heavy Warship" == 1
				"ships: Medium Warship" == 1
				"flagship model: Finch" == 1
				"flagship model: Bactrian" == 0


test "Sell 2 ships"
	status active
	description "Test selling two ships."
	sequence
		# Create/inject the savegame and load it.
		inject "Fighters and Carriers and Escorts Save"
		call "Load First Savegame"
		call "Sell first ship"
		call "Sell first ship"
		call "Depart"
		# We can only check the conditions after departing, since the conditions are not updated directly after loading or selling.
		assert
			and
				"ships: Fighter" == 0
				"ships: Heavy Warship" == 1
				"ships: Medium Warship" == 1
				"flagship model: Bactrian" == 1
				"flagship model: Finch" == 0


test "Sell 3 ships"
	status active
	description "Test selling three ships."
	sequence
		# Create/inject the savegame and load it.
		inject "Fighters and Carriers and Escorts Save"
		call "Load First Savegame"
		call "Sell first ship"
		call "Sell first ship"
		call "Sell first ship"
		call "Depart"
		# We can only check the conditions after departing, since the conditions are not updated directly after loading or selling.
		assert
			and
				"ships: Fighter" == 0
				"ships: Heavy Warship" == 0
				"ships: Medium Warship" == 1
				"flagship model: Aerie" == 1
				"flagship model: Finch" == 0
				"flagship model: Bactrian" == 0
