Esempio n. 1
0
    def test_arbitrary_points(self):
        for kmax in [10, 20, 100]:
            c = complex(1, 1.5)
            count = calculate_point(c, kmax)
            assert count == 2

            c = complex(-1, 1.5)
            count = calculate_point(c, kmax)
            assert count == 2

            c = complex(-1, -1.5)
            count = calculate_point(c, kmax)
            assert count == 2

            c = complex(1, -1.5)
            count = calculate_point(c, kmax)
            assert count == 2

            c = complex(1, 0)
            count = calculate_point(c, kmax)
            assert count == 3

            c = complex(0.2, 1)
            count = calculate_point(c, kmax)
            assert count == 4

            c = complex(0.2, 0.7)
            count = calculate_point(c, kmax)
            assert count == 6

            c = complex(-0.2, 0.9)
            count = calculate_point(c, kmax)
            assert count == 9
Esempio n. 2
0
    def test_arbitrary_points(self):
    	for kmax in [10,20,100]:	    
	    c = complex(1, 1.5)
	    count = calculate_point(c, kmax)
	    assert count == 2    
	    
	    c = complex(-1, 1.5)
	    count = calculate_point(c, kmax)
	    assert count == 2    	    
	    
	    c = complex(-1, -1.5)
	    count = calculate_point(c, kmax)
	    assert count == 2    	    	    
	    
	    c = complex(1, -1.5)
	    count = calculate_point(c, kmax)
	    assert count == 2    	    	    	    
	    
	    c = complex(1, 0)
	    count = calculate_point(c, kmax)
	    assert count == 3    	    	    	    	    
	    
	    c = complex(0.2, 1)
	    count = calculate_point(c, kmax)
	    assert count == 4    	    	    	    	    	    
	    
	    c = complex(0.2, 0.7)
	    count = calculate_point(c, kmax)
	    assert count == 6    	    	    	    	    	    	    
	    
	    c = complex(-0.2, 0.9)
	    count = calculate_point(c, kmax)
	    assert count == 9
Esempio n. 3
0
    def test_points_clearly_outside_set(self):	
    
    	for kmax in [1,2,3,5,10,20,100]:
	    for c in [complex(5, 4), complex(2,1), complex(-2,1),
	    	      complex(2,-1), complex(-2,-1)]:
	        count = calculate_point(c, kmax)
	        assert count == 1
Esempio n. 4
0
    def test_points_clearly_outside_set(self):

        for kmax in [1, 2, 3, 5, 10, 20, 100]:
            for c in [complex(5, 4), complex(2, 1), complex(-2, 1),
                      complex(2, -1), complex(-2, -1)]:
                count = calculate_point(c, kmax)
                assert count == 1
Esempio n. 5
0
    def test_basic(self):
        """Test that c==0 always returns kmax
	"""

	c = complex(0, 0)
	
	for kmax in [0,1,2,3,4,10, 20, 33, 45, 100]:
	    count = calculate_point(c, kmax)	
            assert count == kmax    	
Esempio n. 6
0
    def test_basic(self):
        """Test that c==0 always returns kmax
	"""

        c = complex(0, 0)

        for kmax in [0, 1, 2, 3, 4, 10, 20, 33, 45, 100]:
            count = calculate_point(c, kmax)
            assert count == kmax
Esempio n. 7
0
 def test_another_known_point(self):
     c = complex(0.5, 0.5)
     count = calculate_point(c, 256)
     assert count == 5        
Esempio n. 8
0
 def test_another_known_point(self):
     c = complex(0.5, 0.5)
     count = calculate_point(c, 256)
     assert count == 5