TestPrimes - /usr/bin/env python import StringIO import...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#!/usr/bin/env python import StringIO import unittest from Primes import primes_read, primes_eval, primes_print, assignPrimes, isPrime # ----------- # TestPrimes # ----------- class TestPrimes (unittest.TestCase) : # ---- # read # ---- def test_read (self) : r = StringIO.StringIO("8\n") a = [0] b = primes_read(r, a) self.assert_(b == True) self.assert_(a[0] == 8) # ---- # eval # ---- def test_eval_1 (self) : a = [1] v = primes_eval(a) self.assert_(v == None) def test_eval_2 (self) : a = [8] v = primes_eval(a) b = [2, 2, 2, 2] self.assert_(v[0] == b[0]) self.assert_(v[0] == b[1]) self.assert_(v[0] == b[2]) self.assert_(v[0] == b[3]) def test_eval_3 (self): a = [9] v = primes_eval(a) b = [3, 2, 2, 2] self.assert_(v[0] == b[0]) self.assert_(v[1] == b[1]) self.assert_(v[2] == b[2]) self.assert_(v[3] == b[3]) def test_eval_4 (self): a = [10000000]
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/05/2010 for the course CS 373 taught by Professor Downing,glennp during the Fall '08 term at University of Texas.

Page1 / 2

TestPrimes - /usr/bin/env python import StringIO import...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online