Ejemplo n.º 1
0
def convert_rng_names():
    names = rngmodule.list_available_rngs()
    result = []
    for name in names:
        tmp = name.replace('-', '_')
        result.append(tmp)
    result = tuple(result)
    return result
Ejemplo n.º 2
0
 def test(self):
     refrng = rngmodule.rng()
     mylist = rngmodule.list_available_rngs()
     for i in mylist:
         if i == "knuthran2002":
             continue
         r = getattr(rngmodule, i)()
         test = 0
         try:
             assert type(r) == type(refrng)
             test = 1
         finally:
             if test == 0:
                 print "r      = %s %s" % (type(r), repr(r))
                 print "refrng = %s %s" % (type(refrng), repr(refrng))
Ejemplo n.º 3
0
 def test(self):
     refrng = rngmodule.rng()
     mylist = rngmodule.list_available_rngs()
     for i in mylist:
         if i == "knuthran2002":
             continue
         r = getattr(rngmodule, i)()
         test = 0
         try:
             assert (type(r) == type(refrng))
             test = 1
         finally:
             if test == 0:
                 print "r      = %s %s" % (type(r), repr(r))
                 print "refrng = %s %s" % (type(refrng), repr(refrng))
Ejemplo n.º 4
0
import types
import unittest
import math
import copy
import pygsl._numobj as Numeric
import pygsl._mlab as MLab
import pygsl.rng as rngmodule
import sys

sys.stdout = sys.stderr
rng_types = rngmodule.list_available_rngs()
from pygsl import Float, Int
from array_check import array_check
from gsl_test import isfloat, iscomplex


class _rng_type:
    _type = None


class _rng_basics(unittest.TestCase):
    """
    here are things tested like allocation, destruction, initialisation
    """

    def test_alloc(self):
        """
        allocate the default rng
        """

        rng = self._type()
Ejemplo n.º 5
0
import types
import unittest
import math
import copy
import pygsl._numobj as Numeric
import pygsl._mlab as MLab
import pygsl.rng as rngmodule
import sys
sys.stdout = sys.stderr
rng_types = rngmodule.list_available_rngs()
from pygsl import Float, Int
from array_check import array_check
from gsl_test import isfloat, iscomplex


class _rng_type:
    _type = None


class _rng_basics(unittest.TestCase):
    """
    here are things tested like allocation, destruction, initialisation
    """
    def test_alloc(self):
        """
        allocate the default rng
        """

        rng = self._type()
        self.failIf(rng.name() == "", "name of rng was \"\"")
        self.failIf(rng.name() is None, "name of rng was None")