// 2>r private static void ontoR2() { var top = Stack.Pop(); ReturnStack.Push(Stack.Pop()); ReturnStack.Push(top); }
void ReturnStackOverflowTest() { Int16[] data = { 0, 1, 2, 3, 4 }; ReturnStack rs = MakeStack(data.GetLength(0) - 1); Assert.Throws <StackOverflowException>(() => data.Any(i => { rs.Push(data[i]); return(false); })); }
void ReturnStackPushPopTest() { Int16[] data = { 0, 1, 2, 3, 4, 5 }; ReturnStack rs = MakeStack(data.GetLength(0)); data.Any(i => { rs.Push(data[i]); return(false); }); Assert.True(rs.Position == 0); Assert.True(data.All(i => rs.Pop() == data[rs.Size - rs.Position])); }
// The return stack being a part of the actual call stack doesn't make a // lot of sense in .Net so it's just a second stack, indistinguishable in all // but usage from the Data stack. // >r private static void ontoR() { ReturnStack.Push(Stack.Pop()); }