Files
2010-11-26 16:20:48 +01:00

35 lines
444 B
Plaintext

//Script.NET examples
//(c)2007-2009, Protsyk Petro, http://www.protsyk.com
function Push(item)
[
pre(me.Count < 10 );
post();
invariant();
]
{
me.Push(item);
}
function Pop()
[
pre(me.Count > 0);
post();
invariant();
]
{
return me.Pop();
}
stack = new Stack<|int|>();
//Create Mutant
mObject = [ Push -> Push, Pop -> Pop ];
mObject.Mutate(stack);
for (i=0; i<5; i++)
mObject.Push(i);
Console.WriteLine((string)mObject.Pop());