PEDSIM uses Google's gtest test framework for writing C++ tests. As a user of libpedsim running the library tests is not strictly necessary unless you play with the source of libpedsim and want to make sure you've not broken anything.
To run the tests, run this in the libpedsim source folder:
This export is needed since the library is not installed in a system wide known directory.
make test will run a memory leak test. It uses Valgrind for this purpose, make sure you have it installed on your system. In order to perform this test the familiar code example
example01.cpp will be compiled and executed, dynamically linked against
libpedsim. This tests the bulk of the PEDSIM functionality for memory leaks. An example output is shown here:
libpesim/tests/unit/ contains unit tests for most of the functions of libpedsim. That content is not included in this documentation. Please consult the source code directly if you are interested in the unit tests.
libpesim/tests/acceptance/ contains user acceptance tests for libpedsim. These are small test scenarios that test the behavior of the complete libpedsim functionality. First a scenario is defined, then the full simulation is run for a few timesteps. The output of that simulation is then compared against a high level description of the behavior dynamics.
This is a very important aspect for developers of the library - if these test pass, the expected behavior has probably not changed. It is not expected to change even if the underlying mechanisms are modified - it is quite stable and can be seen as a kind of guarantee to the library user.
Further, since these tests are self-contained small programs, they can serve naturally as code examples quite well. This is why their source code is included into the documentation verbatimly.
This tests if an agent stays where it was placed as long as there are no forces affecting him. This is only the case if it is basically alone in a world without other agents or obstacles.
This tests if the agent moves towards a waypoint that has been assigned to it.
If waypoint mode is set to BEHAVIOR_ONCE, the agent should stop once reached the last waypoint. This is only the case if the dynamics work in such a way that the agent's velocity reduced to 0 after a while without any forces affecting it. Like drag, or decaying momentum.
This is a numerical stability test. 10 agents are placed very close to each other spread out on the x axis. Y and Z axis positions are identical for all agents. The force pushing them appart should only affect the x axis value of their positions.
(c) Christian Gloor [ c|h|g|l|o|o|r|@|s|i|l|m|a|r|i|l|.|o|r|g| ]