Beispiel #1
0
def correctInitials1(test):
    test.test = lambda: assertlib.exact(
        lib.getFunction("initials", _fileName)
        ("Johann Friedrich Miescher").upper(), "JFM")
    test.description = lambda: "initials() returns the correct initials for \"Johann Friedrich Miescher\""
Beispiel #2
0
def correctVierkant(test):
    test.test = lambda: assertlib.between(
        lib.getFunction("vierkant", _fileName)(), 0.51, 0.54)
    test.description = lambda: "vierkant geeft de goede afstand terug"
Beispiel #3
0
def exact_matches_a(test):
    test.test = lambda: set(
        lib.getFunction("exact_matches", _fileName)
        ("atgacatgcacaagtatgcat", "atgc")) == set([5, 15])
    test.description = lambda: "exact_matches works for input 'atgacatgcacaagtatgcat', 'atgc'"
def correctFunc3(test):
	test.test = lambda : assertlib.between(lib.getFunction("riemann", _fileName)(lambda x : math.sin(x**2), 0, math.pi, 10000), 0.77, 0.78)
	test.description = lambda : "riemann werkt correct voor een functie die onder de x-as komt"
Beispiel #5
0
def correct(test):
    test.test = lambda: assertlib.exact(
        sorted(
            int(p * 10) for p in lib.getFunction("roots", _fileName)
            (1, 2, -10)), [-43, 23])
    test.description = lambda: "roots() yields the two correct roots for a=1, b=2, c=-10"
Beispiel #6
0
def correctFunc2(test):
    test.test = lambda: assertlib.between(
        lib.getFunction("riemann", _fileName)(lambda x: math.tan(
            math.cos(math.sin(x))), 0.2, 2.2, 10000), 1.70, 1.71)
    test.description = lambda: "riemann() yields the correct value when an interval does not start at x=0"
def correctFunc1(test):
	test.test = lambda : assertlib.between(lib.getFunction("riemann", _fileName)(lambda x : x**(x + 0.5), 0, 1, 10000), 0.52, 0.53)
	test.description = lambda : "riemann werkt correct voor een simpele functie"
Beispiel #8
0
def correctFunc3(test):
    test.test = lambda: assertlib.between(
        lib.getFunction("montecarlo", _fileName)
        (lambda x: math.sin(x**2), 0, -1, math.pi, 1), 0.75, 0.79)
    test.description = lambda: "montecarlo() yields the correct value when a function goes below the x-axis"
Beispiel #9
0
def correctDice(test):
    test.test = lambda: assertlib.between(
        lib.getFunction("worp_met_twee_dobbelstenen", _fileName)(), 2, 12)
    test.description = lambda: "returnt een correcte waarde voor een worp van twee dobbelstenen"
    test.timeout = lambda: 60
Beispiel #10
0
def correctFunc1(test):
    test.test = lambda: assertlib.between(
        lib.getFunction("montecarlo", _fileName)
        (lambda x: x**(x + 0.5), 0, 0, 1, 1), 0.51, 0.54)
    test.description = lambda: "montecarlo() yields the correct value of an integral on [0,1] for the square function"
Beispiel #11
0
def correctFunc2(test):
    test.test = lambda: assertlib.between(
        lib.getFunction("montecarlo", _fileName)(lambda x: math.tan(
            math.cos(math.sin(x))), 0.2, 0, 2.2, 1.5), 1.69, 1.73)
    test.description = lambda: "montecarlo() yields the correct value when an interval does not start at x=0"
Beispiel #12
0
def almostWrongInput(test):
    test.test = lambda: assertlib.exact(
        lib.getFunction("initials", _fileName)
        ("John  Double  Spaces").upper(), "JDS")
    test.description = lambda: "initials() returns the correct initials for \"John  Double  Spaces\""
Beispiel #13
0
def correctInitials3(test):
    test.test = lambda: assertlib.exact(
        lib.getFunction("initials", _fileName)("Martha Chase").upper(), "MC")
    test.description = lambda: "initials() returns the correct initials for \"Martha Chase\""
Beispiel #14
0
def correctInitials2(test):
    test.test = lambda: assertlib.exact(
        lib.getFunction("initials", _fileName)("Phoebus Levene").upper(), "PL")
    test.description = lambda: "initials() returns the correct initials for \"Phoebus Levene\""
Beispiel #15
0
 def testMethod():
     import monopoly
     possession = lib.getFunction("possession", _fileName)
     return asserts.containsOnly(
         possession(monopoly.Board()).values(), [False])
Beispiel #16
0
 def try_run():
     try:
         return lib.getFunction("simuleer_groot_aantal_potjes_Monopoly",
                                _fileName)(1500)
     except:
         return False
Beispiel #17
0
def correctFunc1(test):
    test.test = lambda: assertlib.between(
        lib.getFunction("riemann", _fileName)
        (lambda x: x**(x + 0.5), 0, 1, 10000), 0.52, 0.53)
    test.description = lambda: "riemann() yields the correct value of an integral on [0,1] for the square function"
Beispiel #18
0
def returnTypeIsList(test):
    test.test = lambda : assertlib.sameType(lib.getFunction("nulpunten", _fileName)(1,2,-10), [])
    test.description = lambda : "nulpunten geeft een lijst terug"
Beispiel #19
0
def correctFunc3(test):
    test.test = lambda: assertlib.between(
        lib.getFunction("riemann", _fileName)
        (lambda x: math.sin(x**2), 0, math.pi, 10000), 0.77, 0.78)
    test.description = lambda: "riemann() yields the correct value when a function goes below the x-axis"
Beispiel #20
0
def correct(test):
	test.test = lambda : assertlib.exact(sorted(int(p * 10) for p in lib.getFunction("nulpunten", _fileName)(1,2,-10)), [-43, 23])
	test.description = lambda : "vindt de nulpunten voor invoer a=1, b=2, c=-10"
def correctFunc2(test):
	test.test = lambda : assertlib.between(lib.getFunction("riemann", _fileName)(lambda x : math.tan(math.cos(math.sin(x))), 0.2, 2.2, 10000), 1.70, 1.71)
	test.description = lambda : "riemann werkt correct wanneer het beginpunt niet gelijk is aan 0"
Beispiel #22
0
def correctNone(test):
    test.test = lambda : assertlib.exact(sorted(int(p * 10) for p in lib.getFunction("nulpunten", _fileName)(3,6,9)), [])
    test.description = lambda : "vindt geen nulpunten voor invoer a=3, b=6, c=9"
Beispiel #23
0
def returnTypeIsList(test):
    test.test = lambda: assertlib.sameType(
        lib.getFunction("roots", _fileName)(1, 2, -10), [])
    test.description = lambda: "roots() returns a list"
Beispiel #24
0
 def testMethod():
     throw = lib.getFunction("throw", _fileName)
     return asserts.containsOnly([throw() for i in range(10000)],
                                 list(range(2, 13)))
Beispiel #25
0
def correctNone(test):
    test.test = lambda: assertlib.exact(
        sorted(
            int(p * 10)
            for p in lib.getFunction("roots", _fileName)(3, 6, 9)), [])
    test.description = lambda: "roots() yields no roots for a=3, b=6, c=9"
Beispiel #26
0
 def testMethod():
     import monopoly
     possession = lib.getFunction("possession", _fileName)
     return asserts.sameType(possession(monopoly.Board()), dict())
Beispiel #27
0
def is_list_exact_matches(test):
    test.test = lambda: assertlib.sameType(
        lib.getFunction("exact_matches", _fileName)("a", "a"), [])
    test.description = lambda: "exact_matches returns a list"
Beispiel #28
0
 def testMethod():
     throw = lib.getFunction("throw", _fileName)
     n = 10000
     s = sum(throw() for i in range(n))
     return asserts.between(s / n, 6.5, 7.5)
Beispiel #29
0
def exact_matches_c(test):
    test.test = lambda: set(
        lib.getFunction("exact_matches", _fileName)
        ("atgacatgca", "b")) == set([])
    test.description = lambda: "exact_matches works for input 'atgacatgca', 'b'"
Beispiel #30
0
def correctVierkant(test):
	test.test = lambda : assertlib.between(lib.getFunction("square", _fileName)(10000), 0.51, 0.54)
	test.description = lambda : "square() yields the correct distance"