def testSequenceInit():
	print('''
		Test sequence construction and validation.
		==========================================''')

	shouldBeTrue = [
		([], []),
		([1, 2], [0, 1, 0, 1, 1]),
		([3, 4, 1, 2], [1, 1, 1, 0, 0 , 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1])
	]
	shouldBeFalse =	[
		([1], []),
		([1, 2], [0, 1, 0, 1, 0]),
		([2, 4, 1, 2], [1, 1, 1, 0, 0 , 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1])
	]

	for test in shouldBeTrue:
		assert PzlUtil.matches(test[0], test[1])
		seq = PzlClass.Sequence(test[0], test[1], log = True)
		assert seq is not None
		assert seq.spreadGroups()
		startingState = PzlUtil.stateForGroups(seq.groups, length = seq.length)
		print(startingState)
		assert startingState is not None and len(startingState) == seq.length

	for test in shouldBeFalse:
		assert not PzlUtil.matches(test[0], test[1])
		assert PzlClass.Sequence(test[0], test[1], log = True) is not None
	
	return
	def isSolved(self):
		grid = self.getSolutionGrid()
		for column in range(self.height):
			state = [grid[row][column] for row in range(self.height)]
			pattern = self.patterns['columns'][column]
			if not PuzzleUtil.matches(pattern, state):
				return False

		return True
	def setState(self):
		'''
		Set the new state based on the current group structure.
		Return True if the new state matches the pattern, else False
		'''
		# Default sequence has some bits filled
		newState = self.initialState.copy()
		PuzzleUtil.stateForGroups(self.groups, state = newState)
		self.state = newState
		if PuzzleUtil.matches(self.pattern, newState):
			self.printState("Valid State")
			return True

		else:
			self.invalidStates.add(self.stateIndex)
			return False