Ejemplo n.º 1
0
    def test_run(self):
        output = StringIO()

        app = FizzBuzz()
        app.run(100, output)

        self.failIf(len(output.getvalue().splitlines()) == 100)
Ejemplo n.º 2
0
    def test_run(self):
        output = StringIO()

        app = FizzBuzz()
        app.run(100, output)

        self.failIf(len(output.getvalue().splitlines()) != 100)
Ejemplo n.º 3
0
    def test_run(self):
        output = StringIO()

        app = FizzBuzz()
        app.run(100, output)

        # Test if there are 100 lines in output
        self.failIf(len(output.getvalue().splitlines()) != 100)
Ejemplo n.º 4
0
 def test_three(self):
     app = FizzBuzz()
     output = StringIO()
     app.run(100, output)
     
     self.failIf(output.getvalue().splitlines().count("Fizz") != 26)
     self.failIf(output.getvalue().splitlines().count("Buzz") != 13)
     self.failIf(output.getvalue().splitlines().count("FizzBuzz") != 6)
Ejemplo n.º 5
0
    def test_V2_primes(self):
        app = FizzBuzz()

        self.failIf(app.calc(7) != "7 is a prime")
        self.failIf(app.calc(11) != "11 is a prime")
        self.failIf(app.calc(19) != "19 is a prime")
        self.failIf(app.calc(23) != "23 is a prime")
        self.failIf(app.calc(31) != "31 is a prime")
Ejemplo n.º 6
0
    def test_run(self):
        output = StringIO()

        app = FizzBuzz()
        app.run(100, output)
        op = len(output.getvalue().splitlines())
        print "Outputlines: " + str(op)
        self.failIf(op != 99)
Ejemplo n.º 7
0
    def test_prime(self):
        app = FizzBuzz()
        output = StringIO()
        app.run(100, output)

        lista = output.getvalue().splitlines()
        primecount = ['is a prime' in x for x in lista]
        self.failIf(primecount.count(True) !=25)
Ejemplo n.º 8
0
    def test_V2_primes(self):
        app = FizzBuzz()

        self.failIf(app.calc(7) !=  "7 is a prime")
        self.failIf(app.calc(11) !=  "11 is a prime")
        self.failIf(app.calc(19) !=  "19 is a prime")
        self.failIf(app.calc(23) !=  "23 is a prime")
        self.failIf(app.calc(31) !=  "31 is a prime")
Ejemplo n.º 9
0
    def test_two(self):
        app = FizzBuzz()
        output = StringIO()
        app.run(50, output)
#        print output.getvalue().splitlines()[2]
        self.failIf(output.getvalue().splitlines()[0] != "1")
        self.failIf(output.getvalue().splitlines()[5] != "Fizz")
        self.failIf(output.getvalue().splitlines()[9] != "Buzz")
        self.failIf(output.getvalue().splitlines()[14] != "FizzBuzz")   
        self.failIf(output.getvalue().splitlines()[44] != "FizzBuzz")   
Ejemplo n.º 10
0
 def test_ver1(self):
     app = FizzBuzz()
     self.failIf(app.calc(87) != "Fizz")
     self.failIf(app.calc(20) != "Buzz")
     self.failIf(app.calc(45) != "FizzBuzz")
     self.failIf(app.calc(1500) != "FizzBuzz")
     self.failIf(app.calc(37284) != "Fizz")
Ejemplo n.º 11
0
 def test_four(self):
     app = FizzBuzz()
     self.failIf(app.calc(30) != "FizzBuzz")
Ejemplo n.º 12
0
 def test_three(self):
     app = FizzBuzz()
     self.failIf(app.calc(10) != "Buzz")
Ejemplo n.º 13
0
 def test_two(self):
     app = FizzBuzz()
     self.failIf(app.calc(6) != "Fizz")
Ejemplo n.º 14
0
 def test_5_7(self):
     app = FizzBuzz()
     self.failIf(app.calc(10) != "Buzz")
     self.failIf(app.calc(20) != "Buzz")
Ejemplo n.º 15
0
 def test_three(self):
    app = FizzBuzz()
    self.failIf(app.calc(6) != "Fizz")
    self.failIf(app.calc(9) != "Fizz")
Ejemplo n.º 16
0
    def test_fizzbuzz(self):
	app = FizzBuzz()
	
	self.failIf(app.calc(30) != "FizzBuzz")
	self.failIf(app.calc(90) != "FizzBuzz")
Ejemplo n.º 17
0
 def test_five(self):
     app = FizzBuzz()
     self.failIf(app.calc(15) != "FizzBuzz")
     self.failIf(app.calc(30) != "FizzBuzz")
Ejemplo n.º 18
0
    def test_V1_number(self):
        app = FizzBuzz()

        self.failIf(app.calc(1) != 1)
Ejemplo n.º 19
0
    def test_fizz(self):
	app = FizzBuzz()

	self.failIf(app.calc(6) != "Fizz")
	self.failIf(app.calc(18) != "Fizz")
	self.failIf(app.calc(99) != "Fizz")
Ejemplo n.º 20
0
    def test_V1_div35(self):
        app = FizzBuzz()

        self.failIf(app.calc(15) != "FizzBuzz")
        self.failIf(app.calc(45) != "FizzBuzz")
Ejemplo n.º 21
0
    def test_V1_div5(self):
        app = FizzBuzz()

        self.failIf(app.calc(10) != "Buzz")
Ejemplo n.º 22
0
    def test_V1_div3(self):	
	app = FizzBuzz()
		
	self.failIf(app.calc(9) != "Fizz")
Ejemplo n.º 23
0
 def test_primes(self):
     app = FizzBuzz()
     for i in (2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97):
         self.failIf(app.calc(i) != "is a prime")
Ejemplo n.º 24
0
 def test_fizz(self):
     app=FizzBuzz()
     self.failIf(app.calc(9) = "Fizz")
Ejemplo n.º 25
0
 def test_nonprimes(self):
     app = FizzBuzz()
     f = open('nonprimes.txt', 'r')
     for line in f:
         self.failIf(app.is_prime(int(line)) != False)
Ejemplo n.º 26
0
 def test_prime(self):
     app = FizzBuzz()
     self.failIf(app.calc(3) != "3 is a prime")
     self.failIf(app.calc(83) != "83 is a prime")
Ejemplo n.º 27
0
    def test_nonprimes(self):
        app = FizzBuzz()
        f = open('nonprimes.txt', 'r')
        for line in f:
	        self.failIf(app.is_prime(int(line)) != False)
Ejemplo n.º 28
0
    def test_V1_number(self):
        app = FizzBuzz()

        self.failIf(app.calc(1) != 1)
Ejemplo n.º 29
0
    def test_one(self):
        app = FizzBuzz()

        self.failIf(app.calc(1) != 1)
Ejemplo n.º 30
0
 def test_buzz(self):
     app=FizzBuzz()
     self.failIf(app.calc(0) = "Buzz")
Ejemplo n.º 31
0
    def test_buzz(self):
	app = FizzBuzz()

	self.failIf(app.calc(10) != "Buzz")
	self.failIf(app.calc(100) != "Buzz")
Ejemplo n.º 32
0
    def test_V1_div3(self):
        app = FizzBuzz()

        self.failIf(app.calc(9) != "Fizz")
Ejemplo n.º 33
0
    def test_prime(self):
	app = FizzBuzz()

	self.failIf(app.calc(3) != "3 is a prime")
	self.failIf(app.calc(11) != "11 is a prime")
	self.failIf(app.calc(97) != "97 is a prime")
Ejemplo n.º 34
0
    def test_V1_div5(self):
        app = FizzBuzz()

        self.failIf(app.calc(10) != "Buzz")
Ejemplo n.º 35
0
    def test_one(self):
        app = FizzBuzz()

        self.failIf(app.calc(1) != 1)
Ejemplo n.º 36
0
    def test_V1_div35(self):
        app = FizzBuzz()

        self.failIf(app.calc(15) != "FizzBuzz")
        self.failIf(app.calc(45) != "FizzBuzz")