from __future__ import print_function, unicode_literals

from spacemap import SpaceMap

def test():
	def check(desc, correct, result):
		if correct == result:
			print('PASSED:', desc, '==' , result, '==', correct)
		else:
			print('FAILED:', desc, '==' , result, '!=', correct)

	check('[4:8) - [0:2),[3:5)', SpaceMap({5:8}), SpaceMap({4:8}) - SpaceMap({0:2, 3:5}))
	check('[4:8),[8:90)', SpaceMap({4:90}), SpaceMap({4:8, 8:90}))
	check('[4:8),[80:90) - [0:2)', SpaceMap({4:8, 80:90}), SpaceMap({4:8, 80:90}) - SpaceMap({0:2}))
	check('[4:8),[80:90) - [0:10)', SpaceMap({80:90}), SpaceMap({4:8, 80:90}) - SpaceMap({0:10}))
	check('[4:8),[80:90) - [10:20)', SpaceMap({4:8, 80:90}), SpaceMap({4:8, 80:90}) - SpaceMap({10:20}))
	check('[4:8),[80:90) - [10:20)', SpaceMap({4:8}), SpaceMap({4:8, 80:90}) - SpaceMap({10:100}))
	check('[2:9) - [10:15),[20:48),[60:100)', SpaceMap({48: 60, 2: 10, 15: 20}), SpaceMap({2:90}) - SpaceMap({10:15, 20:48, 60:100}))
	check('[2:5) and [10:15)', SpaceMap({2: 5, 10: 15}), SpaceMap({2: 5}) and SpaceMap({10: 15}))
	return(None)

	print(SpaceMap({4:8}) - SpaceMap({0:4}))
	print(SpaceMap({4:8}) - SpaceMap({0:5}))
	print(SpaceMap({4:8}) - SpaceMap({0:8}))
	print(SpaceMap({4:8}) - SpaceMap({0:10}))
	print(SpaceMap({4:8}) - SpaceMap({4:4}))
	print(SpaceMap({4:8}) - SpaceMap({4:5}))
	print(SpaceMap({4:8}) - SpaceMap({4:8}))
	print(SpaceMap({4:8}) - SpaceMap({4:10}))
	print(SpaceMap({4:8}) - SpaceMap({5:5}))
	print(SpaceMap({4:8}) - SpaceMap({5:8}))
	print(SpaceMap({4:8}) - SpaceMap({5:10}))
	print(SpaceMap({4:8}) - SpaceMap({8:8}))
	print(SpaceMap({4:8}) - SpaceMap({8:10}))
	print(SpaceMap({4:8}) - SpaceMap({10:10}))
