Simplify clearing the stack
Killing the process made for some dirty log output since the exit wasn't
handled cleanly. Rather than trying to fix that we just add a message to
reset the stack state inside the same pid.
diff --git a/test/tester.es b/test/tester.es
index b47bf1f..067820c 100755
--- a/test/tester.es
+++ b/test/tester.es
@@ -48,6 +48,10 @@
From ! {self(), ok},
St;
+stack_handle({From, clear}, _St) ->
+ From ! {self(), ok},
+ [];
+
stack_handle({From, length}, St) ->
From ! {self(), length(St)},
St;
@@ -83,6 +87,14 @@
%% receive {Pid, ok} -> ok end.
+stack_clear(#st{stack = Pid}) ->
+ stack_clear(Pid);
+
+stack_clear(Pid) ->
+ Pid ! {self(), clear},
+ receive {Pid, ok} -> ok end.
+
+
stack_size(#st{stack = Pid}) ->
stack_size(Pid);
@@ -323,8 +335,8 @@
St;
execute(_TxObj, St, <<"EMPTY_STACK">>) ->
- exit(St#st.stack, kill),
- St#st{stack = stack_create()};
+ stack_clear(St),
+ St;
execute(_TxObj, St, <<"SWAP">>) ->
Idx = stack_pop(St),