© 2019 American Physical Society. Background: Simulations by transport codes are indispensable for extracting valuable physical information from heavy-ion collisions. Pion observables such as the π-/π+ yield ratio are expected to be sensitive to the symmetry energy at high densities. Purpose: To evaluate, understand, and reduce the uncertainties in transport-code results originating from different approximations in handling the production of Δ resonances and pions. Methods: We compare ten transport codes under controlled conditions for a system confined in a box, with periodic boundary conditions, and initialized with nucleons at saturation density and at a temperature of 60 MeV. The reactions NN↔NΔ and Δ↔Nπ are implemented, but the Pauli blocking and the mean-field potential are deactivated in the present comparison. Thus, these are cascade calculations including pions and Δ resonances. Results are compared to those from the two reference cases of a chemically equilibrated ideal gas mixture and of the rate equation. Results: For the numbers of Δ and π, deviations from the reference values are observed in many codes, and they depend significantly on the size of the time step. These deviations are tied to different ways in ordering the sequence of reactions, such as collisions and decays, that take place in the same time step. Better agreements with the reference values are seen in the reaction rates and the number ratios among the isospin species of Δ and π. Both the reaction rates and the number ratios are, however, affected by the correlations between particle positions, which are absent in the Boltzmann equation, but are induced by the way particle scatterings are treated in many of the transport calculations. The uncertainty in the transport-code predictions of the π-/π+ ratio, after letting the existing Δ resonances decay, is found to be within a few percent for the system initialized at n/p=1.5. Conclusions: The uncertainty in the final π-/π+ ratio in this simplified case of particles in a box is sufficiently small so that it does not strongly impact constraining the high-density symmetry energy from heavy-ion collisions. Most of the sources of uncertainties have been understood, and individual codes may be further improved in future applications. This investigation will be extended in the future to heavy-ion collisions to ensure the problems identified here remain under control.