The Battle for Wesnoth  1.15.2+dev
Macros | Functions
test_rng.cpp File Reference
#include <boost/test/unit_test.hpp>
#include "random_synced.hpp"
#include "random_deterministic.hpp"
#include "config.hpp"
#include <sstream>
#include <iomanip>
Include dependency graph for test_rng.cpp:

Go to the source code of this file.

Macros

#define GETTEXT_DOMAIN   "wesnoth-test"
 
#define validation_get_random_int_num_draws   19999
 
#define validation_get_random_int_max   32000
 
#define validation_get_random_int_correct_answer   10885
 

Functions

 BOOST_AUTO_TEST_CASE (validate_mt19937)
 
 BOOST_AUTO_TEST_CASE (test_mt_rng_seed_manip)
 
 BOOST_AUTO_TEST_CASE (test_mt_rng_config_seed_manip)
 
 BOOST_AUTO_TEST_CASE (test_mt_rng_reproducibility)
 
 BOOST_AUTO_TEST_CASE (test_mt_rng_reproducibility2)
 
 BOOST_AUTO_TEST_CASE (test_mt_rng_reproducibility3)
 
 BOOST_AUTO_TEST_CASE (test_mt_rng_reproducibility4)
 
 BOOST_AUTO_TEST_CASE (test_mt_rng_reproducibility5)
 
 BOOST_AUTO_TEST_CASE (test_mt_rng_reproducibility_coverage)
 
 BOOST_AUTO_TEST_CASE (validate_get_random_int)
 This test and the next validate that we are getting the correct values from the get_random_int function, in the class random. More...
 
 BOOST_AUTO_TEST_CASE (validate_get_random_int2)
 

Macro Definition Documentation

◆ GETTEXT_DOMAIN

#define GETTEXT_DOMAIN   "wesnoth-test"

Definition at line 15 of file test_rng.cpp.

◆ validation_get_random_int_correct_answer

#define validation_get_random_int_correct_answer   10885

Definition at line 294 of file test_rng.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ validation_get_random_int_max

#define validation_get_random_int_max   32000

Definition at line 292 of file test_rng.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ validation_get_random_int_num_draws

#define validation_get_random_int_num_draws   19999

Definition at line 290 of file test_rng.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/11]

BOOST_AUTO_TEST_CASE ( validate_mt19937  )

Definition at line 29 of file test_rng.cpp.

References i.

◆ BOOST_AUTO_TEST_CASE() [2/11]

BOOST_AUTO_TEST_CASE ( test_mt_rng_seed_manip  )

◆ BOOST_AUTO_TEST_CASE() [3/11]

BOOST_AUTO_TEST_CASE ( test_mt_rng_config_seed_manip  )

◆ BOOST_AUTO_TEST_CASE() [4/11]

BOOST_AUTO_TEST_CASE ( test_mt_rng_reproducibility  )

Definition at line 132 of file test_rng.cpp.

References randomness::mt_rng::get_next_random(), and i.

◆ BOOST_AUTO_TEST_CASE() [5/11]

BOOST_AUTO_TEST_CASE ( test_mt_rng_reproducibility2  )

Definition at line 147 of file test_rng.cpp.

References randomness::mt_rng::get_next_random(), and i.

◆ BOOST_AUTO_TEST_CASE() [6/11]

BOOST_AUTO_TEST_CASE ( test_mt_rng_reproducibility3  )

◆ BOOST_AUTO_TEST_CASE() [7/11]

BOOST_AUTO_TEST_CASE ( test_mt_rng_reproducibility4  )

◆ BOOST_AUTO_TEST_CASE() [8/11]

BOOST_AUTO_TEST_CASE ( test_mt_rng_reproducibility5  )

◆ BOOST_AUTO_TEST_CASE() [9/11]

BOOST_AUTO_TEST_CASE ( test_mt_rng_reproducibility_coverage  )

Definition at line 268 of file test_rng.cpp.

◆ BOOST_AUTO_TEST_CASE() [10/11]

BOOST_AUTO_TEST_CASE ( validate_get_random_int  )

This test and the next validate that we are getting the correct values from the get_random_int function, in the class random.

We test both subclasses of random. If these tests fail but the seed manipulation tests all pass, and validate_mt19937 passes, then it suggests that the implementation of get_random_int may not be working properly on your platform.

Definition at line 304 of file test_rng.cpp.

References validation_get_random_int_correct_answer, validation_get_random_int_max, and validation_get_random_int_num_draws.

◆ BOOST_AUTO_TEST_CASE() [11/11]

BOOST_AUTO_TEST_CASE ( validate_get_random_int2  )