Skip to content

Test Run: a simple example

Jean-Francois Baffier edited this page Mar 28, 2017 · 8 revisions

Problem description

This TestRun problem was designed to be as simple as possible while being able to simulate any stack behavior. Its purpose was mainly to experimentally evaluate the time and space efficiency of the Compressed Stack structure. However, it also provides a good starting point for all users.

It is an artificial stack algorithm that executes push and pop operations for debugging purposes. Each data in the input is a pair of positive integers separated by a comma (say, 5,2). The first number indicates the value to store, if and only if it is at least 1. The second number indicates the value used to update the context (note that the data type and the contexts are both integers). We use the context as an auxiliary variable to count the number of pops to execute (while the context is strictly positive, popCondition will return true and decrement the context by one).

Instance generator

An instance generator is provided as examples/testrun/generateInputTestRun.cpp. If the provided CMake file CMakeLists.txt is used as described in the Installation (Build) page, an executable to generate TestRun instances will be built.

The generateInputTestRun executable can be called as follows.

generateInputTestRun here comes Yago's example

Where ... are this that and such.

Basic usage

If we suppose the path to the previous generated instance is stored in the variable filePath, then a simple utilization of the library would be as such:

// Create the StackAlgo object and its associated stack to execute a TestRun
Instance testRun(filePath);
// Actually run the TestRun instance
testRun.run();
// Print the actual state of the stack at the end of the algorithm
testRun.println();

Experimental results

Here come the results additional to the one we provide in the article and that do not fit such as tables or additional plots. Yago, it is for you again.

Clone this wiki locally