mirror of
https://github.com/PetroProtsyk/SSharp
synced 2026-06-08 12:11:10 +00:00
35 lines
444 B
Plaintext
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());
|
|
|