Example #1
0
#!/usr/bin/env python
from testCore import assertEquals
assertEquals("FIRST ARRAY")
assertEquals("")
assertEquals(" 1  2  3  4  5  6  7 ")
assertEquals(" 2  4  6  8  10  12  14 ")
assertEquals(" 3  6  9  12  15  18  21 ")
assertEquals(" 4  8  12  16  20  24  28 ")
assertEquals("")
assertEquals("3 TIMES VALUES IN FIRST ARRA")
assertEquals("Y")
assertEquals("")
assertEquals(" 3  6  9  12  15  18  21 ")
assertEquals(" 6  12  18  24  30  36  42 ")
assertEquals(" 9  18  27  36  45  54  63 ")
assertEquals(" 12  24  36  48  60  72  84 ")

Example #2
0
#!/usr/bin/env python
from testCore import assertEquals
lineNumber = 0
def assertEquals(x):
	global lineNumber
	lineNumber = lineNumber + 1
	input = raw_input()
	if (x == input): return
	print "Line %d: '%s' != '%s'" % (lineNumber,x,input)
# Page II-63
assertEquals(" 2  4 ")
assertEquals(" 6  7 ")
assertEquals(" 8  1 ")
assertEquals(" 2  3 ")
assertEquals(" 4  5 ")
assertEquals("HELLO")
assertEquals("JONES, MARY")
assertEquals(" 28 ")
assertEquals(" 3.1416 ")
assertEquals("A$ IS HI")
assertEquals("B$ IS ")
assertEquals("C IS  2 ")
assertEquals("A$ IS ")
assertEquals("this is the first string.")
assertEquals("B$ IS .")
assertEquals("C$ IS .")
assertEquals("D IS  5 .")
Example #3
0
#!/usr/bin/env python
from testCore import assertEquals

# Scenarios from II-65
assertEquals(" 10  20 ")
assertEquals("TI COMPUTER")
assertEquals("HELLO, FRIEND")
assertEquals("HIJOAN")
assertEquals("HI JOAN")
assertEquals("HELLO JOAN")
assertEquals(" 10.2 -30.5  16.7 ")
assertEquals("-20.3 ")

# Number printing scenarios from II-66 of User's Reference Guide
assertEquals("-10  7.1 ")
assertEquals(" 9.34277E+10 ")
assertEquals(" .0000000001 ")
assertEquals(" 1.2E-10 ")
assertEquals(" 2.46E-10 ")
assertEquals(" 15 -3 ")
assertEquals(" 3.35 -46.1 ")
assertEquals(" 791.1234568 ")
assertEquals("-.0127  .64 ")
assertEquals(" 1.97853E-10 ")
assertEquals("-9.877E+22 ")
assertEquals(" 7.364E+12 ")
assertEquals(" 1.23659E-14 ")
assertEquals(" 1.25E-09 -4.36E+13 ")
assertEquals(" 7.6E+**  8.1E-** ")

# Scenarios from II-67
Example #4
0
#!/usr/bin/env python
from testCore import assertEquals

assertEquals(" 1  2   1  4   1  6   1  8  ")
assertEquals(" 3  2   3  4   3  6   3  8  ")
assertEquals(" 5  2   5  4   5  6   5  8  ")
assertEquals(" 7  2   7  4   7  6   7  8  ")
Example #5
0
#!/usr/bin/env python
from testCore import assertEquals

assertEquals(" 1 |  2  3  4  5 ")
assertEquals("")
assertEquals("~~~~~~~~~~~~~~~~~~")
assertEquals(" 2 |  4  6  8  10 ")
assertEquals(" 3 |  6  9  12  15 ")
assertEquals(" 4 |  8  12  16  20 ")
assertEquals(" 5 |  10  15  20  25 ")
Example #6
0
#!/usr/bin/env python
from testCore import assertEquals
# Page II-61
assertEquals(" 22  15 ")
assertEquals(" 36  52 ")
assertEquals(" 48  96.5 ")

assertEquals(" 2  4  6  8  10  12  14  16 ")
assertEquals(" 12  14  16  18  20  22  24 ")
assertEquals(" 26 ")

Example #7
0
#!/usr/bin/env python
from testCore import assertEquals
assertEquals("Total number of gifts is 78 ")