Home | History | Annotate | Download | only in rand.adapt.disc
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <random>
     11 
     12 // template<class Engine, size_t p, size_t r>
     13 // class discard_block_engine
     14 // {
     15 // public:
     16 //     // types
     17 //     typedef typename Engine::result_type result_type;
     18 //
     19 //     // engine characteristics
     20 //     static constexpr size_t block_size = p;
     21 //     static constexpr size_t used_block = r;
     22 //     static constexpr result_type min() { return Engine::min(); }
     23 //     static constexpr result_type max() { return Engine::max(); }
     24 
     25 #include <random>
     26 #include <type_traits>
     27 #include <cassert>
     28 
     29 #include "test_macros.h"
     30 
     31 template <class T>
     32 void where(const T &) {}
     33 
     34 void
     35 test1()
     36 {
     37     typedef std::ranlux24 E;
     38     static_assert((E::block_size == 223), "");
     39     static_assert((E::used_block == 23), "");
     40 #if TEST_STD_VER >= 11
     41     static_assert((E::min() == 0), "");
     42     static_assert((E::max() == 0xFFFFFF), "");
     43 #else
     44     assert((E::min() == 0));
     45     assert((E::max() == 0xFFFFFF));
     46 #endif
     47     where(E::block_size);
     48     where(E::used_block);
     49 }
     50 
     51 void
     52 test2()
     53 {
     54     typedef std::ranlux48 E;
     55     static_assert((E::block_size == 389), "");
     56     static_assert((E::used_block == 11), "");
     57 #if TEST_STD_VER >= 11
     58     static_assert((E::min() == 0), "");
     59     static_assert((E::max() == 0xFFFFFFFFFFFFull), "");
     60 #else
     61     assert((E::min() == 0));
     62     assert((E::max() == 0xFFFFFFFFFFFFull));
     63 #endif
     64     where(E::block_size);
     65     where(E::used_block);
     66 }
     67 
     68 int main()
     69 {
     70     test1();
     71     test2();
     72 }
     73