package LinkedListModuleTests
import LinkedListModule

// -----TESTS------
class TestClass
	use LinkedListModule
	string str
	construct(string str)
		this.str = str

function allToString() returns string
	var res = ""
 	for x in TestClass
		res += x.str
	return res

@Test
function test()
	let a = new TestClass("a")
	let b = new TestClass("b")
	let c = new TestClass("c")
	let d = new TestClass("d")

 	allToString().assertEquals("abcd")
 	destroy c
 	allToString().assertEquals("abd")
 	destroy d
 	allToString().assertEquals("ab")
 	destroy a
 	allToString().assertEquals("b")
 	destroy b
 	allToString().assertEquals("")

 @Test
 function testDestroy()
 	new TestClass("a")
	let b = new TestClass("b")
	new TestClass("c")
	new TestClass("d")
 	var s = ""
 	for x in TestClass
		s += x.str
		if x == b
			destroy x
	s.assertEquals("abcd")
	allToString().assertEquals("acd")
	for x in TestClass
		destroy x
	allToString().assertEquals("")
