# Testing

POMDPTools contains basic utilities for testing models and solvers.

## Testing (PO)MDP Models

`POMDPTools.Testing.has_consistent_distributions`

— Function`has_consistent_distributions(m::Union)`

Return true if no problems are found in the distributions for a discrete problem. Print information and return false if problems are found.

Tests whether

- All probabilities are positive
- Probabilities for all distributions sum to 1
- All items with positive probability are in the support

`POMDPTools.Testing.has_consistent_initial_distribution`

— Function`has_consistent_initial_distribution(m)`

Return true if no problems are found with the initial state distribution for a discrete problem. Print information and return false if problems are found.

See `has_consistent_distributions`

for information on what checks are performed.

`POMDPTools.Testing.has_consistent_transition_distributions`

— Function`has_consistent_transition_distributions(m)`

Return true if no problems are found in the transition distributions for a discrete problem. Print information and return false if problems are found.

See `has_consistent_distributions`

for information on what checks are performed.

`POMDPTools.Testing.has_consistent_observation_distributions`

— Function`has_consistent_observation_distributions(m)`

Return true if no problems are found in the observation distributions for a discrete POMDP. Print information and return false if problems are found.

See `has_consistent_distributions`

for information on what checks are performed.

## Testing Solvers

`POMDPTools.Testing.test_solver`

— Function```
test_solver(solver::Solver, problem::POMDP)
test_solver(solver::Solver, problem::MDP)
```

Use the solver to solve the specified problem, then run a simulation.

This is designed to illustrate how solvers are expected to function. All solvers should be able to complete this standard test with the simple models in the POMDPModels package.

Note that this does NOT test the optimality of the solution, but is only a smoke test to see if the solver interacts with POMDP models as expected.

To run this with a solver called YourSolver, run

```
using POMDPToolbox
using POMDPModels
solver = YourSolver(# initialize with parameters #)
test_solver(solver, BabyPOMDP())
```